GCC 4.5: Fix pthread support for GNU.

svn path=/nixpkgs/trunk/; revision=22583
This commit is contained in:
Ludovic Courtès 2010-07-13 16:32:26 +00:00
parent f0ef9cdb40
commit 97ab4c05b2

View File

@ -150,19 +150,28 @@ stdenv.mkDerivation ({
|| (cross != null && cross.config == "i586-pc-gnu" || (cross != null && cross.config == "i586-pc-gnu"
&& libcCross != null)) && libcCross != null))
then then
# On GNU/Hurd glibc refers to Hurd & Mach headers so add the right `-I' # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
# flags to the default spec string. # in glibc, so add the right `-I' flags to the default spec string.
let let
libc = if cross != null then libcCross else stdenv.glibc; libc = if cross != null then libcCross else stdenv.glibc;
config_h = "gcc/config/i386/gnu.h"; config_h = "gcc/config/i386/gnu.h";
extraCPPDeps =
libc.propagatedBuildInputs
++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
++ stdenv.lib.optional (libpthread != null) libpthread;
extraCPPSpec = extraCPPSpec =
concatStrings (intersperse " " concatStrings (intersperse " "
(map (x: "-I${x}/include") (map (x: "-I${x}/include") extraCPPDeps));
libc.propagatedBuildInputs)); pthreadLib =
if libpthreadCross != null then libpthreadCross else libpthread;
in in
'' echo "augmenting \`CPP_SPEC' in \`${config_h}' with \`${extraCPPSpec}'..." '' echo "augmenting \`CPP_SPEC' in \`${config_h}' with \`${extraCPPSpec}'..."
sed -i "${config_h}" \ sed -i "${config_h}" \
-es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g' -es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g'
echo "augmenting \`LIB_SPEC' in \`${config_h}' for libpthread at \`${pthreadLib}'..."
sed -i "${config_h}" \
-es'|-lpthread|-L${pthreadLib}/lib -lpthread|g'
'' ''
else null; else null;