bazel: distinguish darwin patches from generic patches
The '' + '' somewhere in the middle is easily missed and extremely inelegant. Also removes unnecessary `stdenv` qualifiers from calls to `lib`.
This commit is contained in:
parent
343e10aaa6
commit
c53e004257
|
@ -9,7 +9,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
srcDeps = stdenv.lib.singleton (
|
||||
srcDeps = lib.singleton (
|
||||
fetchurl {
|
||||
url = "https://github.com/google/desugar_jdk_libs/archive/f5e6d80c6b4ec6b0a46603f72b015d45cf3c11cd.zip";
|
||||
sha256 = "c80f3f3d442d8a6ca7adc83f90ecd638c3864087fdd6787ffac070b6f1cc8f9b";
|
||||
|
@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
|
|||
|
||||
version = "0.15.2";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/bazelbuild/bazel/";
|
||||
description = "Build tool that builds code quickly and reliably";
|
||||
license = licenses.asl20;
|
||||
|
@ -74,7 +74,8 @@ stdenv.mkDerivation rec {
|
|||
}
|
||||
'';
|
||||
|
||||
postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
postPatch = let
|
||||
darwinPatches = ''
|
||||
# Disable Bazel's Xcode toolchain detection which would configure compilers
|
||||
# and linkers from Xcode instead of from PATH
|
||||
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
|
||||
|
@ -103,7 +104,8 @@ stdenv.mkDerivation rec {
|
|||
for wrapper in "''${wrappers[@]}"; do
|
||||
sed -i -e "s,/usr/bin/install_name_tool,${cctools}/bin/install_name_tool,g" $wrapper
|
||||
done
|
||||
'' + ''
|
||||
'';
|
||||
genericPatches = ''
|
||||
find src/main/java/com/google/devtools -type f -print0 | while IFS="" read -r -d "" path; do
|
||||
substituteInPlace "$path" \
|
||||
--replace /bin/bash ${customBash}/bin/bash \
|
||||
|
@ -139,6 +141,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
patchShebangs .
|
||||
'';
|
||||
in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
|
||||
+ genericPatches;
|
||||
|
||||
buildInputs = [
|
||||
jdk
|
||||
|
|
Loading…
Reference in a new issue