diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-06-30 19:51:43 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-01 11:01:36 +0200 |
commit | 89f8af55f11b01e68cbfc6d10537413140261721 (patch) | |
tree | 6ae4520e499e8b7e3806a5732ac941894f68fa03 /pkgs/stdenv | |
parent | 55e8e0ef9bf2c927edbdcc05097a1e7185184cba (diff) |
Darwin: Use xcrun to get the path to the SDK
Recent versions of Xcode don't install headers in /usr/include but in a directory like /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include So use that instead, falling back to /usr/include in case of an older version of Xcode.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/nix/default.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index 78e5b84a841e5..84bcea7f643d9 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -16,7 +16,14 @@ import ../generic rec { stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" 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 + '' else ""); initialPath = (import ../common-path.nix) {pkgs = pkgs;}; |