From 71186e73455a4e06e96a31da34b76f84e545ba1f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 18 Aug 2017 13:54:09 -0400 Subject: [PATCH 1/2] gcc: Use `configurePlatforms` to control --build, --host, and --target --- pkgs/development/compilers/gcc/4.5/default.nix | 4 ++-- pkgs/development/compilers/gcc/4.8/default.nix | 4 ++-- pkgs/development/compilers/gcc/4.9/default.nix | 4 ++-- pkgs/development/compilers/gcc/5/default.nix | 6 ++---- pkgs/development/compilers/gcc/6/default.nix | 4 ++-- pkgs/development/compilers/gcc/7/default.nix | 4 ++-- pkgs/development/compilers/gcc/snapshot/default.nix | 4 ++-- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 971726b8ab90..fe0ed930a690 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -73,7 +73,6 @@ let version = "4.5.4"; crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"); crossConfigureFlags = - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -231,6 +230,8 @@ stdenv.mkDerivation ({ ++ (optionals langVhdl [gnat]) ; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if enableMultilib then "" else "--disable-multilib"} ${if enableShared then "" else "--disable-shared"} @@ -313,7 +314,6 @@ stdenv.mkDerivation ({ ${if langAda then " --enable-libada" else ""} ${if targetplatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} - --target=${targetPlatform.config} ''; }; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 7a41ba38e519..877b71e0169d 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -142,7 +142,6 @@ let version = "4.8.5"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -317,6 +316,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -436,7 +437,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index e45ee0bcc6a7..02c8b4495674 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -136,7 +136,6 @@ let version = "4.9.4"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -317,6 +316,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -434,7 +435,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 57b68d1a11f1..3c613d40dff0 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -142,7 +142,6 @@ let version = "5.4.0"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -334,6 +333,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -451,9 +452,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --build=${buildPlatform.config} - --host=${hostPlatform.config} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index fa42bb5b8512..87c5b11c5e12 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -136,7 +136,6 @@ let version = "6.4.0"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -326,6 +325,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -443,7 +444,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 67b7dee446fb..e1206c638f55 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -137,7 +137,6 @@ let version = "7.1.0"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -328,6 +327,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -445,7 +446,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 518ee5c7054b..210b51dbca08 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -137,7 +137,6 @@ let version = "7-20170409"; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; in - "--target=${targetPlatform.config}" + withArch + withCpu + withAbi + @@ -315,6 +314,8 @@ stdenv.mkDerivation ({ dontDisableStatic = true; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + @@ -432,7 +433,6 @@ stdenv.mkDerivation ({ ) } ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} ${xwithArch} ${xwithCpu} ${xwithAbi} From ebc9b161cd184502bf4912b9348a507e2d0540da Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 23 Aug 2017 14:34:33 -0400 Subject: [PATCH 2/2] gcc: Add `configurePlatforms` exception for Arm 32 ...just as we did for binutils. When the underlying issue is resolved (probably with a configure script patch or lib/systems/parse.nix change), this should be reverted. --- pkgs/development/compilers/gcc/4.5/default.nix | 7 ++++++- pkgs/development/compilers/gcc/4.8/default.nix | 7 ++++++- pkgs/development/compilers/gcc/4.9/default.nix | 7 ++++++- pkgs/development/compilers/gcc/5/default.nix | 7 ++++++- pkgs/development/compilers/gcc/6/default.nix | 7 ++++++- pkgs/development/compilers/gcc/7/default.nix | 7 ++++++- pkgs/development/compilers/gcc/snapshot/default.nix | 7 ++++++- 7 files changed, 42 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index fe0ed930a690..4c52f4447d54 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -231,7 +231,12 @@ stdenv.mkDerivation ({ ; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if enableMultilib then "" else "--disable-multilib"} ${if enableShared then "" else "--disable-shared"} diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 877b71e0169d..76fa0b663752 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -317,7 +317,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 02c8b4495674..05bdcecb6a55 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -317,7 +317,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 3c613d40dff0..90b10f2acbd3 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -334,7 +334,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 87c5b11c5e12..bc408e28f589 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -326,7 +326,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index e1206c638f55..78b499f096da 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -328,7 +328,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 210b51dbca08..c7f7b9d970a2 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -315,7 +315,12 @@ stdenv.mkDerivation ({ dontDisableStatic = true; # TODO(@Ericson2314): Always pass "--target" and always prefix. - configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configurePlatforms = + # TODO(@Ericson2314): Figure out what's going wrong with Arm + if hostPlatform == targetPlatform && targetPlatform.isArm32 + then [] + else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + configureFlags = " ${if hostPlatform.isSunOS then " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +