bazel_0_4: set absolute path to /usr/bin/env

Also cleanup TMPDIR.
This commit is contained in:
Nikolay Amiantov 2017-10-17 18:10:58 +03:00
parent ba9cde1dd5
commit e3afbd6d26

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, jdk, zip, unzip, bash, makeWrapper, which { stdenv, lib, fetchurl, jdk, zip, unzip, bash, makeWrapper, which, coreutils
# Always assume all markers valid (don't redownload dependencies). # Always assume all markers valid (don't redownload dependencies).
# Also, don't clean up environment variables. # Also, don't clean up environment variables.
, enableNixHacks ? false , enableNixHacks ? false
@ -23,27 +23,24 @@ stdenv.mkDerivation rec {
sha256 = "0asmq3kxnl4326zhgh13mvcrc8jvmiswjj4ymrq0943q4vj7nwrb"; sha256 = "0asmq3kxnl4326zhgh13mvcrc8jvmiswjj4ymrq0943q4vj7nwrb";
}; };
preUnpack = ''
mkdir bazel
cd bazel
'';
sourceRoot = "."; sourceRoot = ".";
patches = lib.optional enableNixHacks ./nix-hacks.patch; patches = lib.optional enableNixHacks ./nix-hacks.patch;
postPatch = '' postPatch = ''
for f in $(grep -l -r '#!/bin/bash'); do for f in $(grep -l -r '/bin/bash'); do
substituteInPlace "$f" --replace '#!/bin/bash' '#!${bash}/bin/bash' substituteInPlace "$f" --replace '/bin/bash' '${bash}/bin/bash'
done done
for f in \ for f in $(grep -l -r '/usr/bin/env'); do
src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java \ substituteInPlace "$f" --replace '/usr/bin/env' '${coreutils}/bin/env'
src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java \
src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java \
src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java \
; do
substituteInPlace "$f" --replace /bin/bash ${bash}/bin/bash
done done
''; '';
buildInputs = [ buildInputs = [
stdenv.cc
stdenv.cc.cc.lib
jdk jdk
zip zip
unzip unzip
@ -58,12 +55,7 @@ stdenv.mkDerivation rec {
bash bash
]; ];
# If TMPDIR is in the unpack dir we run afoul of blaze's infinite symlink
# detector (see com.google.devtools.build.lib.skyframe.FileFunction).
# Change this to $(mktemp -d) as soon as we figure out why.
buildPhase = '' buildPhase = ''
export TMPDIR=/tmp
./compile.sh ./compile.sh
./output/bazel --output_user_root=/tmp/.bazel build //scripts:bash_completion \ ./output/bazel --output_user_root=/tmp/.bazel build //scripts:bash_completion \
--spawn_strategy=standalone \ --spawn_strategy=standalone \