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-01 16:21:54 -05:00
parent aeffc007fb
commit d4595b38e9
8 changed files with 134 additions and 142 deletions

View File

@ -274,6 +274,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${optionalString (!(crossMingw && crossStageStatic))
"--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
${ # Trick that should be taken out once we have a mips64el-linux not loongson2f ${ # Trick that should be taken out once we have a mips64el-linux not loongson2f
if targetPlatform == hostPlatform && 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 langAda then " --enable-libada" else ""}
@ -325,11 +327,12 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -338,11 +338,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -402,12 +399,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -344,11 +344,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -408,12 +405,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -359,11 +359,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -423,12 +420,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -341,11 +341,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -405,12 +402,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -342,11 +342,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -406,12 +403,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, targetPlatform != hostPlatform
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
dontStrip = true; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";

View File

@ -1,8 +1,17 @@
source $stdenv/setup source $stdenv/setup
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy oldOpts="$(shopt -po nounset)" || true
mkdir $NIX_FIXINC_DUMMY set -euo pipefail
if test -n "${NIX_CC_CROSS-}"; then
export NIX_CC="$NIX_CC_CROSS"
fi
export NIX_FIXINC_DUMMY="$NIX_BUILD_TOP/dummy"
mkdir "$NIX_FIXINC_DUMMY"
if test "$staticCompiler" = "1"; then if test "$staticCompiler" = "1"; then
@ -20,134 +29,126 @@ echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
if test "$noSysDirs" = "1"; then if test "$noSysDirs" = "1"; then
if test -e $NIX_CC/nix-support/orig-libc; then declare \
EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \
EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS
# Figure out what extra flags to pass to the gcc compilers for pre in 'BUILD_' ''; do
# being generated to make sure that they use our glibc. curCC="NIX_${pre}CC"
extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)" curFIXINC="NIX_${pre}FIXINC_DUMMY"
extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before || true)"
# Use *real* header files, otherwise a limits.h is generated declare -a extraFlags=() extraLDFlags=()
# that does not include Glibc's limits.h (notably missing if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
# SSIZE_MAX, which breaks the build). # Figure out what extra flags to pass to the gcc compilers being
export NIX_FIXINC_DUMMY=$libc_dev/include # generated to make sure that they use our glibc.
extraFlags=($(cat "${!curCC}/nix-support/libc-cflags"))
extraLDFlags=($(cat "${!curCC}/nix-support/libc-ldflags") $(cat "${!curCC}/nix-support/libc-ldflags-before" || true))
# The path to the Glibc binaries such as `crti.o'. # The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_CC/nix-support/orig-libc)/lib" glibc_libdir="$(cat "${!curCC}/nix-support/orig-libc")/lib"
glibc_devdir="$(cat "${!curCC}/nix-support/orig-libc-dev")"
else # Use *real* header files, otherwise a limits.h is generated that
# Hack: support impure environments. # does not include Glibc's limits.h (notably missing SSIZE_MAX,
extraFlags="-isystem /usr/include" # which breaks the build).
extraLDFlags="-L/usr/lib64 -L/usr/lib" declare NIX_${pre}FIXINC_DUMMY="$glibc_devdir/include"
glibc_libdir="/usr/lib" else
export NIX_FIXINC_DUMMY=/usr/include # Hack: support impure environments.
fi extraFlags=("-isystem" "/usr/include")
extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
glibc_libdir="/usr/lib"
declare NIX_${pre}FIXINC_DUMMY=/usr/include
fi
extraFlags="-I$NIX_FIXINC_DUMMY $extraFlags" extraFlags=("-I${!curFIXINC}"
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags" "${extraFlags[@]}")
extraLDFlags=("-L$glibc_libdir" "-rpath" "$glibc_libdir"
"${extraLDFlags[@]}")
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below, # BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
# make sure to explictly add them so that files compiled with the # sure to explictly add them so that files compiled with the bootstrap
# bootstrap compiler are optimized and (optionally) contain # compiler are optimized and (optionally) contain debugging information
# debugging information (info "(gccinstall) Building"). # (info "(gccinstall) Building").
if test -n "$dontStrip"; then if test -n "${dontStrip-}"; then
extraFlags="-O2 -g $extraFlags" extraFlags=("-O2" "-g" "${extraFlags[@]}")
else else
# Don't pass `-g' at all; this saves space while building. # Don't pass `-g' at all; this saves space while building.
extraFlags="-O2 $extraFlags" extraFlags=("-O2" "${extraFlags[@]}")
fi fi
EXTRA_FLAGS="$extraFlags" declare EXTRA_${pre}FLAGS="${extraFlags[*]}"
for i in $extraLDFlags; do for i in "${extraLDFlags[@]}"; do
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" declare EXTRA_${pre}LDFLAGS+=" -Wl,$i"
done
done done
if test -n "$targetConfig"; then if test -n "${targetConfig-}"; then
# Cross-compiling, we need gcc not to read ./specs in order to build # Cross-compiling, we need gcc not to read ./specs in order to build the
# the g++ compiler (after the specs for the cross-gcc are created). # g++ compiler (after the specs for the cross-gcc are created). Having
# Having LIBRARY_PATH= makes gcc read the specs from ., and the build # LIBRARY_PATH= makes gcc read the specs from ., and the build
# breaks. Having this variable comes from the default.nix code to bring # breaks. Having this variable comes from the default.nix code to bring
# gcj in. # gcj in.
unset LIBRARY_PATH unset LIBRARY_PATH
unset CPATH unset CPATH
else else
if test -z "$NIX_CC_CROSS"; then # host = target, so the flags are the same
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS" EXTRA_TARGET_FLAGS="$EXTRA_FLAGS"
EXTRA_TARGET_CXXFLAGS="$EXTRA_FLAGS" EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
else
# This the case of cross-building the gcc.
# We need special flags for the target, different than those of the build
# Assertion:
test -e $NIX_CC_CROSS/nix-support/orig-libc
# Figure out what extra flags to pass to the gcc compilers
# being generated to make sure that they use our glibc.
extraFlags="$(cat $NIX_CC_CROSS/nix-support/libc-cflags)"
extraLDFlags="$(cat $NIX_CC_CROSS/nix-support/libc-ldflags) $(cat $NIX_CC_CROSS/nix-support/libc-ldflags-before)"
# The path to the Glibc binaries such as `crti.o'.
glibc_dir="$(cat $NIX_CC_CROSS/nix-support/orig-libc)"
glibc_libdir="$glibc_dir/lib"
glibc_devdir="$(cat $NIX_CC_CROSS/nix-support/orig-libc-dev)"
configureFlags="$configureFlags --with-native-system-header-dir=$glibc_devdir/include"
# Use *real* header files, otherwise a limits.h is generated
# that does not include Glibc's limits.h (notably missing
# SSIZE_MAX, which breaks the build).
NIX_FIXINC_DUMMY_CROSS="$glibc_devdir/include"
extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
EXTRA_TARGET_CFLAGS="$extraFlags"
for i in $extraLDFlags; do
EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
done
fi
fi fi
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
# the startfiles. # the startfiles.
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
# for the startfiles. # for the startfiles.
makeFlagsArray+=( \ makeFlagsArray+=(
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ "BUILD_SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY"
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ "SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY"
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY"
CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
CXXFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
)
if test -z "$targetConfig"; then "LDFLAGS_FOR_BUILD=$EXTRA_BUILD_LDFLAGS"
makeFlagsArray+=( \ #"LDFLAGS=$EXTRA_LDFLAGS"
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ "LDFLAGS_FOR_TARGET=$EXTRA_TARGET_LDFLAGS"
BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
) "CFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
"CXXFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
"FLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
# It seems there is a bug in GCC 5
#"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
#"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
"CFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
"CXXFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
"FLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
)
if test -z "${targetConfig-}"; then
makeFlagsArray+=(
"BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
"BOOT_LDFLAGS=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
)
fi fi
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then if test -n "${targetConfig-}" -a "$crossStageStatic" == 1; then
# We don't want the gcc build to assume there will be a libc providing # We don't want the gcc build to assume there will be a libc providing
# limits.h in this stagae # limits.h in this stagae
makeFlagsArray+=( \ makeFlagsArray+=(
LIMITS_H_TEST=false \ 'LIMITS_H_TEST=false'
) )
else else
makeFlagsArray+=( \ makeFlagsArray+=(
LIMITS_H_TEST=true \ 'LIMITS_H_TEST=true'
) )
fi fi
fi fi
if test -n "$targetConfig"; then if test -n "${targetConfig-}"; then
# The host strip will destroy some important details of the objects # The host strip will destroy some important details of the objects
dontStrip=1 dontStrip=1
fi fi
eval "$oldOpts"
providedPreConfigure="$preConfigure"; providedPreConfigure="$preConfigure";
preConfigure() { preConfigure() {
if test -n "$newlibSrc"; then if test -n "$newlibSrc"; then

View File

@ -342,11 +342,8 @@ stdenv.mkDerivation ({
) )
) )
} }
${if targetPlatform == hostPlatform ${optionalString (!(crossMingw && crossStageStatic))
then if hostPlatform.isDarwin "--with-native-system-header-dir=${getDev (stdenv.ccCross or stdenv.cc).libc}/include"}
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 langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
@ -406,12 +403,13 @@ stdenv.mkDerivation ({
STRIP_FOR_TARGET = "${targetPlatform.config}-strip"; STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
CC_FOR_TARGET = "${targetPlatform.config}-gcc"; CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++"; 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; dontStrip = true;
buildFlags = ""; buildFlags = "";
}; };
NIX_BUILD_CC = stdenv.cc;
NIX_CC_CROSS = stdenv.ccCross or null;
# Needed for the cross compilation to work # Needed for the cross compilation to work
AR = "ar"; AR = "ar";