3
0
Fork 0
forked from mirrors/nixpkgs

gcc: use special native system headers for darwin

Darwin systems need to be able to find CoreFoundation headers as well as
libc headers. Somehow, gcc doesn't accept any "framework" parameters
that would normally be used to include CoreFoundation in this
situation.

HACK: Instead, this adds a derivation that combines the two. The result
works but probably not a good long term solution.

ALTERNATIVES: Maybe sending patches in to GCC to allow
"native-system-framework" configure flag to get this found.
This commit is contained in:
Matthew Bauer 2016-09-14 22:19:28 -05:00
parent c7e0fbcbc8
commit 8610a34474
No known key found for this signature in database
GPG key ID: E04D0AD9469141C3
6 changed files with 39 additions and 4 deletions

View file

@ -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 ""}

View file

@ -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 ""}

View file

@ -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 ""}

View file

@ -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 ""}

View file

@ -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
'';
}

View file

@ -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;