diff options
author | Uri Baghin <uri@canva.com> | 2018-06-13 15:32:16 +1000 |
---|---|---|
committer | Uri Baghin <uri@canva.com> | 2018-06-13 15:32:16 +1000 |
commit | 8bf1a5c4692fcd0fc2487cad3144ca5482b2729b (patch) | |
tree | e5c62eaa6f646e8e518f742c66ef355061290dbb | |
parent | 274bb96073d9b263821dc68a1d2d65bec24b99f2 (diff) | |
download | nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar.gz nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar.bz2 nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar.lz nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar.xz nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.tar.zst nixlib-8bf1a5c4692fcd0fc2487cad3144ca5482b2729b.zip |
bazel: fix darwin build
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/default.nix | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index e641e69bae6d..941004234011 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -40,7 +40,6 @@ stdenv.mkDerivation rec { extern char **environ; int main(int argc, char *argv[]) { - printf("environ: %s\n", environ[0]); char *path = getenv("PATH"); char *pathToAppend = "${lib.makeBinPath [ coreutils ]}"; char *newPath; @@ -57,12 +56,22 @@ stdenv.mkDerivation rec { } ''; - postPatch = '' + postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin '' + export NIX_LDFLAGS="$NIX_LDFLAGS -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks" + '' + '' 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 \ --replace /usr/bin/env ${coreutils}/bin/env done + echo "build --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\"" >> .bazelrc + echo "build --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\"" >> .bazelrc + echo "build --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\"" >> .bazelrc + echo "build --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\"" >> .bazelrc + sed -i -e "348 a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" scripts/bootstrap/compile.sh + sed -i -e "348 a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" scripts/bootstrap/compile.sh + sed -i -e "348 a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" scripts/bootstrap/compile.sh + sed -i -e "348 a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" scripts/bootstrap/compile.sh patchShebangs . ''; |