stdenv-darwin: Auto-detect the "right" SDK version

This commit is contained in:
Eelco Dolstra 2015-03-23 16:46:41 +01:00
parent ead7762573
commit d3756e162c

View file

@ -50,7 +50,11 @@ rec {
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
xargsFlags=" "
export MACOSX_DEPLOYMENT_TARGET=10.7
export SDKROOT=$(/usr/bin/xcrun --sdk macosx10.9 --show-sdk-path 2> /dev/null || echo /)
# Use the 10.9 SDK if we're running on 10.9, and 10.10 if we're
# running on 10.10. We need to use the 10.10 headers for functions
# like readlinkat() that are dynamically detected by configure
# scripts. Very impure, obviously.
export SDKROOT=$(/usr/bin/xcrun --sdk macosx"$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f1,2)" --show-sdk-path 2> /dev/null || echo /)
export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT/usr/include -F$SDKROOT/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations"
export NIX_LDFLAGS_AFTER+=" -L$SDKROOT/usr/lib"
export CMAKE_OSX_ARCHITECTURES=x86_64