summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-24 17:05:52 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-24 17:07:44 +0100
commitdad86b4f544db4d497e4bbe769dec0bb3e9cfbd7 (patch)
treefb4003182701a9873de7f3359b7740152a624ec1
parentb1ec8e6c64afbc5f38068ffe001b6c144432783a (diff)
downloadnixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar.gz
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar.bz2
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar.lz
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar.xz
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.tar.zst
nixpkgs-dad86b4f544db4d497e4bbe769dec0bb3e9cfbd7.zip
Fix building on Xcode
92188d9d1751892ddbf8913da73dfc150d18fadb broke the case where the user
has Xcode but not the command-line tools. So this commit restores
using xcrun to get the path to the SDK (falling back to / for the
non-Xcode case).

http://hydra.nixos.org/build/19953295
-rw-r--r--pkgs/stdenv/darwin/default.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index 2502882123e..89c8c6ee285 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -50,10 +50,10 @@ rec {
     stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
     xargsFlags=" "
     export MACOSX_DEPLOYMENT_TARGET=10.7
-    export SDKROOT=
-    export SDKROOT_X=/ # FIXME: impure!
-    export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT_X/usr/include -F$SDKROOT_X/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations"
-    export NIX_LDFLAGS_AFTER+=" -L$SDKROOT_X/usr/lib"
+    # Use the SDK from Xcode by default, falling back to /usr/{lib,include}.
+    export SDKROOT=$(/usr/bin/xcrun --sdk macosx10.9 --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
   '';