diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-05 10:19:54 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-05 10:19:54 +0100 |
commit | c9a19b5f7e0c63f16d4fd265f68675e4495b9284 (patch) | |
tree | e6a8b4be6bccef324c8f30b46fec90d9a7ceb178 /pkgs/development/tools/build-managers | |
parent | 484b469cafef87f51deea03c5970d67cc47cf2aa (diff) | |
parent | 51ef7c3e497ec09d4bc6b67c7e47e61c308454aa (diff) | |
download | nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar.gz nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar.bz2 nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar.lz nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar.xz nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.tar.zst nixlib-c9a19b5f7e0c63f16d4fd265f68675e4495b9284.zip |
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/tools/build-managers')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/default.nix | 23 | ||||
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/strict_action_env.patch | 13 |
2 files changed, 27 insertions, 9 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index 74a4ff4a3da6..aef940732193 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -19,6 +19,8 @@ , enableNixHacks ? false , gcc-unwrapped , autoPatchelfHook +, file +, substituteAll }: let @@ -91,7 +93,7 @@ let # ], # ) # - [ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip ]; + [ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip file zip ]; # Java toolchain used for the build and tests javaToolchain = "@bazel_tools//tools/jdk:toolchain_host${buildJdkName}"; @@ -145,6 +147,17 @@ stdenv.mkDerivation rec { # This is breaking the build of any C target. This patch removes the last # argument if it's found to be an empty string. ./trim-last-argument-to-gcc-if-empty.patch + + # --experimental_strict_action_env (which may one day become the default + # see bazelbuild/bazel#2574) hardcodes the default + # action environment to a non hermetic value (e.g. "/usr/local/bin"). + # This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries. + # So we are replacing this bazel paths by defaultShellPath, + # improving hermeticity and making it work in nixos. + (substituteAll { + src = ./strict_action_env.patch; + strictActionEnvPatch = defaultShellPath; + }) ] ++ lib.optional enableNixHacks ./nix-hacks.patch; @@ -390,14 +403,6 @@ stdenv.mkDerivation rec { -e "/\$command \\\\$/a --host_java_toolchain='${javaToolchain}' \\\\" \ -i scripts/bootstrap/compile.sh - # --experimental_strict_action_env (which will soon become the - # default, see bazelbuild/bazel#2574) hardcodes the default - # action environment to a value that on NixOS at least is bogus. - # So we hardcode it to something useful. - substituteInPlace \ - src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java \ - --replace /bin:/usr/bin ${defaultShellPath} - # This is necessary to avoid: # "error: no visible @interface for 'NSDictionary' declares the selector # 'initWithContentsOfURL:error:'" diff --git a/pkgs/development/tools/build-managers/bazel/strict_action_env.patch b/pkgs/development/tools/build-managers/bazel/strict_action_env.patch new file mode 100644 index 000000000000..1402c20f6bdb --- /dev/null +++ b/pkgs/development/tools/build-managers/bazel/strict_action_env.patch @@ -0,0 +1,13 @@ +diff --git 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 +index a70b5559bc..10bdffe961 100644 +--- 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 +@@ -466,7 +466,7 @@ public class BazelRuleClassProvider { + // Note that --action_env does not propagate to the host config, so it is not a viable + // workaround when a genrule is itself built in the host config (e.g. nested genrules). See + // #8536. +- return "/bin:/usr/bin:/usr/local/bin"; ++ return "@strictActionEnvPatch@"; + } + + String newPath = ""; |