From d3756e162c9dcb988766e3388ebc9165bb7a12b2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 23 Mar 2015 16:46:41 +0100 Subject: [PATCH] stdenv-darwin: Auto-detect the "right" SDK version --- pkgs/stdenv/darwin/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 88275aa0e79c..c5ad0d7d08fc 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -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