summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/4.7/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/gcc/4.7/default.nix')
-rw-r--r--pkgs/development/compilers/gcc/4.7/default.nix57
1 files changed, 44 insertions, 13 deletions
diff --git a/pkgs/development/compilers/gcc/4.7/default.nix b/pkgs/development/compilers/gcc/4.7/default.nix
index 4f260d75afcc..34ea93cf5f0e 100644
--- a/pkgs/development/compilers/gcc/4.7/default.nix
+++ b/pkgs/development/compilers/gcc/4.7/default.nix
@@ -54,7 +54,18 @@ let version = "4.7.3";
     # Whether building a cross-compiler for GNU/Hurd.
     crossGNU = cross != null && cross.config == "i586-pc-gnu";
 
+  /* gccinstall.info says that "parallel make is currently not supported since
+     collisions in profile collecting may occur".
+
+     Parallel make of gfortran is disabled because of an apparent race
+     condition concerning the generation of "bconfig.h". Please try and
+     re-enable parallel make for a later release of gfortran to check whether
+     the error has been fixed.
+  */
+    enableParallelBuilding = !profiledCompiler && !langFortran;
+
     patches = []
+      ++ optional enableParallelBuilding ./parallel-bconfig-4.7.patch
       ++ optional stdenv.isArm [ ./arm-eabi.patch ]
       ++ optional (cross != null) ./libstdc++-target.patch
       # ++ optional noSysDirs ./no-sys-dirs.patch
@@ -278,21 +289,42 @@ stdenv.mkDerivation ({
     ++ (optional stdenv.isDarwin gnused)
     ;
 
-  configureFlagsArray = stdenv.lib.optionals
-    (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
-        [ "--with-host-libstdcxx=-lstdc++ -lgcc_s" ];
+  NIX_LDFLAGS = stdenv.lib.optionalString  stdenv.isSunOS "-lm -ldl";
+
+  preConfigure = ''
+    configureFlagsArray=(
+      ${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
+        "'--with-host-libstdcxx=-lstdc++ -lgcc_s'"}
+      ${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS)
+        "\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\"
+         \"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""}
+    );
+    ${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit)
+      ''
+        export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
+        export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
+        export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
+        export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
+      ''}
+    '';
 
   # 'iant' at #go-nuts@freenode, gccgo maintainer, said that
   # they have a bug in 4.7.1 if adding "--disable-static"
-  dontDisableStatic = langGo;
+  dontDisableStatic = langGo || staticCompiler;
 
   configureFlags = "
+    ${if stdenv.isSunOS then
+      " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
+      # On Illumos/Solaris GNU as is preferred
+      " --with-gnu-as --without-gnu-ld "
+      else ""}
+    --enable-lto
     ${if enableMultilib then "" else "--disable-multilib"}
     ${if enableShared then "" else "--disable-shared"}
-    ${if enablePlugin then "--enable-plugin" else ""}
-    ${if ppl != null then "--with-ppl=${ppl}" else ""}
+    ${if enablePlugin then "--enable-plugin" else "--disable-plugin"}
+    ${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""}
     ${if cloog != null then
-      "--with-cloog=${cloog} --enable-cloog-backend=isl"
+      "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"
       else ""}
     ${if langJava then
       "--with-ecj-jar=${javaEcj} " +
@@ -407,7 +439,9 @@ stdenv.mkDerivation ({
   # Needed for the cross compilation to work
   AR = "ar";
   LD = "ld";
-  CC = "gcc";
+  # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
+  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64"
+       else "gcc";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
   # the library headers and binaries, regarless of the language being
@@ -458,11 +492,7 @@ stdenv.mkDerivation ({
   passthru = { inherit langC langCC langAda langFortran langVhdl
       langGo enableMultilib version; };
 
-  /* From gccinstall.info:
-     "parallel make is currently not supported since collisions in profile
-     collecting may occur"
-  */
-  enableParallelBuilding = !profiledCompiler;
+  inherit enableParallelBuilding;
 
   meta = {
     homepage = http://gcc.gnu.org/;
@@ -497,6 +527,7 @@ stdenv.mkDerivation ({
   installTargets = "install-gcc install-target-libgcc";
 }
 
+
 # Strip kills static libs of other archs (hence cross != null)
 // optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
 )