summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2020-10-10 18:24:52 +0100
committerGitHub <noreply@github.com>2020-10-10 18:24:52 +0100
commit96e42b0f55a17e0016fb1782f8d3727551564a26 (patch)
tree1d4b47b5e481ea4181a8c5b96aa99bac6f83a553 /pkgs
parent1548f0698333cebdeeb41bbe7e832aad58fd89ee (diff)
parentf7aafe6345f6d2fa5db8d6b23f7cf9315d73f67d (diff)
Merge pull request #100012 from tricktron/fix-bazel_1-darwin
bazel_1: fix build on darwin
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/build-managers/bazel/bazel_1/default.nix22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
index 8dcdc71415fa..5eb0926503c8 100644
--- a/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
@@ -7,7 +7,7 @@
# updater
, python27, python3, writeScript
# Apple dependencies
-, cctools, libcxx, CoreFoundation, CoreServices, Foundation
+, cctools, llvmPackages_8, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, buildJdkName
@@ -139,8 +139,10 @@ let
'';
};
+ stdenv' = if stdenv.isDarwin then llvmPackages_8.libcxxStdenv else stdenv;
+
in
-stdenv.mkDerivation rec {
+stdenv'.mkDerivation rec {
pname = "bazel";
inherit version;
@@ -348,10 +350,10 @@ stdenv.mkDerivation rec {
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${llvmPackages_8.libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
- sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
+ sed -i -E "s;/usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9;${stdenv'.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
scripts/bootstrap/compile.sh \
src/tools/xcode/realpath/BUILD \
src/tools/xcode/stdredirect/BUILD \
@@ -380,7 +382,7 @@ stdenv.mkDerivation rec {
substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
# md5sum is part of coreutils
- sed -i 's|/sbin/md5|md5sum|' \
+ sed -i 's|/sbin/md5|md5sum|g' \
src/BUILD
# substituteInPlace is rather slow, so prefilter the files with grep
@@ -417,8 +419,8 @@ stdenv.mkDerivation rec {
fetch --distdir=${distDir}
build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
- build --linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
- build --host_linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
+ build --linkopt="$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
+ build --host_linkopt="$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
build --host_linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt="-Wl,/g')"
build --host_javabase='@local_jdk//:jdk'
@@ -428,8 +430,8 @@ stdenv.mkDerivation rec {
# add the same environment vars to compile.sh
sed -e "/\$command \\\\$/a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" \
- -e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
- -e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
+ -e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
+ -e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_javabase='@local_jdk//:jdk' \\\\" \
@@ -469,7 +471,7 @@ stdenv.mkDerivation rec {
makeWrapper
which
customBash
- ] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
+ ] ++ lib.optionals (stdenv.isDarwin) [ cctools CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the