Update the packaged Bazel to 0.3.2, and also make it actually work.

This commit is contained in:
Irene Knapp 2016-10-08 20:54:12 -07:00
parent adfcc2d953
commit 81c82bb5d6
2 changed files with 80 additions and 29 deletions

View file

@ -1,35 +1,70 @@
{ stdenv, fetchFromGitHub, jdk, zip, zlib, protobuf3_0, pkgconfig, libarchive, unzip, which, makeWrapper }:
stdenv.mkDerivation rec {
version = "0.3.1";
name = "bazel-${version}";
{ stdenv, fetchFromGitHub, buildFHSUserEnv, writeScript, jdk, zip, unzip,
which, makeWrapper, binutils }:
src = fetchFromGitHub {
owner = "google";
repo = "bazel";
rev = version;
sha256 = "1cm8zjxf8y3ai6h9wndxvflfsijjqhg87fll9ar7ff0hbbbdf6l5";
};
let
buildInputs = [ pkgconfig protobuf3_0 zlib zip libarchive unzip which makeWrapper jdk ];
version = "0.3.2";
buildPhase = ''
export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
bash compile.sh
'';
installPhase = ''
mkdir -p $out/bin $out/share
cp -R output $out/share/bazel
ln -s $out/share/bazel/bazel $out/bin/bazel
wrapProgram $out/bin/bazel --set JAVA_HOME "${jdk.home}"
'';
meta = {
homepage = http://github.com/google/bazel/;
meta = with stdenv.lib; {
homepage = http://github.com/bazelbuild/bazel/;
description = "Build tool that builds code quickly and reliably";
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.philandstuff ];
license = licenses.asl20;
maintainers = [ maintainers.philandstuff ];
platforms = [ "x86_64-linux" ];
};
}
bootstrapEnv = buildFHSUserEnv {
name = "bazel-bootstrap-env";
targetPkgs = pkgs: [ ];
inherit meta;
};
bazelBinary = stdenv.mkDerivation rec {
name = "bazel-${version}";
src = fetchFromGitHub {
owner = "bazelbuild";
repo = "bazel";
rev = version;
sha256 = "085cjz0qhm4a12jmhkjd9w3ic4a67035j01q111h387iklvgn6xg";
};
patches = [ ./java_stub_template.patch ];
packagesNotFromEnv = [
stdenv.cc stdenv.cc.cc.lib jdk which zip unzip binutils ];
buildInputs = packagesNotFromEnv ++ [ bootstrapEnv makeWrapper ];
buildTimeBinPath = stdenv.lib.makeBinPath packagesNotFromEnv;
buildTimeLibPath = stdenv.lib.makeLibraryPath packagesNotFromEnv;
runTimeBinPath = stdenv.lib.makeBinPath [ jdk stdenv.cc.cc ];
runTimeLibPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib ];
buildWrapper = writeScript "build-wrapper.sh" ''
#! ${stdenv.shell} -e
export PATH="${buildTimeBinPath}:$PATH"
export LD_LIBRARY_PATH="${buildTimeLibPath}:$LD_LIBRARY_PATH"
./compile.sh
'';
buildPhase = ''
bazel-bootstrap-env ${buildWrapper}
'';
installPhase = ''
mkdir -p $out/bin
cp output/bazel $out/bin/
wrapProgram $out/bin/bazel \
--suffix PATH ":" "${runTimeBinPath}" \
--suffix LD_LIBRARY_PATH ":" "${runTimeLibPath}"
'';
dontStrip = true;
dontPatchELF = true;
inherit meta;
};
in bazelBinary

View file

@ -0,0 +1,16 @@
commit 5525326e3287243e0e7417de96bf7d58d04b4c8b
Author: Irene Knapp <ireneista@google.com>
Date: Sat Oct 8 19:36:12 2016 -0700
Change #!/bin/bash to #!/usr/bin/env bash.
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt
index f77051f..fbf367a 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt
@@ -1,4 +1,4 @@
-#!/bin/bash --posix
+#!/usr/bin/env bash
# Copyright 2014 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");