From 1ac5398589916a6a433e845342c9b85c4c52f5dc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 28 Apr 2020 00:08:48 -0400 Subject: *-wrapper; Switch from `infixSalt` to `suffixSalt` I hate the thing too even though I made it, and rather just get rid of it. But we can't do that yet. In the meantime, this brings us more inline with autoconf and will make it slightly easier for me to write a pkg-config wrapper, which we need. --- pkgs/build-support/wrapper-common/utils.bash | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'pkgs/build-support/wrapper-common') diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash index 4fd57162072..8c4680a8e44 100644 --- a/pkgs/build-support/wrapper-common/utils.bash +++ b/pkgs/build-support/wrapper-common/utils.bash @@ -1,29 +1,29 @@ -# Accumulate infixes for taking in the right input parameters with the `mangle*` +# Accumulate suffixes for taking in the right input parameters with the `mangle*` # functions below. See setup-hook for details. accumulateRoles() { - declare -ga role_infixes=() - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_BUILD:-}" ]; then - role_infixes+=(_BUILD_) + declare -ga role_suffixes=() + if [ "${NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@:-}" ]; then + role_suffixes+=('_FOR_BUILD') fi - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_HOST:-}" ]; then - role_infixes+=(_) + if [ "${NIX_@wrapperName@_TARGET_HOST_@suffixSalt@:-}" ]; then + role_suffixes+=('') fi - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_TARGET:-}" ]; then - role_infixes+=(_TARGET_) + if [ "${NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@:-}" ]; then + role_suffixes+=('_FOR_TARGET') fi } mangleVarList() { local var="$1" shift - local -a role_infixes=("$@") + local -a role_suffixes=("$@") - local outputVar="${var/+/_@infixSalt@_}" + local outputVar="${var}_@suffixSalt@" declare -gx ${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 - local inputVar="${var/+/${infix}}" + for suffix in "${role_suffixes[@]}"; do + local inputVar="${var}${suffix}" if [ -v "$inputVar" ]; then export ${outputVar}+="${!outputVar:+ }${!inputVar}" fi @@ -33,12 +33,12 @@ mangleVarList() { mangleVarBool() { local var="$1" shift - local -a role_infixes=("$@") + local -a role_suffixes=("$@") - local outputVar="${var/+/_@infixSalt@_}" + local outputVar="${var}_@suffixSalt@" declare -gxi ${outputVar}+=0 - for infix in "${role_infixes[@]}"; do - local inputVar="${var/+/${infix}}" + for suffix in "${role_suffixes[@]}"; do + local inputVar="${var}${suffix}" if [ -v "$inputVar" ]; then # "1" in the end makes `let` return success error code when # expression itself evaluates to zero. -- cgit 1.4.1