diff options
author | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-11-05 13:32:54 (GMT) |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-11-05 14:58:41 (GMT) |
commit | 65a2801c18b5de9f3eec941837e4999b989eed20 (patch) | |
tree | 22c4d450bb0a8f33cf3e1bb5a3c9988af9ba69ec /configure | |
parent | 0fe5cbce817529bbf05f07e34f38d6116e89f819 (diff) | |
download | Qt-65a2801c18b5de9f3eec941837e4999b989eed20.zip Qt-65a2801c18b5de9f3eec941837e4999b989eed20.tar.gz Qt-65a2801c18b5de9f3eec941837e4999b989eed20.tar.bz2 |
configure: Deal with multiple redefinitions of qmake variables
The function setBootstrapVariable() did not account for multiple
definitions of the same variable, eg. QMAKE_CC=foo; QMAKE_CC=bar
We now look for '+=' and only append the values if this is found,
otherwise we reset the variable to the given value, and continue
looking for extra values.
Reviewed-by: ossi
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 38 |
1 files changed, 24 insertions, 14 deletions
@@ -4696,27 +4696,37 @@ fi # $2: optional transformation # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter # is where the resulting variable is written to +# Assumes that the optional transformation produces the same variable name for each hit setBootstrapVariable() { getQMakeConf | $AWK '/^('"$1"')[^_A-Z0-9]/ { print $0; }' | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK ' +BEGIN { + variable = "" + combinedValue = "" +} { - varLength = index($0, "=") - 1 - valStart = varLength + 2 - if (substr($0, varLength, 1) == "+") { - varLength = varLength - 1 - valStart = valStart + 1 + valStart = index($0, "=") + 1 + + append = 0 + if (substr($0, valStart - 2, 1) == "+") { + append = 1 + } + + variable = substr($0, 0, valStart - 2 - append) + value = substr($0, valStart) + gsub("[ \t]+", "", variable) + gsub("^[ \t]+", "", value) + gsub("[ \t]+$", "", value) + + if (append == 1 && length(combinedValue) > 0) { + combinedValue = combinedValue " " value + } else { + combinedValue = value } - var = substr($0, 0, varLength) - gsub("[ \t]+", "", var) - val = substr($0, valStart) - printf "%s_%s = %s\n", var, NR, val } END { - if (length(var) > 0) { - printf "%s =", var - for (i = 1; i <= NR; ++i) - printf " $(%s_%s)", var, i - printf "\n" + if (length(combinedValue) > 0) { + printf "%s = %s\n", variable, combinedValue } }' >> "$mkfile" } |