From b0c73c3325ac26fdc7aae4cd17e74260eee1087d Mon Sep 17 00:00:00 2001 From: takanori-ihara <62980219+takanori-ihara@users.noreply.github.com> Date: Wed, 17 Jun 2020 12:18:04 +0900 Subject: bazel: Update for use with Fujitsu compiler (#16860) * bazel: Update for use with Fujitsu compiler * bazel: Fix for use with Fujitsu compiler * bazel: Fix flake8 error * bazel: add conflicts setting for use with Fujitsu compiler * fix flake8 error * fix flake8 error --- var/spack/repos/builtin/packages/bazel/package.py | 14 ++++++++ .../builtin/packages/bazel/patch_for_fcc.patch | 37 ++++++++++++++++++++++ .../builtin/packages/bazel/patch_for_fcc2.patch | 11 +++++++ 3 files changed, 62 insertions(+) create mode 100644 var/spack/repos/builtin/packages/bazel/patch_for_fcc.patch create mode 100644 var/spack/repos/builtin/packages/bazel/patch_for_fcc2.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/bazel/package.py b/var/spack/repos/builtin/packages/bazel/package.py index a3bd59a8b1..27f2da0597 100644 --- a/var/spack/repos/builtin/packages/bazel/package.py +++ b/var/spack/repos/builtin/packages/bazel/package.py @@ -130,6 +130,16 @@ class Bazel(Package): patch('compile-0.4.patch', when='@0.4:0.5') patch('compile-0.3.patch', when='@:0.3') + # for fcc + patch('patch_for_fcc.patch', when='@0.29.1:%fj') + patch('patch_for_fcc2.patch', when='@0.25:%fj') + conflicts( + '%fj', + when='@:0.24.1', + msg='Fujitsu Compiler cannot build 0.24.1 or less, ' + 'please use a newer release.' + ) + patch('disabledepcheck.patch', when='@0.3.2:+nodepfail') patch('disabledepcheck_old.patch', when='@0.3.0:0.3.1+nodepfail') @@ -201,3 +211,7 @@ java_binary( def setup_dependent_package(self, module, dependent_spec): module.bazel = Executable('bazel') + + @property + def parallel(self): + return not self.spec.satisfies('%fj') diff --git a/var/spack/repos/builtin/packages/bazel/patch_for_fcc.patch b/var/spack/repos/builtin/packages/bazel/patch_for_fcc.patch new file mode 100644 index 0000000000..d90448b0ba --- /dev/null +++ b/var/spack/repos/builtin/packages/bazel/patch_for_fcc.patch @@ -0,0 +1,37 @@ +diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc +index 87ba899180..1c967ee818 100644 +--- a/src/main/cpp/blaze_util_posix.cc ++++ b/src/main/cpp/blaze_util_posix.cc +@@ -565,7 +565,8 @@ static int setlk(int fd, struct flock *lock) { + // Prefer OFD locks if available. POSIX locks can be lost "accidentally" + // due to any close() on the lock file, and are not reliably preserved + // across execve() on Linux, which we need for --batch mode. +- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0; ++ //if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0; ++ if (fcntl(fd, F_SETLK, lock) == 0) return 0; + if (errno != EINVAL) { + if (errno != EACCES && errno != EAGAIN) { + BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR) +diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl +index ccb18a431a..0c5c8fd6f0 100644 +--- a/tools/cpp/unix_cc_configure.bzl ++++ b/tools/cpp/unix_cc_configure.bzl +@@ -379,7 +379,8 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools): + "", + False, + ), ":") +- gold_linker_path = _find_gold_linker_path(repository_ctx, cc) ++ #gold_linker_path = _find_gold_linker_path(repository_ctx, cc) ++ gold_linker_path = None + cc_path = repository_ctx.path(cc) + if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"): + # cc is outside the repository, set -B +@@ -468,7 +469,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools): + # Security hardening requires optimization. + # We need to undef it as some distributions now have it enabled by default. + "-U_FORTIFY_SOURCE", +- "-fstack-protector", ++ #"-fstack-protector", + # All warnings are enabled. Maybe enable -Werror as well? + "-Wall", + # Enable a few more warnings that aren't part of -Wall. diff --git a/var/spack/repos/builtin/packages/bazel/patch_for_fcc2.patch b/var/spack/repos/builtin/packages/bazel/patch_for_fcc2.patch new file mode 100644 index 0000000000..709e5ee020 --- /dev/null +++ b/var/spack/repos/builtin/packages/bazel/patch_for_fcc2.patch @@ -0,0 +1,11 @@ +--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java ++++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +@@ -185,7 +185,7 @@ public class BazelRuleClassProvider { + + Map spackEnv = System.getenv(); + for (String envName : spackEnv.keySet()) { +- if (envName.startsWith("SPACK_")) { ++ if ((envName.startsWith("SPACK_")) || (envName.equals("fcc_ENV")) || (envName.equals("FCC_ENV"))) { + env.put(envName, spackEnv.get(envName)); + } + } -- cgit v1.2.3-70-g09d2