mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 13:41:26 +00:00
cc-wrapper: Pull variable mangler into utils.sh
In preparation for splitting out bintools-wrapper
This commit is contained in:
parent
45d4b27d02
commit
fc7ed86915
|
@ -36,16 +36,7 @@ fi
|
|||
# We need to mangle names for hygiene, but also take parameters/overrides
|
||||
# from the environment.
|
||||
for var in "${var_templates[@]}"; do
|
||||
outputVar="${var/+/_@infixSalt@_}"
|
||||
export ${outputVar}+=''
|
||||
# For each role we serve, we accumulate the input parameters into our own
|
||||
# cc-wrapper-derivation-specific environment variables.
|
||||
for infix in "${role_infixes[@]}"; do
|
||||
inputVar="${var/+/${infix}}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
export ${outputVar}+="${!outputVar:+ }${!inputVar}"
|
||||
fi
|
||||
done
|
||||
mangleVarList "$var" "${role_infixes[@]}"
|
||||
done
|
||||
|
||||
# `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld.
|
||||
|
|
|
@ -15,12 +15,12 @@ if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then
|
|||
PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin"
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then
|
||||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
|
||||
# Parse command line options and set several variables.
|
||||
# For instance, figure out if linker flags should be passed.
|
||||
|
|
|
@ -17,12 +17,12 @@ if [ -n "@coreutils_bin@" ]; then
|
|||
PATH="@coreutils_bin@/bin"
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
if [ -z "${NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET:-}" ]; then
|
||||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
|
||||
# Figure out if linker flags should be passed. GCC prints annoying
|
||||
# warnings when they are not needed.
|
||||
|
|
|
@ -14,12 +14,12 @@ if [ -n "@coreutils_bin@" ]; then
|
|||
PATH="@coreutils_bin@/bin"
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then
|
||||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.sh
|
||||
|
||||
|
||||
# Optionally filter out paths not refering to the store.
|
||||
expandResponseParams "$@"
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
mangleVarList() {
|
||||
declare var="$1"
|
||||
shift
|
||||
declare -a role_infixes=("$@")
|
||||
|
||||
outputVar="${var/+/_@infixSalt@_}"
|
||||
export ${outputVar}+=''
|
||||
# For each role we serve, we accumulate the input parameters into our own
|
||||
# cc-wrapper-derivation-specific environment variables.
|
||||
for infix in "${role_infixes[@]}"; do
|
||||
inputVar="${var/+/${infix}}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
export ${outputVar}+="${!outputVar:+ }${!inputVar}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
skip () {
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "skipping impure path $1" >&2
|
||||
|
|
Loading…
Reference in a new issue