Merge pull request #28448 from obsidiansystems/cc-wrapper-setup-var
cc-wrapper: Newstyle setup vars
This commit is contained in:
commit
5efca65f24
@ -97,10 +97,12 @@ ccWrapper_addCVars () {
|
||||
# setup-hook, which `role` tracks.
|
||||
if [ -n "${crossConfig:-}" ]; then
|
||||
export NIX_CC_WRAPPER_@infixSalt@_TARGET_BUILD=1
|
||||
role="BUILD_"
|
||||
role_pre='BUILD_'
|
||||
role_post='_FOR_BUILD'
|
||||
else
|
||||
export NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST=1
|
||||
role=""
|
||||
role_pre=''
|
||||
role_post=''
|
||||
fi
|
||||
|
||||
# Eventually the exact sort of env-hook we create will depend on the role. This
|
||||
@ -133,20 +135,24 @@ fi
|
||||
|
||||
# Export tool environment variables so various build systems use the right ones.
|
||||
|
||||
export NIX_${role}CC=@out@
|
||||
export NIX_${role_pre}CC=@out@
|
||||
|
||||
export ${role}CC=@named_cc@
|
||||
export ${role}CXX=@named_cxx@
|
||||
export ${role_pre}CC=@named_cc@
|
||||
export ${role_pre}CXX=@named_cxx@
|
||||
export CC${role_post}=@named_cc@
|
||||
export CXX${role_post}=@named_cxx@
|
||||
|
||||
for CMD in \
|
||||
ar as nm objcopy ranlib strip strings size ld windres
|
||||
for cmd in \
|
||||
ar as ld nm objcopy objdump readelf ranlib strip strings size windres
|
||||
do
|
||||
if
|
||||
PATH=$_PATH type -p "@targetPrefix@$CMD" > /dev/null
|
||||
PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null
|
||||
then
|
||||
export "${role}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@targetPrefix@${CMD}";
|
||||
upper_case="$(echo "$cmd" | tr "[:lower:]" "[:upper:]")"
|
||||
export "${role_pre}${upper_case}=@targetPrefix@${cmd}";
|
||||
export "${upper_case}${role_post}=@targetPrefix@${cmd}";
|
||||
fi
|
||||
done
|
||||
|
||||
# No local scope in sourced file
|
||||
unset role
|
||||
unset -v role_pre role_post cmd upper_case
|
||||
|
Loading…
Reference in New Issue
Block a user