about summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper/add-flags.sh
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2017-08-08 10:14:54 +0200
committerRobin Gloster <mail@glob.in>2017-08-08 10:15:34 +0200
commit67a41eafe9c92269c9f6788f5f54a4b0d282cb96 (patch)
tree6c187ad831f2293c9ff835398ff598c2fde42771 /pkgs/build-support/cc-wrapper/add-flags.sh
parent89af5d93e63a35851f2f980c72ab61b2fc6110f0 (diff)
cc-wrapper: fix set -u errors
cc @Ericson2314
Diffstat (limited to 'pkgs/build-support/cc-wrapper/add-flags.sh')
-rw-r--r--pkgs/build-support/cc-wrapper/add-flags.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh
index 3d01dba647665..7af2ae58f3a68 100644
--- a/pkgs/build-support/cc-wrapper/add-flags.sh
+++ b/pkgs/build-support/cc-wrapper/add-flags.sh
@@ -10,12 +10,13 @@ declare -a role_prefixes=()
 if [[ -n "${NIX_CC_WRAPPER_@infixSalt@_TARGET_BUILD:-}" ]]; then
     role_prefixes+=(_BUILD)
 fi
-if [[ -n "${NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST:-}" ]]; then
-    role_prefixes+=('')
-fi
 if [[ -n "${NIX_CC_WRAPPER_@infixSalt@_TARGET_TARGET:-}" ]]; then
     role_prefixes+=(_TARGET)
 fi
+# use this as default if no role is inferred
+if [[ -n "${NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST:-}" || ${#role_prefixes[@]} -eq 0 ]]; then
+    role_prefixes+=('')
+fi
 
 # For each role we serve, we accumulate the input parameters into our own
 # cc-wrapper-derivation-specific environment variables.