2017-02-15 15:40:27 +00:00
|
|
|
{ stdenv, fetchurl, jdk, zip, unzip, which, bash, binutils, perl }:
|
2016-10-09 03:54:12 +00:00
|
|
|
|
2017-02-15 15:40:27 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2016-10-09 03:54:12 +00:00
|
|
|
|
2017-02-14 00:12:26 +00:00
|
|
|
version = "0.4.4";
|
2016-10-09 03:54:12 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://github.com/bazelbuild/bazel/;
|
|
|
|
description = "Build tool that builds code quickly and reliably";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.philandstuff ];
|
2016-10-09 18:57:16 +00:00
|
|
|
platforms = platforms.linux;
|
2016-10-09 03:54:12 +00:00
|
|
|
};
|
|
|
|
|
2017-02-15 15:40:27 +00:00
|
|
|
name = "bazel-${version}";
|
2016-10-09 03:54:12 +00:00
|
|
|
|
2017-02-15 15:40:27 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
|
|
|
|
sha256 = "1fwfahkqi680zyxmdriqj603lpacyh6cg6ff25bn9bkilbfj2anm";
|
2015-03-25 15:12:02 +00:00
|
|
|
};
|
2016-10-09 03:54:12 +00:00
|
|
|
|
2017-02-15 15:40:27 +00:00
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
patches = [ ./bin_to_env.patch ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs ./compile.sh
|
|
|
|
for d in scripts src/java_tools src/test src/tools third_party/ijar/test tools; do
|
|
|
|
patchShebangs $d
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
bash
|
|
|
|
jdk
|
|
|
|
zip
|
|
|
|
unzip
|
|
|
|
which
|
|
|
|
binutils
|
|
|
|
];
|
|
|
|
|
|
|
|
# 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 = ''
|
|
|
|
export TMPDIR=/tmp
|
|
|
|
./compile.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Build the CPP and Java examples to verify that Bazel works.
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
export TEST_TMPDIR=$(pwd)
|
2017-02-28 00:22:37 +00:00
|
|
|
./output/bazel test --test_output=errors examples/cpp:hello-success_test
|
|
|
|
./output/bazel test --test_output=errors examples/java-native/src/test/java/com/example/myproject:hello
|
2017-02-15 15:40:27 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mv output/bazel $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
}
|