gcc*: Remove cross argument and instead use hostPlatform and targetPlatform
This commit is contained in:
parent
200ac02d0f
commit
e854685d65
|
@ -19,7 +19,6 @@
|
|||
, gnatboot ? null
|
||||
, enableMultilib ? false
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -65,22 +64,22 @@ let version = "4.5.4";
|
|||
javaAwtGtk = langJava && gtk2 != null;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
|
||||
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
|
||||
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
|
||||
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 = (cross != null && cross.libc == "msvcrt");
|
||||
crossMingw = (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt");
|
||||
|
||||
crossConfigureFlags =
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -120,7 +119,7 @@ let version = "4.5.4";
|
|||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else
|
||||
"-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
in
|
||||
|
||||
|
@ -148,7 +147,7 @@ stdenv.mkDerivation ({
|
|||
|
||||
patches =
|
||||
[ ]
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ./no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -161,7 +160,7 @@ stdenv.mkDerivation ({
|
|||
|| (libcCross != null # e.g., building `gcc.crossDrv'
|
||||
&& libcCross ? crossConfig
|
||||
&& libcCross.crossConfig == "i586-pc-gnu")
|
||||
|| (cross != null && cross.config == "i586-pc-gnu"
|
||||
|| (targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu"
|
||||
&& libcCross != null))
|
||||
then
|
||||
# On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
|
||||
|
@ -197,7 +196,7 @@ stdenv.mkDerivation ({
|
|||
sed -i gcc/config/t-gnu \
|
||||
-es'|NATIVE_SYSTEM_HEADER_DIR.*$|NATIVE_SYSTEM_HEADER_DIR = ${libc.dev}/include|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -227,7 +226,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional langJava boehmgc)
|
||||
++ (optionals langJava [zip unzip])
|
||||
++ (optionals javaAwtGtk ([gtk2 pkgconfig libart_lgpl] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
;
|
||||
|
@ -265,13 +264,13 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
}
|
||||
${ # Trick that should be taken out once we have a mips64el-linux not loongson2f
|
||||
if cross == null && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""}
|
||||
if targetPlatform == hostPlatform && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
crossAttrs = {
|
||||
AR = "${targetPlatform.config}-ar";
|
||||
|
@ -284,7 +283,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -312,8 +311,8 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
--target=${targetPlatform.config}
|
||||
'';
|
||||
};
|
||||
|
@ -357,7 +356,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${libcCross.dev}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -366,7 +365,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -412,14 +411,14 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null || libcCross != null) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform || libcCross != null) {
|
||||
# `builder.sh' sets $CPP, which leads configure to use "gcc -E" instead of,
|
||||
# say, "i586-pc-gnu-gcc -E" when building `gcc.crossDrv'.
|
||||
# FIXME: Fix `builder.sh' directly in the next stdenv-update.
|
||||
postUnpack = "unset CPP";
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -60,13 +59,13 @@ with builtins;
|
|||
let version = "4.8.5";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches = [ ]
|
||||
++ optional enableParallelBuilding ../parallel-bconfig.patch
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -120,8 +119,8 @@ let version = "4.8.5";
|
|||
withMode;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
crossMingw = cross != null && cross.libc == "msvcrt";
|
||||
crossDarwin = cross != null && cross.libc == "libSystem";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
crossConfigureFlags = let
|
||||
gccArch = targetPlatform.gcc.arch or null;
|
||||
gccCpu = targetPlatform.gcc.cpu or null;
|
||||
|
@ -136,7 +135,7 @@ let version = "4.8.5";
|
|||
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||
in
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
|
@ -144,8 +143,8 @@ let version = "4.8.5";
|
|||
withFloat +
|
||||
withMode +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -187,7 +186,7 @@ let version = "4.8.5";
|
|||
" --disable-shared" +
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else (if cross.libc == "uclibc" then
|
||||
else (if targetPlatform.libc == "uclibc" then
|
||||
# In uclibc cases, libgomp needs an additional '-ldl'
|
||||
# and as I don't know how to pass it, I disable libgomp.
|
||||
" --disable-libgomp" else "") +
|
||||
|
@ -196,9 +195,9 @@ let version = "4.8.5";
|
|||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips;
|
||||
bootstrap = targetPlatform == hostPlatform && !stdenv.isArm && !stdenv.isMips;
|
||||
|
||||
in
|
||||
|
||||
|
@ -262,7 +261,7 @@ stdenv.mkDerivation ({
|
|||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -292,7 +291,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
|
@ -357,19 +356,19 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
)
|
||||
}
|
||||
${if cross == null
|
||||
${if targetPlatform == hostPlatform
|
||||
then if stdenv.isDarwin
|
||||
then " --with-native-system-header-dir=${darwin.usr-include}"
|
||||
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
${if targetPlatform == hostPlatform then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
|
@ -402,7 +401,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -479,7 +478,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${libcCross.dev}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -488,7 +487,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -537,13 +536,13 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; }
|
||||
# Strip kills static libs of other archs (hence targetPlatform != hostPlatform)
|
||||
// optionalAttrs (!stripped || targetPlatform != hostPlatform) { dontStrip = true; }
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -60,14 +59,14 @@ with builtins;
|
|||
let version = "4.9.4";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches =
|
||||
[ ../use-source-date-epoch.patch ]
|
||||
++ optionals enableParallelBuilding [ ../parallel-bconfig.patch ./parallel-strsignal.patch ]
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -122,8 +121,8 @@ let version = "4.9.4";
|
|||
withMode;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
crossMingw = cross != null && cross.libc == "msvcrt";
|
||||
crossDarwin = cross != null && cross.libc == "libSystem";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
crossConfigureFlags = let
|
||||
gccArch = targetPlatform.gcc.arch or null;
|
||||
gccCpu = targetPlatform.gcc.cpu or null;
|
||||
|
@ -138,7 +137,7 @@ let version = "4.9.4";
|
|||
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||
in
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
|
@ -146,8 +145,8 @@ let version = "4.9.4";
|
|||
withFloat +
|
||||
withMode +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -187,7 +186,7 @@ let version = "4.9.4";
|
|||
" --disable-shared" +
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else (if cross.libc == "uclibc" then
|
||||
else (if targetPlatform.libc == "uclibc" then
|
||||
# libsanitizer requires netrom/netrom.h which is not
|
||||
# available in uclibc.
|
||||
" --disable-libsanitizer" +
|
||||
|
@ -199,9 +198,9 @@ let version = "4.9.4";
|
|||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null;
|
||||
bootstrap = targetPlatform == hostPlatform;
|
||||
|
||||
in
|
||||
|
||||
|
@ -266,7 +265,7 @@ stdenv.mkDerivation ({
|
|||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -296,7 +295,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
|
@ -363,19 +362,19 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
)
|
||||
}
|
||||
${if cross == null
|
||||
${if targetPlatform == hostPlatform
|
||||
then if stdenv.isDarwin
|
||||
then " --with-native-system-header-dir=${darwin.usr-include}"
|
||||
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
${if targetPlatform == hostPlatform then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
|
@ -408,7 +407,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -485,7 +484,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${libcCross.dev}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -494,7 +493,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -543,13 +542,13 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; }
|
||||
# Strip kills static libs of other archs (hence targetPlatform != hostPlatform)
|
||||
// optionalAttrs (!stripped || targetPlatform != hostPlatform) { dontStrip = true; }
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -63,13 +62,13 @@ let version = "5.4.0";
|
|||
sha256 = "0fihlcy5hnksdxk0sn6bvgnyq8gfrgs8m794b1jxwd1dxinzg3b0";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches =
|
||||
[ ../use-source-date-epoch.patch ]
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -126,8 +125,8 @@ let version = "5.4.0";
|
|||
withMode;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
crossMingw = cross != null && cross.libc == "msvcrt";
|
||||
crossDarwin = cross != null && cross.libc == "libSystem";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
crossConfigureFlags = let
|
||||
gccArch = targetPlatform.gcc.arch or null;
|
||||
gccCpu = targetPlatform.gcc.cpu or null;
|
||||
|
@ -142,7 +141,7 @@ let version = "5.4.0";
|
|||
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||
in
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
|
@ -150,8 +149,8 @@ let version = "5.4.0";
|
|||
withFloat +
|
||||
withMode +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -191,7 +190,7 @@ let version = "5.4.0";
|
|||
" --disable-shared" +
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else (if cross.libc == "uclibc" then
|
||||
else (if targetPlatform.libc == "uclibc" then
|
||||
# libsanitizer requires netrom/netrom.h which is not
|
||||
# available in uclibc.
|
||||
" --disable-libsanitizer" +
|
||||
|
@ -203,9 +202,9 @@ let version = "5.4.0";
|
|||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null;
|
||||
bootstrap = targetPlatform == hostPlatform;
|
||||
|
||||
in
|
||||
|
||||
|
@ -283,7 +282,7 @@ stdenv.mkDerivation ({
|
|||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -312,7 +311,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
|
@ -378,19 +377,19 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
)
|
||||
}
|
||||
${if cross == null
|
||||
${if targetPlatform == hostPlatform
|
||||
then if stdenv.isDarwin
|
||||
then " --with-native-system-header-dir=${darwin.usr-include}"
|
||||
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
${if targetPlatform == hostPlatform then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
|
@ -423,7 +422,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -499,7 +498,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${getDev libcCross}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -508,7 +507,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -556,13 +555,13 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; }
|
||||
# Strip kills static libs of other archs (hence targetPlatform != hostPlatform)
|
||||
// optionalAttrs (!stripped || targetPlatform != hostPlatform) { dontStrip = true; }
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -62,13 +61,13 @@ with builtins;
|
|||
let version = "6.3.0";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches =
|
||||
[ ../use-source-date-epoch.patch ]
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -122,8 +121,8 @@ let version = "6.3.0";
|
|||
withMode;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
crossMingw = cross != null && cross.libc == "msvcrt";
|
||||
crossDarwin = cross != null && cross.libc == "libSystem";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
crossConfigureFlags = let
|
||||
gccArch = targetPlatform.gcc.arch or null;
|
||||
gccCpu = targetPlatform.gcc.cpu or null;
|
||||
|
@ -138,7 +137,7 @@ let version = "6.3.0";
|
|||
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||
in
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
|
@ -146,8 +145,8 @@ let version = "6.3.0";
|
|||
withFloat +
|
||||
withMode +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -187,7 +186,7 @@ let version = "6.3.0";
|
|||
" --disable-shared" +
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else (if cross.libc == "uclibc" then
|
||||
else (if targetPlatform.libc == "uclibc" then
|
||||
# libsanitizer requires netrom/netrom.h which is not
|
||||
# available in uclibc.
|
||||
" --disable-libsanitizer" +
|
||||
|
@ -199,9 +198,9 @@ let version = "6.3.0";
|
|||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null;
|
||||
bootstrap = targetPlatform == hostPlatform;
|
||||
|
||||
in
|
||||
|
||||
|
@ -265,7 +264,7 @@ stdenv.mkDerivation ({
|
|||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -294,7 +293,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
|
@ -360,19 +359,19 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
)
|
||||
}
|
||||
${if cross == null
|
||||
${if targetPlatform == hostPlatform
|
||||
then if stdenv.isDarwin
|
||||
then " --with-native-system-header-dir=${darwin.usr-include}"
|
||||
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
${if targetPlatform == hostPlatform then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
|
@ -405,7 +404,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -481,7 +480,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${getDev libcCross}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -490,7 +489,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -538,13 +537,13 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; }
|
||||
# Strip kills static libs of other archs (hence targetPlatform != hostPlatform)
|
||||
// optionalAttrs (!stripped || targetPlatform != hostPlatform) { dontStrip = true; }
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
|
@ -63,13 +62,13 @@ with builtins;
|
|||
let version = "7-20170409";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches =
|
||||
[ ]
|
||||
++ optional (cross != null) ../libstdc++-target.patch
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
|
@ -122,8 +121,8 @@ let version = "7-20170409";
|
|||
withMode;
|
||||
|
||||
/* Cross-gcc settings */
|
||||
crossMingw = cross != null && cross.libc == "msvcrt";
|
||||
crossDarwin = cross != null && cross.libc == "libSystem";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
crossConfigureFlags = let
|
||||
gccArch = targetPlatform.gcc.arch or null;
|
||||
gccCpu = targetPlatform.gcc.cpu or null;
|
||||
|
@ -138,7 +137,7 @@ let version = "7-20170409";
|
|||
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
|
||||
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
|
||||
in
|
||||
"--target=${cross.config}" +
|
||||
"--target=${targetPlatform.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
|
@ -146,8 +145,8 @@ let version = "7-20170409";
|
|||
withFloat +
|
||||
withMode +
|
||||
# Ensure that -print-prog-name is able to find the correct programs.
|
||||
" --with-as=${binutils}/bin/${cross.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${cross.config}-ld" +
|
||||
" --with-as=${binutils}/bin/${targetPlatform.config}-as" +
|
||||
" --with-ld=${binutils}/bin/${targetPlatform.config}-ld" +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
|
@ -188,7 +187,7 @@ let version = "7-20170409";
|
|||
" --disable-shared" +
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else (if cross.libc == "uclibc" then
|
||||
else (if targetPlatform.libc == "uclibc" then
|
||||
# libsanitizer requires netrom/netrom.h which is not
|
||||
# available in uclibc.
|
||||
" --disable-libsanitizer" +
|
||||
|
@ -200,9 +199,9 @@ let version = "7-20170409";
|
|||
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
|
||||
);
|
||||
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
|
||||
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null;
|
||||
bootstrap = targetPlatform == hostPlatform;
|
||||
|
||||
in
|
||||
|
||||
|
@ -266,7 +265,7 @@ stdenv.mkDerivation ({
|
|||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
else if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
|
@ -295,7 +294,7 @@ stdenv.mkDerivation ({
|
|||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutils])
|
||||
++ (optionals (targetPlatform != hostPlatform) [binutils])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
|
@ -361,19 +360,19 @@ stdenv.mkDerivation ({
|
|||
)
|
||||
)
|
||||
}
|
||||
${if cross == null
|
||||
${if targetPlatform == hostPlatform
|
||||
then if stdenv.isDarwin
|
||||
then " --with-native-system-header-dir=${darwin.usr-include}"
|
||||
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
|
||||
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
${if targetPlatform == hostPlatform then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
|
@ -406,7 +405,7 @@ stdenv.mkDerivation ({
|
|||
NM_FOR_TARGET = "${targetPlatform.config}-nm";
|
||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
|
||||
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
|
@ -482,7 +481,7 @@ stdenv.mkDerivation ({
|
|||
++ optional (libpthread != null) libpthread);
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-idirafter ${getDev libcCross}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
|
@ -491,7 +490,7 @@ stdenv.mkDerivation ({
|
|||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null then [
|
||||
if targetPlatform != hostPlatform && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
|
@ -539,13 +538,13 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
|
||||
# Strip kills static libs of other archs (hence targetPlatform != hostPlatform)
|
||||
// optionalAttrs (!stripped || targetPlatform != hostPlatform) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
|
|
|
@ -5145,7 +5145,6 @@ with pkgs;
|
|||
else null;
|
||||
in wrapGCCCross {
|
||||
gcc = forcedNativePackages.gcc.cc.override {
|
||||
cross = targetPlatform;
|
||||
crossStageStatic = true;
|
||||
langCC = false;
|
||||
libcCross = libcCross1;
|
||||
|
@ -5168,7 +5167,6 @@ with pkgs;
|
|||
|
||||
gccCrossStageFinal = assert targetPlatform != buildPlatform; wrapGCCCross {
|
||||
gcc = forcedNativePackages.gcc.cc.override {
|
||||
cross = targetPlatform;
|
||||
crossStageStatic = false;
|
||||
|
||||
# Why is this needed?
|
||||
|
@ -5190,10 +5188,6 @@ with pkgs;
|
|||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944
|
||||
profiledCompiler = !stdenv.isArm;
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
}));
|
||||
|
||||
|
@ -5203,10 +5197,6 @@ with pkgs;
|
|||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isSunOS && !isDarwin && (isi686 || isx86_64));
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
|
||||
isl = if !stdenv.isDarwin then isl_0_14 else null;
|
||||
|
@ -5220,10 +5210,6 @@ with pkgs;
|
|||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
|
||||
isl = if !stdenv.isDarwin then isl_0_11 else null;
|
||||
|
@ -5237,10 +5223,6 @@ with pkgs;
|
|||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
|
||||
isl = if !stdenv.isDarwin then isl_0_14 else null;
|
||||
|
@ -5252,10 +5234,6 @@ with pkgs;
|
|||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
|
||||
isl = if !stdenv.isDarwin then isl_0_14 else null;
|
||||
|
@ -5282,10 +5260,6 @@ with pkgs;
|
|||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if targetPlatform != buildPlatform then libcCross else null;
|
||||
|
||||
isl = isl_0_17;
|
||||
|
|
Loading…
Reference in New Issue