Skip to content

Commit

Permalink
bazel: add gcc to PATH and simplify patch
Browse files Browse the repository at this point in the history
Removed patches that are purely for testing.
Removed dependencies that seemed to not be needed.
Expand all instances of #!/bin/bash, not just those at the start of scripts.
  • Loading branch information
izuk committed Mar 2, 2017
1 parent b8812df commit 1f709ad
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions pkgs/development/tools/build-managers/bazel/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, jdk, zip, unzip, which, bash, binutils, coreutils, makeWrapper }:
{ stdenv, fetchurl, jdk, zip, unzip, bash, makeWrapper }:

stdenv.mkDerivation rec {

Expand All @@ -22,24 +22,16 @@ stdenv.mkDerivation rec {
sourceRoot = ".";

postPatch = ''
patchShebangs .
for f in $(grep -l -r '#!/bin/bash'); do
substituteInPlace "$f" --replace '#!/bin/bash' '#!${bash}/bin/bash'
done
for f in \
src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java \
src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java \
src/test/java/com/google/devtools/build/lib/shell/CommandTest.java \
src/test/java/com/google/devtools/build/lib/shell/InterruptibleTest.java \
src/test/java/com/google/devtools/build/lib/shell/LoadTest.java \
src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java \
src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
do
substituteInPlace $f \
--replace /bin/bash ${bash}/bin/bash \
--replace /bin/cat ${coreutils}/bin/cat \
--replace /bin/echo ${coreutils}/bin/echo \
--replace /bin/false ${coreutils}/bin/false \
--replace /bin/pwd ${coreutils}/bin/pwd \
--replace /bin/sleep ${coreutils}/bin/sleep \
--replace /bin/true ${coreutils}/bin/true
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
'';

Expand All @@ -49,8 +41,6 @@ stdenv.mkDerivation rec {
jdk
zip
unzip
which
binutils
makeWrapper
];

Expand All @@ -59,7 +49,6 @@ stdenv.mkDerivation rec {

propagatedBuildInputs = [
bash
coreutils
];

# If TMPDIR is in the unpack dir we run afoul of blaze's infinite symlink
Expand All @@ -81,10 +70,12 @@ stdenv.mkDerivation rec {
examples/java-native/src/test/java/com/example/myproject:hello
'';

# Bazel expects gcc and java to be in the path.

installPhase = ''
mkdir -p $out/bin
mv output/bazel $out/bin
wrapProgram "$out/bin/bazel" --prefix PATH : "${jdk}/bin"
wrapProgram "$out/bin/bazel" --prefix PATH : "${stdenv.cc}/bin:${jdk}/bin"
'';

dontStrip = true;
Expand Down

0 comments on commit 1f709ad

Please sign in to comment.