summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@viric.name>2012-12-31 09:32:11 +0000
committerLluís Batlle i Rossell <viric@viric.name>2012-12-31 09:32:11 +0000
commitba7cde015699c037aea4a47c0e7d2787f4d740bc (patch)
treea65fccdf73f06e6f412bd850ffcedcdee652e9d2 /pkgs/development/compilers
parent97d81bde0c1bcc1337e33c709c765021711aeff3 (diff)
downloadnixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar.gz
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar.bz2
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar.lz
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar.xz
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.tar.zst
nixlib-ba7cde015699c037aea4a47c0e7d2787f4d740bc.zip
Porting the platform gcc flags support to gcc 4.7
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/gcc/4.6/default.nix102
-rw-r--r--pkgs/development/compilers/gcc/4.7/default.nix157
2 files changed, 141 insertions, 118 deletions
diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix
index 2c572380d04c..74edfe80c1d8 100644
--- a/pkgs/development/compilers/gcc/4.6/default.nix
+++ b/pkgs/development/compilers/gcc/4.6/default.nix
@@ -118,59 +118,59 @@ let version = "4.6.3";
         withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
         withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
       in
-      "--target=${cross.config}" +
-      withArch +
-      withCpu +
-      withAbi +
-      withFpu +
-      (if crossMingw && crossStageStatic then
-        " --with-headers=${libcCross}/include" +
-        " --with-gcc" +
-        " --with-gnu-as" +
-        " --with-gnu-ld" +
-        " --with-gnu-ld" +
-        " --disable-shared" +
-        " --disable-nls" +
-        " --disable-debug" +
-        " --enable-sjlj-exceptions" +
-        " --enable-threads=win32" +
-        " --disable-win32-registry"
-        else if crossStageStatic then
-        " --disable-libssp --disable-nls" +
-        " --without-headers" +
-        " --disable-threads " +
-        " --disable-libmudflap " +
-        " --disable-libgomp " +
-        " --disable-libquadmath" +
-        " --disable-shared" +
-        " --disable-decimal-float" # libdecnumber requires libc
-        else
-        " --with-headers=${libcCross}/include" +
-        " --enable-__cxa_atexit" +
-        " --enable-long-long" +
-        (if crossMingw then
-          " --enable-threads=win32" +
-          " --enable-sjlj-exceptions" +
-          " --enable-hash-synchronization" +
-          " --disable-libssp" +
+        "--target=${cross.config}" +
+        withArch +
+        withCpu +
+        withAbi +
+        withFpu +
+        (if crossMingw && crossStageStatic then
+          " --with-headers=${libcCross}/include" +
+          " --with-gcc" +
+          " --with-gnu-as" +
+          " --with-gnu-ld" +
+          " --with-gnu-ld" +
+          " --disable-shared" +
           " --disable-nls" +
-          " --with-dwarf2" +
-          # I think noone uses shared gcc libs in mingw, so we better do the same.
-          # In any case, mingw32 g++ linking is broken by default with shared libs,
-          # unless adding "-lsupc++" to any linking command. I don't know why.
+          " --disable-debug" +
+          " --enable-sjlj-exceptions" +
+          " --enable-threads=win32" +
+          " --disable-win32-registry"
+          else if crossStageStatic then
+          " --disable-libssp --disable-nls" +
+          " --without-headers" +
+          " --disable-threads " +
+          " --disable-libmudflap " +
+          " --disable-libgomp " +
+          " --disable-libquadmath" +
           " --disable-shared" +
-          (if cross.config == "x86_64-w64-mingw32" then
-            # To keep ABI compatibility with upstream mingw-w64
-            " --enable-fully-dynamic-string"
-            else "")
-          else (if cross.libc == "uclibc" then
-            # In uclibc cases, libgomp needs an additional '-ldl'
-            # and as I don't know how to pass it, I disable libgomp.
-            " --disable-libgomp" else "") +
-          " --enable-threads=posix" +
-          " --enable-nls" +
-          " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
-        );
+          " --disable-decimal-float" # libdecnumber requires libc
+          else
+          " --with-headers=${libcCross}/include" +
+          " --enable-__cxa_atexit" +
+          " --enable-long-long" +
+          (if crossMingw then
+            " --enable-threads=win32" +
+            " --enable-sjlj-exceptions" +
+            " --enable-hash-synchronization" +
+            " --disable-libssp" +
+            " --disable-nls" +
+            " --with-dwarf2" +
+            # I think noone uses shared gcc libs in mingw, so we better do the same.
+            # In any case, mingw32 g++ linking is broken by default with shared libs,
+            # unless adding "-lsupc++" to any linking command. I don't know why.
+            " --disable-shared" +
+            (if cross.config == "x86_64-w64-mingw32" then
+              # To keep ABI compatibility with upstream mingw-w64
+              " --enable-fully-dynamic-string"
+              else "")
+            else (if cross.libc == "uclibc" then
+              # In uclibc cases, libgomp needs an additional '-ldl'
+              # and as I don't know how to pass it, I disable libgomp.
+              " --disable-libgomp" else "") +
+            " --enable-threads=posix" +
+            " --enable-nls" +
+            " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
+          );
     stageNameAddon = if crossStageStatic then "-stage-static" else
       "-stage-final";
     crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
diff --git a/pkgs/development/compilers/gcc/4.7/default.nix b/pkgs/development/compilers/gcc/4.7/default.nix
index 10783972a248..3978dbaac112 100644
--- a/pkgs/development/compilers/gcc/4.7/default.nix
+++ b/pkgs/development/compilers/gcc/4.7/default.nix
@@ -85,77 +85,99 @@ let version = "4.7.2";
 
     javaAwtGtk = langJava && gtk != null;
 
+    /* Platform flags */
+    platformFlags = let
+        gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
+        gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
+        gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
+        gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
+        gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
+        gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv;
+        withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
+        withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
+        withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
+        withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
+        withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
+        withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
+      in 
+        (withArch +
+        withCpu +
+        withAbi +
+        withFpu +
+        withFloat +
+        withMode);
+
     /* Cross-gcc settings */
-    gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
-    gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
-    gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
-    gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
-    gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
-    gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
-    withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
-    withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
-    withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
-    withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
-    withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
-    withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
     crossMingw = (cross != null && cross.libc == "msvcrt");
-
-    crossConfigureFlags =
-      "--target=${cross.config}" +
-      withArch +
-      withCpu +
-      withAbi +
-      withFpu +
-      withFloat +
-      withMode +
-      (if crossMingw && crossStageStatic then
-        " --with-headers=${libcCross}/include" +
-        " --with-gcc" +
-        " --with-gnu-as" +
-        " --with-gnu-ld" +
-        " --with-gnu-ld" +
-        " --disable-shared" +
-        " --disable-nls" +
-        " --disable-debug" +
-        " --enable-sjlj-exceptions" +
-        " --enable-threads=win32" +
-        " --disable-win32-registry"
-        else if crossStageStatic then
-        " --disable-libssp --disable-nls" +
-        " --without-headers" +
-        " --disable-threads " +
-        " --disable-libmudflap " +
-        " --disable-libgomp " +
-        " --disable-libquadmath" +
-        " --disable-shared" +
-        " --disable-decimal-float" # libdecnumber requires libc
-        else
-        " --with-headers=${libcCross}/include" +
-        " --enable-__cxa_atexit" +
-        " --enable-long-long" +
-        (if crossMingw then
-          " --enable-threads=win32" +
-          " --enable-sjlj-exceptions" +
-          " --enable-hash-synchronization" +
-          " --disable-libssp" +
+    crossConfigureFlags = let
+        gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
+        gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
+        gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
+        gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
+        gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
+        gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
+        withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
+        withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
+        withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
+        withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
+        withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
+        withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
+      in
+        "--target=${cross.config}" +
+        withArch +
+        withCpu +
+        withAbi +
+        withFpu +
+        withFloat +
+        withMode +
+        (if crossMingw && crossStageStatic then
+          " --with-headers=${libcCross}/include" +
+          " --with-gcc" +
+          " --with-gnu-as" +
+          " --with-gnu-ld" +
+          " --with-gnu-ld" +
+          " --disable-shared" +
           " --disable-nls" +
-          " --with-dwarf2" +
-          # I think noone uses shared gcc libs in mingw, so we better do the same.
-          # In any case, mingw32 g++ linking is broken by default with shared libs,
-          # unless adding "-lsupc++" to any linking command. I don't know why.
+          " --disable-debug" +
+          " --enable-sjlj-exceptions" +
+          " --enable-threads=win32" +
+          " --disable-win32-registry"
+          else if crossStageStatic then
+          " --disable-libssp --disable-nls" +
+          " --without-headers" +
+          " --disable-threads " +
+          " --disable-libmudflap " +
+          " --disable-libgomp " +
+          " --disable-libquadmath" +
           " --disable-shared" +
-          (if cross.config == "x86_64-w64-mingw32" then
-            # To keep ABI compatibility with upstream mingw-w64
-            " --enable-fully-dynamic-string"
-            else "")
-          else (if cross.libc == "uclibc" then
-            # In uclibc cases, libgomp needs an additional '-ldl'
-            # and as I don't know how to pass it, I disable libgomp.
-            " --disable-libgomp" else "") +
-          " --enable-threads=posix" +
-          " --enable-nls" +
-          " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
-        );
+          " --disable-decimal-float" # libdecnumber requires libc
+          else
+          " --with-headers=${libcCross}/include" +
+          " --enable-__cxa_atexit" +
+          " --enable-long-long" +
+          (if crossMingw then
+            " --enable-threads=win32" +
+            " --enable-sjlj-exceptions" +
+            " --enable-hash-synchronization" +
+            " --disable-libssp" +
+            " --disable-nls" +
+            " --with-dwarf2" +
+            # I think noone uses shared gcc libs in mingw, so we better do the same.
+            # In any case, mingw32 g++ linking is broken by default with shared libs,
+            # unless adding "-lsupc++" to any linking command. I don't know why.
+            " --disable-shared" +
+            (if cross.config == "x86_64-w64-mingw32" then
+              # To keep ABI compatibility with upstream mingw-w64
+              " --enable-fully-dynamic-string"
+              else "")
+            else (if cross.libc == "uclibc" then
+              # In uclibc cases, libgomp needs an additional '-ldl'
+              # and as I don't know how to pass it, I disable libgomp.
+              " --disable-libgomp" else "") +
+            " --enable-threads=posix" +
+            " --enable-nls" +
+            " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
+          );
     stageNameAddon = if crossStageStatic then "-stage-static" else
       "-stage-final";
     crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
@@ -308,6 +330,7 @@ stdenv.mkDerivation ({
     ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
     ${if cross != null then crossConfigureFlags else ""}
     ${if !bootstrap then "--disable-bootstrap" else ""}
+    ${if cross == null then platformFlags else ""}
   ";
 
   targetConfig = if cross != null then cross.config else null;