Merge pull request #32361 from obsidiansystems/gcc-simplify-flags

gcc: Simplify configure flags
This commit is contained in:
John Ericson 2017-12-07 00:59:49 -05:00 committed by GitHub
commit cc20d402d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 298 additions and 371 deletions

View file

@ -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,23 +51,20 @@ 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 {
arch = "armv5tel";
config = "armv5tel-softfloat-linux-gnueabi";
config = "armv5tel-unknown-linux-gnueabi";
float = "soft";
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;
};
#

View file

@ -63,16 +63,26 @@ let version = "4.5.4";
javaAwtGtk = langJava && gtk2 != null;
/* Platform flags */
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
optional (gccAbi != null) "--with-abi=${gccAbi}" ++
optional (gccFpu != null) "--with-fpu=${gccFpu}" ++
optional (gccFloat != null) "--with-float=${gccFloat}" ++
optional (gccMode != null) "--with-mode=${gccMode}";
/* Cross-gcc settings */
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null targetPlatform;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null targetPlatform;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null targetPlatform;
crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt");
crossConfigureFlags =
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
optional (gccAbi != null) "--with-abi=${gccAbi}" ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -288,7 +298,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
# Cross-compilation
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
# Platform-specific flags
@ -299,52 +309,49 @@ stdenv.mkDerivation ({
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
/* For cross-built gcc (build != host == target) */
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 = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
optional (ppl != null) "--with-ppl=${ppl.crossDrv}" ++
optional (cloogppl != null) "--with-cloog=${cloogppl.crossDrv}" ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (targetPlatform == hostPlatform && targetPlatform.isi686) "--with-arch=i686" ++
optional (targetPlatform != hostPlatform) crossConfigureFlags
;
};

View file

@ -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 ? false
@ -108,13 +108,13 @@ let version = "4.8.5";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -127,8 +127,6 @@ let version = "4.8.5";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -382,7 +380,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -406,59 +404,49 @@ 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;
in {
/* For cross-built gcc (build != host == target) */
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
optionals (cloog != null) ["--with-cloog=${cloog.crossDrv}" "--enable-cloog-backend=isl"] ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};

View file

@ -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 ? false
@ -99,13 +99,13 @@ let version = "4.9.4";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -118,8 +118,6 @@ let version = "4.9.4";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -380,7 +378,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -405,59 +403,48 @@ stdenv.mkDerivation ({
else "install";
/* For cross-built gcc (build != host == target) */
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;
in {
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
optionals (cloog != null) ["--with-cloog=${cloog.crossDrv}" "--enable-cloog-backend=isl"] ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};

View file

@ -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 ? false
@ -103,13 +103,13 @@ let version = "5.5.0";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -122,8 +122,6 @@ let version = "5.5.0";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -390,7 +388,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -415,58 +413,48 @@ stdenv.mkDerivation ({
else "install";
/* For cross-built gcc (build != host == target) */
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;
in {
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};

View file

@ -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 ? false
@ -100,13 +100,13 @@ let version = "6.4.0";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -119,8 +119,6 @@ let version = "6.4.0";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -391,7 +389,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -415,58 +413,48 @@ stdenv.mkDerivation ({
else "install";
/* For cross-built gcc (build != host == target) */
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;
in {
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};

View file

@ -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 ? false
@ -98,13 +98,13 @@ let version = "7.2.0";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -117,8 +117,6 @@ let version = "7.2.0";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -384,7 +382,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -409,58 +407,48 @@ stdenv.mkDerivation ({
else "install";
/* For cross-built gcc (build != host == target) */
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;
in {
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};

View file

@ -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 ? false
@ -98,13 +98,13 @@ let version = "7-20170409";
javaAwtGtk = langJava && x11Support;
/* Platform flags */
mkPlatformFlags = platform: let
gccArch = platform.gcc.arch or null;
gccCpu = platform.gcc.cpu or null;
gccAbi = platform.gcc.abi or null;
gccFpu = platform.gcc.fpu or null;
gccFloat = platform.gcc.float or null;
gccMode = platform.gcc.mode or null;
platformFlags = 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;
in
optional (gccArch != null) "--with-arch=${gccArch}" ++
optional (gccCpu != null) "--with-cpu=${gccCpu}" ++
@ -117,8 +117,6 @@ let version = "7-20170409";
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
crossConfigureFlags =
mkPlatformFlags targetPlatform ++
# Ensure that -print-prog-name is able to find the correct programs.
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
@ -371,7 +369,7 @@ stdenv.mkDerivation ({
in "--with-native-system-header-dir=${incDir}"
) ++
optional (targetPlatform == hostPlatform) (mkPlatformFlags stdenv.platform) ++
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++
@ -396,58 +394,48 @@ stdenv.mkDerivation ({
else "install";
/* For cross-built gcc (build != host == target) */
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;
in {
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, targetPlatform != hostPlatform
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
configureFlags =
optional (!enableMultilib) "--disable-multilib" ++
optional (!enableShared) "--disable-shared" ++
optional langJava "--with-ecj-jar=${javaEcj.crossDrv}" ++
optional javaAwtGtk "--enable-java-awt=gtk" ++
optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr.crossDrv}" ++
[
"--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"
)
)
}"
] ++
optional langAda "--enable-libada" ++
optional (xgccArch != null) "--with-arch=${xgccArch}" ++
optional (xgccCpu != null) "--with-cpu=${xgccCpu}" ++
optional (xgccAbi != null) "--with-abi=${xgccAbi}" ++
optional (xgccFpu != null) "--with-fpu=${xgccFpu}" ++
optional (xgccFloat != null) "--with-float=${xgccFloat}"
;
buildFlags = "";
};