From 2fdca4db69c845771968a4976e19d05a52975ed8 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 29 Nov 2017 20:10:24 -0500 Subject: [PATCH 1/6] gcc: Lock down more tools for cross-builds That is, build != host == target --- .../development/compilers/gcc/4.5/default.nix | 33 +++++++++++++++++-- .../development/compilers/gcc/4.8/default.nix | 33 +++++++++++++++++-- .../development/compilers/gcc/4.9/default.nix | 33 +++++++++++++++++-- pkgs/development/compilers/gcc/5/default.nix | 33 +++++++++++++++++-- pkgs/development/compilers/gcc/6/default.nix | 33 +++++++++++++++++-- pkgs/development/compilers/gcc/7/default.nix | 33 +++++++++++++++++-- .../compilers/gcc/snapshot/default.nix | 33 +++++++++++++++++-- 7 files changed, 217 insertions(+), 14 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 67981ad1056..114fc4d8307 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -273,14 +273,43 @@ stdenv.mkDerivation ({ targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; crossAttrs = { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index de9d3165b55..1a1400a57a8 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -391,14 +391,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index c5bebdf3300..8842be6a49b 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -397,14 +397,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index b4a74300d36..38bc0dff4b4 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -412,14 +412,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 057acf9794e..1d77a9b4a00 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -394,14 +394,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 5d3126ea0e9..c411a546f59 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -395,14 +395,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, targetPlatform != hostPlatform NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index bb2c9d8a5c0..ecd0c73d347 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -395,14 +395,43 @@ stdenv.mkDerivation ({ xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; in { + AR_FOR_BUILD = "ar"; + AS_FOR_BUILD = "as"; + LD_FOR_BUILD = "ld"; + NM_FOR_BUILD = "nm"; + OBJCOPY_FOR_BUILD = "objcopy"; + OBJDUMP_FOR_BUILD = "objdump"; + RANLIB_FOR_BUILD = "ranlib"; + SIZE_FOR_BUILD = "size"; + STRINGS_FOR_BUILD = "strings"; + STRIP_FOR_BUILD = "strip"; + CC_FOR_BUILD = "gcc"; + CXX_FOR_BUILD = "g++"; + AR = "${targetPlatform.config}-ar"; + AS = "${targetPlatform.config}-as"; LD = "${targetPlatform.config}-ld"; + NM = "${targetPlatform.config}-nm"; + OBJCOPY = "${targetPlatform.config}-objcopy"; + OBJDUMP = "${targetPlatform.config}-objdump"; + RANLIB = "${targetPlatform.config}-ranlib"; + SIZE = "${targetPlatform.config}-size"; + STRINGS = "${targetPlatform.config}-strings"; + STRIP = "${targetPlatform.config}-strip"; CC = "${targetPlatform.config}-gcc"; - CXX = "${targetPlatform.config}-gcc"; + CXX = "${targetPlatform.config}-g++"; + AR_FOR_TARGET = "${targetPlatform.config}-ar"; + AS_FOR_TARGET = "${targetPlatform.config}-as"; LD_FOR_TARGET = "${targetPlatform.config}-ld"; - CC_FOR_TARGET = "${targetPlatform.config}-gcc"; NM_FOR_TARGET = "${targetPlatform.config}-nm"; + OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy"; + OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump"; + RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib"; + SIZE_FOR_TARGET = "${targetPlatform.config}-size"; + STRINGS_FOR_TARGET = "${targetPlatform.config}-strings"; + STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; + CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CXX_FOR_TARGET = "${targetPlatform.config}-g++"; # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; From cabfe1885f0c4cd9c51828ffef0a358e15d06b00 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 4 Dec 2017 14:34:49 -0500 Subject: [PATCH 2/6] gcc: Don't try to enable plugins with host != build --- pkgs/development/compilers/gcc/4.8/default.nix | 2 +- pkgs/development/compilers/gcc/4.9/default.nix | 2 +- pkgs/development/compilers/gcc/5/default.nix | 2 +- pkgs/development/compilers/gcc/6/default.nix | 2 +- pkgs/development/compilers/gcc/7/default.nix | 2 +- pkgs/development/compilers/gcc/snapshot/default.nix | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 1a1400a57a8..9c018ac6467 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 8842be6a49b..c740975f570 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 38bc0dff4b4..8eac7d16e40 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 1d77a9b4a00..66a01ede23b 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index c411a546f59..6d3cda4401b 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index ecd0c73d347..848e6215dac 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -23,7 +23,7 @@ , x11Support ? langJava , gnatboot ? null , enableMultilib ? false -, enablePlugin ? true # whether to support user-supplied plug-ins +, enablePlugin ? hostPlatform == buildPlatform # Whether to support user-supplied plug-ins , name ? "gcc" , libcCross ? null , crossStageStatic ? true From 74cbb5796eef0469cc704bdcf6d271cc614bfd19 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 4 Dec 2017 12:54:27 -0500 Subject: [PATCH 3/6] gcc: Get rid of crossAttrs.configureFlags --- .../development/compilers/gcc/4.5/default.nix | 57 ++++++++--------- .../development/compilers/gcc/4.8/default.nix | 62 +++---------------- .../development/compilers/gcc/4.9/default.nix | 62 +++---------------- pkgs/development/compilers/gcc/5/default.nix | 61 +++--------------- pkgs/development/compilers/gcc/6/default.nix | 61 +++--------------- pkgs/development/compilers/gcc/7/default.nix | 61 +++--------------- .../compilers/gcc/snapshot/default.nix | 61 +++--------------- 7 files changed, 86 insertions(+), 339 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 114fc4d8307..c860991b8cf 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -63,6 +63,28 @@ let version = "4.5.4"; javaAwtGtk = langJava && gtk2 != null; + /* Platform flags */ + platformFlags = let + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; + 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 targetPlatform; gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null targetPlatformt; @@ -268,7 +290,10 @@ stdenv.mkDerivation ({ ${if langAda then " --enable-libada" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} - "; + ${if targetPlatform == hostPlatform then platformFlags else ""} + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -314,36 +339,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""} - ${if cloogppl != null then "--with-cloog=${cloogppl.crossDrv}" else ""} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ) - ) - } - ${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 9c018ac6467..aa2160f6db2 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -98,12 +98,12 @@ let version = "4.8.5"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -366,7 +366,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -379,18 +381,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -432,39 +423,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index c740975f570..d6e09ca8dac 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -100,12 +100,12 @@ let version = "4.9.4"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -372,7 +372,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -385,18 +387,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -438,39 +429,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 8eac7d16e40..f6a6a32ab9a 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -104,12 +104,12 @@ let version = "5.4.0"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -387,7 +387,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -400,18 +402,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -453,38 +444,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 66a01ede23b..474c8b66de6 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -100,12 +100,12 @@ let version = "6.3.0"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -369,7 +369,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -382,18 +384,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -435,38 +426,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 6d3cda4401b..3955c2c453e 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -100,12 +100,12 @@ let version = "7.1.0"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -370,7 +370,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -383,18 +385,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -436,38 +427,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, targetPlatform != hostPlatform NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 848e6215dac..6cb64d2b9ee 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -100,12 +100,12 @@ let version = "7-20170409"; /* Platform flags */ platformFlags = let - gccArch = stdenv.platform.gcc.arch or null; - gccCpu = stdenv.platform.gcc.cpu or null; - gccAbi = stdenv.platform.gcc.abi or null; - gccFpu = stdenv.platform.gcc.fpu or null; - gccFloat = stdenv.platform.gcc.float or null; - gccMode = stdenv.platform.gcc.mode or null; + gccArch = targetPlatform.gcc.arch or null; + gccCpu = targetPlatform.gcc.cpu or null; + gccAbi = targetPlatform.gcc.abi or null; + gccFpu = targetPlatform.gcc.fpu or null; + gccFloat = targetPlatform.gcc.float or null; + gccMode = targetPlatform.gcc.mode or null; 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 ""; @@ -370,7 +370,9 @@ stdenv.mkDerivation ({ ${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if !bootstrap then "--disable-bootstrap" else ""} ${if targetPlatform == hostPlatform then platformFlags else ""} - "; + " + optionalString + (hostPlatform != buildPlatform) + (platformFlags + " --target=${targetPlatform.config}"); targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; @@ -383,18 +385,7 @@ stdenv.mkDerivation ({ then "install-strip" else "install"; - crossAttrs = let - xgccArch = targetPlatform.gcc.arch or null; - xgccCpu = targetPlatform.gcc.cpu or null; - xgccAbi = targetPlatform.gcc.abi or null; - xgccFpu = targetPlatform.gcc.fpu or null; - xgccFloat = targetPlatform.gcc.float or null; - xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; - xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; - xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; - xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; - xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; - in { + crossAttrs = { AR_FOR_BUILD = "ar"; AS_FOR_BUILD = "as"; LD_FOR_BUILD = "ld"; @@ -436,38 +427,6 @@ stdenv.mkDerivation ({ # If we are making a cross compiler, cross != null NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else ""; dontStrip = true; - configureFlags = '' - ${if enableMultilib then "" else "--disable-multilib"} - ${if enableShared then "" else "--disable-shared"} - ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} - ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} - ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} - --with-gmp=${gmp.crossDrv} - --with-mpfr=${mpfr.crossDrv} - --with-mpc=${libmpc.crossDrv} - --disable-libstdcxx-pch - --without-included-gettext - --with-system-zlib - --enable-languages=${ - concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langFortran "fortran" - ++ optional langJava "java" - ++ optional langAda "ada" - ++ optional langVhdl "vhdl" - ++ optional langGo "go" - ) - ) - } - ${if langAda then " --enable-libada" else ""} - --target=${targetPlatform.config} - ${xwithArch} - ${xwithCpu} - ${xwithAbi} - ${xwithFpu} - ${xwithFloat} - ''; buildFlags = ""; }; From 1fe9798ac23e9be70553ba20a37fc32aa4f98f7f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 5 Dec 2017 13:45:43 -0500 Subject: [PATCH 4/6] lib, gcc: No `inherit (platform) gcc;` in {host,build,target}Platform --- lib/systems/examples.nix | 9 +------ .../development/compilers/gcc/4.5/default.nix | 12 +++++----- .../development/compilers/gcc/4.8/default.nix | 24 +++++++++---------- .../development/compilers/gcc/4.9/default.nix | 24 +++++++++---------- pkgs/development/compilers/gcc/5/default.nix | 24 +++++++++---------- pkgs/development/compilers/gcc/6/default.nix | 24 +++++++++---------- pkgs/development/compilers/gcc/7/default.nix | 24 +++++++++---------- .../compilers/gcc/snapshot/default.nix | 24 +++++++++---------- 8 files changed, 79 insertions(+), 86 deletions(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index e394f43831c..28eb29c977a 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -18,7 +18,6 @@ rec { libc = "glibc"; platform = platforms.sheevaplug; openssl.system = "linux-generic32"; - inherit (platform) gcc; }; raspberryPi = rec { @@ -31,7 +30,6 @@ rec { libc = "glibc"; platform = platforms.raspberrypi; openssl.system = "linux-generic32"; - inherit (platform) gcc; }; armv7l-hf-multiplatform = rec { @@ -44,7 +42,6 @@ rec { libc = "glibc"; platform = platforms.armv7l-hf-multiplatform; openssl.system = "linux-generic32"; - inherit (platform) gcc; }; aarch64-multiplatform = rec { @@ -54,13 +51,11 @@ rec { withTLS = true; libc = "glibc"; platform = platforms.aarch64-multiplatform; - inherit (platform) gcc; }; scaleway-c1 = armv7l-hf-multiplatform // rec { platform = platforms.scaleway-c1; - inherit (platform) gcc; - inherit (gcc) fpu; + inherit (platform.gcc) fpu; }; pogoplug4 = rec { @@ -70,7 +65,6 @@ rec { platform = platforms.pogoplug4; - inherit (platform) gcc; libc = "glibc"; withTLS = true; @@ -86,7 +80,6 @@ rec { libc = "glibc"; platform = platforms.fuloong2f_n32; openssl.system = "linux-generic32"; - inherit (platform) gcc; }; # diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index c860991b8cf..ad605fdf268 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -65,12 +65,12 @@ let version = "4.5.4"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index aa2160f6db2..15f8c1858f2 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -98,12 +98,12 @@ let version = "4.8.5"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -122,12 +122,12 @@ let version = "4.8.5"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index d6e09ca8dac..b46510fe3d9 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -100,12 +100,12 @@ let version = "4.9.4"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -124,12 +124,12 @@ let version = "4.9.4"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index f6a6a32ab9a..e78e0b251cb 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -104,12 +104,12 @@ let version = "5.4.0"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -128,12 +128,12 @@ let version = "5.4.0"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 474c8b66de6..947017343e2 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -100,12 +100,12 @@ let version = "6.3.0"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -124,12 +124,12 @@ let version = "6.3.0"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 3955c2c453e..7d2c0771695 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -100,12 +100,12 @@ let version = "7.1.0"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -124,12 +124,12 @@ let version = "7.1.0"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 6cb64d2b9ee..c2ac3248661 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -100,12 +100,12 @@ let version = "7-20170409"; /* Platform flags */ platformFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; @@ -124,12 +124,12 @@ let version = "7-20170409"; crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; crossConfigureFlags = let - gccArch = targetPlatform.gcc.arch or null; - gccCpu = targetPlatform.gcc.cpu or null; - gccAbi = targetPlatform.gcc.abi or null; - gccFpu = targetPlatform.gcc.fpu or null; - gccFloat = targetPlatform.gcc.float or null; - gccMode = targetPlatform.gcc.mode or null; + gccArch = targetPlatform.platform.gcc.arch or null; + gccCpu = targetPlatform.platform.gcc.cpu or null; + gccAbi = targetPlatform.platform.gcc.abi or null; + gccFpu = targetPlatform.platform.gcc.fpu or null; + gccFloat = targetPlatform.platform.gcc.float or null; + gccMode = targetPlatform.platform.gcc.mode or null; 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 ""; From a3e35fbbe1fe9a3d117de69fb50f000ef5f4b312 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 5 Dec 2017 14:01:18 -0500 Subject: [PATCH 5/6] gcc: Use platformFlags in crossConfigureFlags A nice code deduplication --- .../development/compilers/gcc/4.5/default.nix | 13 +---------- .../development/compilers/gcc/4.8/default.nix | 22 ++----------------- .../development/compilers/gcc/4.9/default.nix | 22 ++----------------- pkgs/development/compilers/gcc/5/default.nix | 22 ++----------------- pkgs/development/compilers/gcc/6/default.nix | 22 ++----------------- pkgs/development/compilers/gcc/7/default.nix | 22 ++----------------- .../compilers/gcc/snapshot/default.nix | 22 ++----------------- 7 files changed, 13 insertions(+), 132 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index ad605fdf268..5e19798c0fa 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -85,20 +85,9 @@ let version = "4.5.4"; withFloat + withMode; - /* Cross-gcc settings */ - gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null targetPlatform; - gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null targetPlatformt; - gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null targetPlatform; - 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 ""; - crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"); - crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 15f8c1858f2..69348d50d0a 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -121,27 +121,9 @@ let version = "4.8.5"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index b46510fe3d9..5b5bd44322e 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -123,27 +123,9 @@ let version = "4.9.4"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index e78e0b251cb..c9605416f4e 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -127,27 +127,9 @@ let version = "5.4.0"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 947017343e2..fe308b77167 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -123,27 +123,9 @@ let version = "6.3.0"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 7d2c0771695..3ca6e470c2f 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -123,27 +123,9 @@ let version = "7.1.0"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index c2ac3248661..ec7e234607e 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -123,27 +123,9 @@ let version = "7-20170409"; /* Cross-gcc settings */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; - crossConfigureFlags = let - gccArch = targetPlatform.platform.gcc.arch or null; - gccCpu = targetPlatform.platform.gcc.cpu or null; - gccAbi = targetPlatform.platform.gcc.abi or null; - gccFpu = targetPlatform.platform.gcc.fpu or null; - gccFloat = targetPlatform.platform.gcc.float or null; - gccMode = targetPlatform.platform.gcc.mode or null; - 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 + crossConfigureFlags = "--target=${targetPlatform.config}" + - withArch + - withCpu + - withAbi + - withFpu + - withFloat + - withMode + + platformFlags + # Ensure that -print-prog-name is able to find the correct programs. " --with-as=${binutils}/bin/${targetPlatform.config}-as" + " --with-ld=${binutils}/bin/${targetPlatform.config}-ld" + From c8d435476d85ddcab66d3f487332a2073f2d27e5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 5 Dec 2017 14:17:00 -0500 Subject: [PATCH 6/6] lib: Unbreak pogoplug example platform Vendor needed to be made valid --- lib/systems/examples.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 28eb29c977a..8c567e683cb 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -60,7 +60,7 @@ rec { pogoplug4 = rec { arch = "armv5tel"; - config = "armv5tel-softfloat-linux-gnueabi"; + config = "armv5tel-unknown-linux-gnueabi"; float = "soft"; platform = platforms.pogoplug4;