From a3e35fbbe1fe9a3d117de69fb50f000ef5f4b312 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 5 Dec 2017 14:01:18 -0500 Subject: gcc: Use platformFlags in crossConfigureFlags A nice code deduplication --- pkgs/development/compilers/gcc/4.5/default.nix | 13 +------------ pkgs/development/compilers/gcc/4.8/default.nix | 22 ++-------------------- pkgs/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 ++-------------------- .../development/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 ad605fdf268d..5e19798c0fa9 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 15f8c1858f28..69348d50d0ac 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 b46510fe3d92..5b5bd44322ef 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 e78e0b251cbe..c9605416f4e2 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 947017343e2f..fe308b771678 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 7d2c07716953..3ca6e470c2fd 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 c2ac32486614..ec7e234607e9 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" + -- cgit 1.4.1