bazel: fix linker flags for darwin
This commit is contained in:
parent
1ddb140d95
commit
d1ee615f1c
1 changed files with 10 additions and 2 deletions
|
@ -326,6 +326,14 @@ stdenv.mkDerivation rec {
|
||||||
postPatch = let
|
postPatch = let
|
||||||
|
|
||||||
darwinPatches = ''
|
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
|
# Disable Bazel's Xcode toolchain detection which would configure compilers
|
||||||
# and linkers from Xcode instead of from PATH
|
# and linkers from Xcode instead of from PATH
|
||||||
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
|
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
|
||||||
|
@ -335,14 +343,14 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
# Framework search paths aren't added by bintools hook
|
# Framework search paths aren't added by bintools hook
|
||||||
# https://github.com/NixOS/nixpkgs/pull/41914
|
# 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
|
# libcxx includes aren't added by libcxx hook
|
||||||
# https://github.com/NixOS/nixpkgs/pull/41589
|
# 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 ${libcxx}/include/c++/v1"
|
||||||
|
|
||||||
# don't use system installed Xcode to run clang, use Nix clang instead
|
# 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 \
|
scripts/bootstrap/compile.sh \
|
||||||
src/tools/xcode/realpath/BUILD \
|
src/tools/xcode/realpath/BUILD \
|
||||||
src/tools/xcode/stdredirect/BUILD \
|
src/tools/xcode/stdredirect/BUILD \
|
||||||
|
|
Loading…
Reference in a new issue