cc-wrapper: Always export environment variables for binutils
Before, this only happened when cross compiling.
This commit is contained in:
parent
aaaa470ff8
commit
093cc00cdd
@ -71,22 +71,6 @@ let
|
|||||||
-e 's^addCVars^addCVars${_infixSalt}^g' \
|
-e 's^addCVars^addCVars${_infixSalt}^g' \
|
||||||
-e 's^\[ -z "\$crossConfig" \]^\[\[ "${builtins.toString (targetPlatform != hostPlatform)}" || -z "$crossConfig" \]\]^g'
|
-e 's^\[ -z "\$crossConfig" \]^\[\[ "${builtins.toString (targetPlatform != hostPlatform)}" || -z "$crossConfig" \]\]^g'
|
||||||
|
|
||||||
'' + stdenv.lib.optionalString (textFile == ./setup-hook.sh) ''
|
|
||||||
cat << 'EOF' >> $out
|
|
||||||
for CMD in ar as nm objcopy ranlib strip strings size ld windres
|
|
||||||
do
|
|
||||||
# which is not part of stdenv, but compgen will do for now
|
|
||||||
if
|
|
||||||
PATH=$_PATH type -p ${prefix}$CMD > /dev/null
|
|
||||||
then
|
|
||||||
export ''$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=${prefix}''${CMD};
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sed -i $out -e 's_envHooks_crossEnvHooks_g'
|
|
||||||
'' + ''
|
|
||||||
|
|
||||||
# NIX_ things which we don't both use and define, we revert them
|
# NIX_ things which we don't both use and define, we revert them
|
||||||
#asymmetric=$(
|
#asymmetric=$(
|
||||||
# for pre in "" "\\$"
|
# for pre in "" "\\$"
|
||||||
@ -143,6 +127,7 @@ stdenv.mkDerivation {
|
|||||||
inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin;
|
inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin;
|
||||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||||
|
|
||||||
|
binPrefix = prefix;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile
|
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile
|
||||||
@ -303,20 +288,24 @@ stdenv.mkDerivation {
|
|||||||
wrap ${prefix}ld.bfd ${preWrap ./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd
|
wrap ${prefix}ld.bfd ${preWrap ./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export real_cc=${prefix}cc
|
# We export environment variables pointing to the wrapped nonstandard
|
||||||
export real_cxx=${prefix}c++
|
# cmds, lest some lousy configure script use those to guess compiler
|
||||||
|
# version.
|
||||||
|
export named_cc=${prefix}cc
|
||||||
|
export named_cxx=${prefix}c++
|
||||||
|
|
||||||
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
|
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
|
||||||
|
|
||||||
if [ -e $ccPath/${prefix}gcc ]; then
|
if [ -e $ccPath/${prefix}gcc ]; then
|
||||||
wrap ${prefix}gcc ${preWrap ./cc-wrapper.sh} $ccPath/${prefix}gcc
|
wrap ${prefix}gcc ${preWrap ./cc-wrapper.sh} $ccPath/${prefix}gcc
|
||||||
ln -s ${prefix}gcc $out/bin/${prefix}cc
|
ln -s ${prefix}gcc $out/bin/${prefix}cc
|
||||||
export real_cc=${prefix}gcc
|
export named_cc=${prefix}gcc
|
||||||
export real_cxx=${prefix}g++
|
export named_cxx=${prefix}g++
|
||||||
elif [ -e $ccPath/clang ]; then
|
elif [ -e $ccPath/clang ]; then
|
||||||
wrap ${prefix}clang ${preWrap ./cc-wrapper.sh} $ccPath/clang
|
wrap ${prefix}clang ${preWrap ./cc-wrapper.sh} $ccPath/clang
|
||||||
ln -s ${prefix}clang $out/bin/${prefix}cc
|
ln -s ${prefix}clang $out/bin/${prefix}cc
|
||||||
export real_cc=clang
|
export named_cc=${prefix}clang
|
||||||
export real_cxx=clang++
|
export named_cxx=${prefix}clang++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $ccPath/${prefix}g++ ]; then
|
if [ -e $ccPath/${prefix}g++ ]; then
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
export NIX_CC=@out@
|
|
||||||
|
|
||||||
addCVars () {
|
addCVars () {
|
||||||
if [ -d $1/include ]; then
|
if [ -d $1/include ]; then
|
||||||
export NIX_CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include"
|
export NIX_CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include"
|
||||||
@ -39,9 +37,26 @@ if [ -n "@coreutils_bin@" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$crossConfig" ]; then
|
if [ -z "$crossConfig" ]; then
|
||||||
export CC=@real_cc@
|
ENV_PREFIX=""
|
||||||
export CXX=@real_cxx@
|
|
||||||
else
|
else
|
||||||
export BUILD_CC=@real_cc@
|
ENV_PREFIX="BUILD_"
|
||||||
export BUILD_CXX=@real_cxx@
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export NIX_${ENV_PREFIX}CC=@out@
|
||||||
|
|
||||||
|
export ${ENV_PREFIX}CC=@named_cc@
|
||||||
|
export ${ENV_PREFIX}CXX=@named_cxx@
|
||||||
|
|
||||||
|
for CMD in \
|
||||||
|
cpp \
|
||||||
|
ar as nm objcopy ranlib strip strings size ld windres
|
||||||
|
do
|
||||||
|
if
|
||||||
|
PATH=$_PATH type -p @binPrefix@$CMD > /dev/null
|
||||||
|
then
|
||||||
|
export ${ENV_PREFIX}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@binPrefix@${CMD};
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# No local scope available for sourced files
|
||||||
|
unset ENV_PREFIX
|
||||||
|
Loading…
Reference in New Issue
Block a user