Author: ludo
Date: Tue Jul 13 16:32:26 2010
New Revision: 22583
URL: https://svn.nixos.org/websvn/nix/?rev=22583&sc=1

Log:
GCC 4.5: Fix pthread support for GNU.

Modified:
   nixpkgs/trunk/pkgs/development/compilers/gcc-4.5/default.nix

Modified: nixpkgs/trunk/pkgs/development/compilers/gcc-4.5/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/development/compilers/gcc-4.5/default.nix        Tue Jul 
13 16:32:22 2010        (r22582)
+++ nixpkgs/trunk/pkgs/development/compilers/gcc-4.5/default.nix        Tue Jul 
13 16:32:26 2010        (r22583)
@@ -150,19 +150,28 @@
         || (cross != null && cross.config == "i586-pc-gnu"
             && libcCross != null))
     then
-      # On GNU/Hurd glibc refers to Hurd & Mach headers so add the right `-I'
-      # flags to the default spec string.
+      # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
+      # in glibc, so add the right `-I' flags to the default spec string.
       let
         libc = if cross != null then libcCross else stdenv.glibc;
         config_h = "gcc/config/i386/gnu.h";
+        extraCPPDeps =
+             libc.propagatedBuildInputs
+          ++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
+          ++ stdenv.lib.optional (libpthread != null) libpthread;
         extraCPPSpec =
           concatStrings (intersperse " "
-                          (map (x: "-I${x}/include")
-                               libc.propagatedBuildInputs));
+                          (map (x: "-I${x}/include") extraCPPDeps));
+        pthreadLib =
+          if libpthreadCross != null then libpthreadCross else libpthread;
       in
         '' echo "augmenting \`CPP_SPEC' in \`${config_h}' with 
\`${extraCPPSpec}'..."
            sed -i "${config_h}" \
                -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;
 
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to