summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_functions.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/qt_functions.prf')
-rw-r--r--mkspecs/features/qt_functions.prf76
1 files changed, 60 insertions, 16 deletions
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 00f4bdf93e..c23d006d82 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -70,6 +70,7 @@ defineTest(qtPrepareTool) {
}
}
QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
+ QT_TOOL_NAME = $$2
!isEmpty(3)|!isEmpty(4) {
$$1$$3 =
for (arg, cmd): \
@@ -90,29 +91,73 @@ defineTest(qtAddToolEnv) {
ds = $$QMAKE_DIR_SEP
else: \
ds = $$DIR_SEPARATOR
+ batch_sets =
for(env, 2) {
value = $$eval($${env}.value)
!isEmpty(value) {
name = $$eval($${env}.name)
+ config = $$eval($${env}.CONFIG)
equals(ds, /) {
- contains($${env}.CONFIG, prepend): infix = \${$$name:+:\$$$name}
+ contains(config, prepend): infix = \${$$name:+:\$$$name}
+ else: contains(config, always_prepend): infix = :\$$$name
else: infix =
- val = "$$name=$$shell_quote($$join(value, :))$$infix"
+ # Under msys, this path is taken only in the non-system()
+ # case, so using shell_quote() always works.
+ batch_sets += \
+ "$$name=$$shell_quote($$join(value, :))$$infix" \
+ "export $$name"
} else {
- # Escape closing parens when expanding the variable, otherwise cmd confuses itself.
- contains($${env}.CONFIG, prepend): infix = ;%$$name:)=^)%
- else: infix =
+ value ~= s,\\^,^^^^,g
+ value ~= s,!,^^!,g
value ~= s,\\),^),g
- val = "(set $$name=$$join(value, ;)$$infix) &"
- }
- isEmpty(3): !contains(TEMPLATE, vc.*) {
- contains(MAKEFILE_GENERATOR, MS.*): val ~= s,%,%%,g
- val ~= s,\\\$,\$\$,g
+ contains(config, prepend) {
+ batch_sets += \
+ "if defined $$name (" \
+ " set $$name=$$join(value, ;);!$$name!" \
+ ") else (" \
+ " set $$name=$$join(value, ;)" \
+ ")"
+ } else: contains(config, always_prepend) {
+ batch_sets += "(set $$name=$$join(value, ;);!$$name!)"
+ } else {
+ batch_sets += "(set $$name=$$join(value, ;))"
+ }
}
- $$1 = "$$val $$eval($$1)"
}
}
+ !isEmpty(batch_sets) {
+ batch_name = wrapper
+ !isEmpty(QT_TOOL_NAME): batch_name = $${QT_TOOL_NAME}_wrapper
+ cmd = $$eval($$1)
+ !isEmpty(cmd): cmd = "$$cmd "
+ equals(ds, /) {
+ batch_name = $${batch_name}.sh
+ batch_cont = \
+ "$$LITERAL_HASH!/bin/sh" \
+ $$batch_sets \
+ "exec $$cmd\"$@\""
+ # It would be nicer to use the '.' command (without 'exec' above),
+ # but that doesn't set the positional arguments under (d)ash.
+ $$1 =
+ } else {
+ batch_name = $${batch_name}.bat
+ batch_cont = \
+ "@echo off" \
+ "SetLocal EnableDelayedExpansion" \
+ $$batch_sets \
+ "$$cmd%*" \
+ "EndLocal"
+ $$1 = call
+ }
+ !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error("Aborting.")
+ isEmpty(3): \
+ $$1 += $$shell_quote($$shell_path($$OUT_PWD/$$batch_name))
+ else: \
+ $$1 += $$system_quote($$system_path($$OUT_PWD/$$batch_name))
+ QMAKE_DISTCLEAN += $$OUT_PWD/$$batch_name
+ }
export($$1)
+ export(QMAKE_DISTCLEAN)
}
# target variable, dependency var name, [non-empty: prepare for system(), not make]
@@ -120,9 +165,9 @@ defineTest(qtAddTargetEnv) {
deps = $$replace($$2, -private$, _private)
deps = $$resolve_depends(deps, "QT.", ".depends" ".run_depends")
!isEmpty(deps) {
- libs = libs
+ deppath.CONFIG = prepend
equals(QMAKE_HOST.os, Windows) {
- libs = bins
+ deppath.CONFIG = always_prepend
deppath.name = PATH
} else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) {
deppath.name = LD_LIBRARY_PATH
@@ -141,13 +186,12 @@ defineTest(qtAddTargetEnv) {
ptypes =
for(dep, deps) {
isEmpty(3): \
- deppath += $$shell_path($$eval(QT.$${dep}.$$libs))
+ deppath += $$shell_path($$eval(QT.$${dep}.libs))
else: \
- deppath += $$system_path($$eval(QT.$${dep}.$$libs))
+ deppath += $$system_path($$eval(QT.$${dep}.libs))
ptypes += $$eval(QT.$${dep}.plugin_types)
}
deppath.value = $$unique(deppath)
- deppath.CONFIG = prepend
pluginpath.value =
ppaths = $$[QT_INSTALL_PLUGINS/get]