diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 80e320406bf4fc..32c24bab7c9893 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -11,21 +11,16 @@ rec { sheevaplug = rec { config = "armv5tel-unknown-linux-gnueabi"; - float = "soft"; platform = platforms.sheevaplug; }; raspberryPi = rec { config = "armv6l-unknown-linux-gnueabihf"; - float = "hard"; - fpu = "vfp"; platform = platforms.raspberrypi; }; armv7l-hf-multiplatform = rec { config = "armv7a-unknown-linux-gnueabihf"; - float = "hard"; - fpu = "vfpv3-d16"; platform = platforms.armv7l-hf-multiplatform; }; @@ -47,26 +42,24 @@ rec { pogoplug4 = rec { config = "armv5tel-unknown-linux-gnueabi"; - float = "soft"; platform = platforms.pogoplug4; }; ben-nanonote = rec { config = "mipsel-unknown-linux-uclibc"; - float = "soft"; platform = { name = "ben_nanonote"; kernelMajor = "2.6"; kernelArch = "mips"; gcc = { arch = "mips32"; + float = "soft"; }; }; }; fuloongminipc = rec { config = "mipsel-unknown-linux-gnu"; - float = "hard"; platform = platforms.fuloong2f_n32; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 7ba06f129db8ad..3667766aa9f78f 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -182,20 +182,24 @@ rec { types.abi = enum (attrValues abis); abis = setTypes types.openAbi { - android = {}; - cygnus = {}; - gnu = {}; - msvc = {}; - eabi = {}; - androideabi = {}; - gnueabi = {}; - gnueabihf = {}; - musleabi = {}; - musleabihf = {}; - musl = {}; - uclibceabihf = {}; - uclibceabi = {}; - uclibc = {}; + cygnus = {}; + msvc = {}; + eabi = {}; + + androideabi = {}; + android = {}; + + gnueabi = { float = "soft"; }; + gnueabihf = { float = "hard"; }; + gnu = {}; + + musleabi = { float = "soft"; }; + musleabihf = { float = "hard"; }; + musl = {}; + + uclibceabihf = { float = "soft"; }; + uclibceabi = { float = "hard"; }; + uclibc = {}; unknown = {}; }; diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index f39e890fbf1c96..d6587ac49a89dc 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -25,7 +25,6 @@ rec { gcc = { arch = "armv5te"; - float = "soft"; }; kernelMajor = "2.6"; @@ -158,7 +157,6 @@ rec { kernelDTB = true; # Beyond 3.10 gcc = { arch = "armv5te"; - float = "soft"; }; }; @@ -336,7 +334,6 @@ rec { gcc = { cpu = "cortex-a9"; fpu = "vfpv3"; - float = "hard"; }; }; @@ -363,7 +360,6 @@ rec { gcc = { cpu = "cortex-a9"; fpu = "neon"; - float = "hard"; }; }; @@ -449,6 +445,7 @@ rec { kernelTarget = "vmlinux"; gcc = { arch = "loongson2f"; + float = "hard"; abi = "n32"; }; }; @@ -498,7 +495,6 @@ rec { # and the above page suggests NEON is only an improvement with hand-written assembly. arch = "armv7-a"; fpu = "vfpv3-d16"; - float = "hard"; # For Raspberry Pi the 2 the best would be: # cpu = "cortex-a7"; diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 5042b13e267e73..28521753cab9ca 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -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 diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index c798a67de840fb..dea8b912b272ee 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -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" ++ diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index ed9b89e4919abe..b326530c66ea02 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -113,22 +113,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"; @@ -394,7 +378,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" ++ diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index f2a091e34dc9b2..0d9565de0a7776 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -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" ++ diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 3de5b4dd270289..29f2bad7eac11c 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -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" ++ diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 888e455488ca62..e75e22efce1f55 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -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" ++ diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix new file mode 100644 index 00000000000000..e261f54f582ddf --- /dev/null +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -0,0 +1,13 @@ +{ lib, targetPlatform }: + +let + p = targetPlatform.platform.gcc or {}; + float = p.float or (targetPlatform.parsed.abi.float or null); +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 (float != null) "--with-float=${float}") + (lib.optional (p ? mode) "--with-mode=${p.mode}") +] diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 3c98b7a58f7640..609d418693d7b5 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -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" ++ diff --git a/pkgs/development/libraries/glibc/common-2.27.nix b/pkgs/development/libraries/glibc/common-2.27.nix index 272e18905c1385..7d2cf7d14b7847 100644 --- a/pkgs/development/libraries/glibc/common-2.27.nix +++ b/pkgs/development/libraries/glibc/common-2.27.nix @@ -23,7 +23,6 @@ let version = "2.27"; patchSuffix = ""; sha256 = "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji"; - cross = if buildPlatform != hostPlatform then hostPlatform else null; in assert withLinuxHeaders -> linuxHeaders != null; @@ -33,9 +32,6 @@ stdenv.mkDerivation ({ inherit installLocales; linuxHeaders = if withLinuxHeaders then linuxHeaders else null; - # The host/target system. - crossConfig = if cross != null then cross.config else null; - inherit (stdenv) is64bit; enableParallelBuilding = true; @@ -106,11 +102,12 @@ stdenv.mkDerivation ({ else "--disable-profile") ] ++ lib.optionals withLinuxHeaders [ "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 - ] ++ lib.optionals (cross != null) [ - (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp") - ] ++ lib.optionals (cross != null) [ + ] ++ lib.optionals (hostPlatform != buildPlatform) [ + (if hostPlatform.platform.gcc.float or (hostPlatform.parsed.abi.float or "hard") == "soft" + then "--without-fp" + else "--with-fp") "--with-__thread" - ] ++ lib.optionals (cross == null && stdenv.isAarch32) [ + ] ++ lib.optionals (hostPlatform == buildPlatform && hostPlatform.isAarch32) [ "--host=arm-linux-gnueabi" "--build=arm-linux-gnueabi" @@ -162,7 +159,7 @@ stdenv.mkDerivation ({ } - '' + lib.optionalString (cross != null) '' + '' + lib.optionalString (hostPlatform != buildPlatform) '' sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig" cat > config.cache << "EOF" @@ -196,7 +193,7 @@ stdenv.mkDerivation ({ passthru = { inherit version; }; } -// lib.optionalAttrs (cross != null) { +// lib.optionalAttrs (hostPlatform != buildPlatform) { preInstall = null; # clobber the native hook dontStrip = true; diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 9ee61666d856ec..f229fdbe1545ae 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -38,7 +38,6 @@ let version = "2.26"; patchSuffix = "-131"; sha256 = "1ggnj1hzjym7sn93rbwydcqd562q73lsb7g7kd199g6j9j9hlkp5"; - cross = if buildPlatform != hostPlatform then hostPlatform else null; in assert withLinuxHeaders -> linuxHeaders != null; @@ -48,9 +47,6 @@ stdenv.mkDerivation ({ inherit installLocales; linuxHeaders = if withLinuxHeaders then linuxHeaders else null; - # The host/target system. - crossConfig = if cross != null then cross.config else null; - inherit (stdenv) is64bit; enableParallelBuilding = true; @@ -142,11 +138,12 @@ stdenv.mkDerivation ({ else "--disable-profile") ] ++ lib.optionals withLinuxHeaders [ "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 - ] ++ lib.optionals (cross != null) [ - (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp") - ] ++ lib.optionals (cross != null) [ + ] ++ lib.optionals (hostPlatform != buildPlatform) [ + (if hostPlatform.platform.gcc.float or (hostPlatform.parsed.abi.float or "hard") == "soft" + then "--without-fp" + else "--with-fp") "--with-__thread" - ] ++ lib.optionals (cross == null && stdenv.isAarch32) [ + ] ++ lib.optionals (hostPlatform == buildPlatform && hostPlatform.isAarch32) [ "--host=arm-linux-gnueabi" "--build=arm-linux-gnueabi" @@ -197,7 +194,7 @@ stdenv.mkDerivation ({ } - '' + lib.optionalString (cross != null) '' + '' + lib.optionalString (hostPlatform != buildPlatform) '' sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig" cat > config.cache << "EOF" @@ -229,7 +226,7 @@ stdenv.mkDerivation ({ } // meta; } -// lib.optionalAttrs (cross != null) { +// lib.optionalAttrs (hostPlatform != buildPlatform) { preInstall = null; # clobber the native hook dontStrip = true;