gcc: Factor out "platform flags"

This commit is contained in:
John Ericson 2018-05-10 17:13:52 -04:00
parent a02be2bd85
commit c9f6a82b61
8 changed files with 19 additions and 119 deletions

View file

@ -64,22 +64,6 @@ 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 */
crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt");
@ -312,7 +296,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
# Platform-specific flags

View file

@ -108,22 +108,6 @@ let version = "4.8.5";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -372,7 +356,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++

View file

@ -99,22 +99,6 @@ let version = "4.9.4";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -380,7 +364,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++

View file

@ -103,22 +103,6 @@ let version = "5.5.0";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -396,7 +380,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++

View file

@ -97,22 +97,6 @@ let version = "6.4.0";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -400,7 +384,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++

View file

@ -98,22 +98,6 @@ let version = "7.3.0";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -396,7 +380,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++

View file

@ -0,0 +1,12 @@
{ lib, targetPlatform }:
let
p = targetPlatform.platform.gcc or {};
in lib.concatLists [
(lib.optional (p ? arch) "--with-arch=${p.arch}")
(lib.optional (p ? cpu) "--with-cpu=${p.cpu}")
(lib.optional (p ? abi) "--with-abi=${p.abi}")
(lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
(lib.optional (p ? float) "--with-float=${p.float}")
(lib.optional (p ? mode) "--with-mode=${p.mode}")
]

View file

@ -95,22 +95,6 @@ let version = "7-20170409";
javaAwtGtk = langJava && x11Support;
/* 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 (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
@ -368,7 +352,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++
platformFlags ++
(import ../common/platform-flags.nix { inherit (stdenv) lib targetPlatform; }) ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
optional (!bootstrap) "--disable-bootstrap" ++