gcc: Modernize builder.sh for Cross

Instead of `NIX_CC` vs `NIX_CC_CROSS` spagetti, unconditionally use
`NIX_BUILD_CC` and `NIX_CC` in a consistent manner.
This commit is contained in:
John Ericson
2017-12-06 19:12:50 -05:00
parent aeffc007fb
commit d4595b38e9
8 changed files with 134 additions and 142 deletions
@@ -344,11 +344,8 @@ stdenv.mkDerivation ({
)
)
}
${if targetPlatform == hostPlatform
then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""}
${optionalString (!(crossMingw && crossStageStatic))
"--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
${if langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@@ -408,12 +405,13 @@ stdenv.mkDerivation ({
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 = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
dontStrip = true;
buildFlags = "";
};
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work
AR = "ar";