diff options
author | Mario Rodas <marsam@users.noreply.github.com> | 2020-02-20 04:20:00 -0500 |
---|---|---|
committer | Mario Rodas <marsam@users.noreply.github.com> | 2020-02-20 04:20:00 -0500 |
commit | d1ee615f1cb48a193bbe194adced53ecb7395d8e (patch) | |
tree | 0a1f516b7fd86b7382344c6669f6ae05276cd1ff /pkgs | |
parent | 1ddb140d95c6a1ab914f1d9f3d5169b12074c333 (diff) | |
download | nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar.gz nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar.bz2 nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar.lz nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar.xz nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.tar.zst nixlib-d1ee615f1cb48a193bbe194adced53ecb7395d8e.zip |
bazel: fix linker flags for darwin
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/default.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index da69000a5e49..884f0253f1a5 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -326,6 +326,14 @@ stdenv.mkDerivation rec { postPatch = let darwinPatches = '' + bazelLinkFlags () { + eval set -- "$NIX_LDFLAGS" + local flag + for flag in "$@"; do + printf ' -Wl,%s' "$flag" + done + } + # 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 @@ -335,14 +343,14 @@ stdenv.mkDerivation rec { # Framework search paths aren't added by bintools hook # https://github.com/NixOS/nixpkgs/pull/41914 - export NIX_LDFLAGS="$NIX_LDFLAGS -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks" + export NIX_LDFLAGS+=" -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks" # 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" # 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 $NIX_LDFLAGS -framework CoreFoundation;g" \ + sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${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 \ |