1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/stdenv/nix/default.nix
Eelco Dolstra 89f8af55f1 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.
2014-07-01 11:01:36 +02:00

59 lines
1.7 KiB
Nix

{ stdenv, pkgs, config }:
import ../generic rec {
inherit config;
preHook =
''
export NIX_ENFORCE_PURITY=1
export NIX_IGNORE_LD_THROUGH_GCC=1
if [ "$system" = "i686-darwin" -o "$system" = "powerpc-darwin" -o "$system" = "x86_64-darwin" ]; then
export NIX_ENFORCE_PURITY=
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
dontFixLibtool=1
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;};
system = stdenv.system;
gcc = import ../../build-support/gcc-wrapper {
nativeTools = false;
nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
nativeLibc = true;
inherit stdenv;
binutils =
if stdenv.isDarwin then
import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}
else
pkgs.binutils;
gcc = pkgs.gcc.gcc;
coreutils = pkgs.coreutils;
shell = pkgs.bash + "/bin/sh";
};
shell = pkgs.bash + "/bin/sh";
fetchurlBoot = stdenv.fetchurlBoot;
overrides = pkgs_: {
inherit gcc;
inherit (gcc) binutils;
inherit (pkgs)
gzip bzip2 xz bash coreutils diffutils findutils gawk
gnumake gnused gnutar gnugrep gnupatch perl;
};
}