diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2017-08-31 14:43:09 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-12-13 16:08:13 -0500 |
commit | fc7ed8691505c502b2d05b9b14bb46f239976315 (patch) | |
tree | 5c3501c321ffea7fe839033681531a141b45b2a4 /pkgs/build-support/cc-wrapper/utils.sh | |
parent | 45d4b27d025ec71adc1218bcb2c02e50bcc08492 (diff) | |
download | nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar.gz nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar.bz2 nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar.lz nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar.xz nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.tar.zst nixlib-fc7ed8691505c502b2d05b9b14bb46f239976315.zip |
cc-wrapper: Pull variable mangler into utils.sh
In preparation for splitting out bintools-wrapper
Diffstat (limited to 'pkgs/build-support/cc-wrapper/utils.sh')
-rw-r--r-- | pkgs/build-support/cc-wrapper/utils.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh index c43c2e12d74a..41afde5c3c52 100644 --- a/pkgs/build-support/cc-wrapper/utils.sh +++ b/pkgs/build-support/cc-wrapper/utils.sh @@ -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 |