Merge pull request #124149 from sternenseemann/pkg-config-mangling-21.05

[21.05] pkg-config-wrapper: mangle PKG_CONFIG_PATH{,_FOR_BUILD} correctly
This commit is contained in:
John Ericson 2021-05-23 09:41:39 -07:00 committed by GitHub
commit 62f3f8954c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,7 @@ var_templates_list=(
accumulateRoles
for var in "${var_templates_list[@]}"; do
mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
mangleVarListGeneric ":" "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done
export NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@=1

View File

@ -13,7 +13,9 @@ accumulateRoles() {
fi
}
mangleVarList() {
mangleVarListGeneric() {
local sep="$1"
shift
local var="$1"
shift
local -a role_suffixes=("$@")
@ -25,11 +27,15 @@ mangleVarList() {
for suffix in "${role_suffixes[@]}"; do
local inputVar="${var}${suffix}"
if [ -v "$inputVar" ]; then
export ${outputVar}+="${!outputVar:+ }${!inputVar}"
export ${outputVar}+="${!outputVar:+$sep}${!inputVar}"
fi
done
}
mangleVarList() {
mangleVarListGeneric " " "$@"
}
mangleVarBool() {
local var="$1"
shift