Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
Need base branch for GCC PR
  • Loading branch information
Ericson2314 committed Dec 7, 2017
2 parents dc4200f + 43d5c5d commit a1e1e43
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 371 deletions.
11 changes: 2 additions & 9 deletions lib/systems/examples.nix
Expand Up @@ -18,7 +18,6 @@ rec {
libc = "glibc";
platform = platforms.sheevaplug;
openssl.system = "linux-generic32";
inherit (platform) gcc;
};

raspberryPi = rec {
Expand All @@ -31,7 +30,6 @@ rec {
libc = "glibc";
platform = platforms.raspberrypi;
openssl.system = "linux-generic32";
inherit (platform) gcc;
};

armv7l-hf-multiplatform = rec {
Expand All @@ -44,7 +42,6 @@ rec {
libc = "glibc";
platform = platforms.armv7l-hf-multiplatform;
openssl.system = "linux-generic32";
inherit (platform) gcc;
};

aarch64-multiplatform = rec {
Expand All @@ -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;
Expand All @@ -86,7 +80,6 @@ rec {
libc = "glibc";
platform = platforms.fuloong2f_n32;
openssl.system = "linux-generic32";
inherit (platform) gcc;
};

#
Expand Down
91 changes: 49 additions & 42 deletions pkgs/development/compilers/gcc/4.5/default.nix
Expand Up @@ -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" ] ++
Expand Down Expand Up @@ -288,7 +298,7 @@ stdenv.mkDerivation ({
# Ada
optional langAda "--enable-libada" ++

# Cross-compilation
platformFlags ++
optional (targetPlatform != hostPlatform) crossConfigureFlags ++

# Platform-specific flags
Expand All @@ -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
;
};


Expand Down
96 changes: 42 additions & 54 deletions pkgs/development/compilers/gcc/4.8/default.nix
Expand Up @@ -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
Expand Down Expand Up @@ -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}" ++
Expand All @@ -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" ] ++
Expand Down Expand Up @@ -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" ++

Expand All @@ -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 = "";
};

Expand Down

0 comments on commit a1e1e43

Please sign in to comment.