summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix5
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix5
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix5
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix5
-rw-r--r--pkgs/os-specific/darwin/usr-include/default.nix21
-rw-r--r--pkgs/top-level/all-packages.nix2
6 files changed, 39 insertions, 4 deletions
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 1b9e4bf666c..088e0683572 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -33,6 +33,7 @@
 , libpthread ? null, libpthreadCross ? null  # required for GNU/Hurd
 , stripped ? true
 , gnused ? null
+, darwin ? null
 }:
 
 assert langJava     -> zip != null && unzip != null
@@ -358,7 +359,9 @@ stdenv.mkDerivation ({
       )
     }
     ${if cross == null
-      then " --with-native-system-header-dir=${getDev stdenv.libc}/include"
+      then if stdenv.isDarwin
+        then " --with-native-system-header-dir=${darwin.usr-include}"
+        else " --with-native-system-header-dir=${getDev stdenv.libc}/include"
       else ""}
     ${if langAda then " --enable-libada" else ""}
     ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 71edda0937f..1db7dadb1e3 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -33,6 +33,7 @@
 , libpthread ? null, libpthreadCross ? null  # required for GNU/Hurd
 , stripped ? true
 , gnused ? null
+, darwin ? null
 }:
 
 assert langJava     -> zip != null && unzip != null
@@ -365,7 +366,9 @@ stdenv.mkDerivation ({
       )
     }
     ${if cross == null
-      then " --with-native-system-header-dir=${getDev stdenv.libc}/include"
+      then if stdenv.isDarwin
+        then " --with-native-system-header-dir=${darwin.usr-include}"
+        else " --with-native-system-header-dir=${getDev stdenv.libc}/include"
       else ""}
     ${if langAda then " --enable-libada" else ""}
     ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index e84c677408c..c1db89d7c38 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -35,6 +35,7 @@
 , gnused ? null
 , binutils ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
+, darwin ? null
 }:
 
 assert langJava     -> zip != null && unzip != null
@@ -363,7 +364,9 @@ stdenv.mkDerivation ({
       )
     }
     ${if cross == null
-      then " --with-native-system-header-dir=${getDev stdenv.libc}/include"
+      then if stdenv.isDarwin
+        then " --with-native-system-header-dir=${darwin.usr-include}"
+        else " --with-native-system-header-dir=${getDev stdenv.libc}/include"
       else ""}
     ${if langAda then " --enable-libada" else ""}
     ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index b33437ee868..530d835620a 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -35,6 +35,7 @@
 , gnused ? null
 , binutils ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
+, darwin ? null
 }:
 
 assert langJava     -> zip != null && unzip != null
@@ -361,7 +362,9 @@ stdenv.mkDerivation ({
       )
     }
     ${if cross == null
-      then " --with-native-system-header-dir=${getDev stdenv.libc}/include"
+      then if stdenv.isDarwin
+        then " --with-native-system-header-dir=${darwin.usr-include}"
+        else " --with-native-system-header-dir=${getDev stdenv.libc}/include"
       else ""}
     ${if langAda then " --enable-libada" else ""}
     ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
diff --git a/pkgs/os-specific/darwin/usr-include/default.nix b/pkgs/os-specific/darwin/usr-include/default.nix
new file mode 100644
index 00000000000..c5f7e3acce7
--- /dev/null
+++ b/pkgs/os-specific/darwin/usr-include/default.nix
@@ -0,0 +1,21 @@
+{stdenv, darwin}:
+
+/*
+ * This is needed to build GCC on Darwin.
+ *
+ * These are the collection of headers that would normally be available under
+ * /usr/include in OS X machines with command line tools installed. They need
+ * to be in one folder for gcc to use them correctly.
+ */
+
+stdenv.mkDerivation {
+  name = "darwin-usr-include";
+  buildInputs = [ darwin.CF stdenv.libc ];
+  buildCommand = ''
+    mkdir -p $out
+    cd $out
+    ln -sf ${stdenv.libc}/include/* .
+    mkdir CoreFoundation
+    ln -sf ${darwin.CF}/Library/Frameworks/CoreFoundation.framework/Headers/* CoreFoundation
+  '';
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ad5f72d7d60..26ea7b3ca05 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10958,6 +10958,8 @@ in
     libobjc = apple-source-releases.objc4;
 
     stubs = callPackages ../os-specific/darwin/stubs {};
+
+    usr-include = callPackage ../os-specific/darwin/macheaders.nix {};
   };
 
   devicemapper = lvm2;