Darwin: Search for libraries in $sdk/usr/lib

This required adding a new environment variable NIX_LDFLAGS_AFTER
that ensures that the -L.../usr/lib flag happens last.
This commit is contained in:
Eelco Dolstra 2014-07-01 15:53:30 +02:00
parent 06536251c9
commit 0d8014f6fc
3 changed files with 8 additions and 10 deletions

@ -48,8 +48,8 @@ extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
extra=(${extra[@]} $NIX_LDFLAGS)
extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
extra+=($NIX_LDFLAGS $NIX_LDFLAGS_AFTER)
extraBefore+=($NIX_LDFLAGS_BEFORE)
fi

@ -48,8 +48,8 @@ extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
extra=(${extra[@]} $NIX_LDFLAGS)
extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
extra+=($NIX_LDFLAGS $NIX_LDFLAGS_AFTER)
extraBefore+=($NIX_LDFLAGS_BEFORE)
fi

@ -17,12 +17,10 @@ import ../generic rec {
xargsFlags=" "
fi
'' + (if stdenv.isDarwin then ''
export NIX_CFLAGS_COMPILE="--sysroot=/var/empty"
if xcodePath=$(/usr/bin/xcrun --show-sdk-path 2> /dev/null); then
NIX_CFLAGS_COMPILE+=" -idirafter $xcodePath/usr/include -F$xcodePath/System/Library/Frameworks"
else
NIX_CFLAGS_COMPILE+=" -idirafter /usr/include -F/System/Library/Frameworks"
fi
export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty"
xcodePath=$(/usr/bin/xcrun --show-sdk-path 2> /dev/null || true)
export NIX_CFLAGS_COMPILE+=" -idirafter $xcodePath/usr/include -F$xcodePath/System/Library/Frameworks"
export NIX_LDFLAGS_AFTER+=" -L$xcodePath/usr/lib"
'' else "");
initialPath = (import ../common-path.nix) {pkgs = pkgs;};