assemble the complete tool commands already in qt_tool.prf
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Wed, 8 Aug 2012 09:33:26 +0000 (11:33 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 10 Aug 2012 22:41:07 +0000 (00:41 +0200)
this saves some repeated calculations. also, it's nicer to have most
logic in one place.

Change-Id: Iea362d40f5e6203709ced94d29ca61a4163b8e69
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
mkspecs/features/qt_functions.prf
mkspecs/features/qt_tool.prf

index 2246551..82916ff 100644 (file)
@@ -155,7 +155,7 @@ defineTest(qtAddModules) {
 
 # variable, default
 defineTest(qtPrepareTool) {
-    $$1 = $$eval(QT_TOOL.$${2}.binary)
+    $$1 = $$eval(QT_TOOL.$${2}.command)
     isEmpty($$1) {
         MODBASE = $$[QT_HOST_BINS/get]
         count(ARGS, 2, greaterThan) {
@@ -175,30 +175,8 @@ defineTest(qtPrepareTool) {
                 $$1 = $$BUNDLENAME
             }
         }
+        $$1 = $$shell_path($$eval($$1))
     }
-    $$1 = $$shell_path($$eval($$1))
-
-    deps = $$resolve_depends(QT_TOOL.$${2}.depends, "QT.")
-    !isEmpty(deps) {
-        for(dep, deps): \
-            deppath += $$shell_path($$eval(QT.$${dep}.libs))
-        deppath = $$unique(deppath)
-        equals(QMAKE_DIR_SEP, /) {
-            equals(QMAKE_HOST.os, Windows): \
-                var = PATH
-            else:contains(QMAKE_HOST.os, Linux): \
-                var = LD_LIBRARY_PATH
-            else:equals(QMAKE_HOST.os, Darwin): \
-                var = DYLD_LIBRARY_PATH
-            else: \
-                error("Operating system not supported.")
-            $$1 = "$$var=$$join(deppath, :)${$$var:+:\$$$var} $$eval($$1)"
-        } else {
-            # Escape closing parens when expanding %PATH%, otherwise cmd confuses itself.
-            $$1 = "(set PATH=$$join(deppath, ;);%PATH:)=^)%) & $$eval($$1)"
-        }
-    }
-
     export($$1)
 }
 
index 69a303f..f1555de 100644 (file)
@@ -35,12 +35,32 @@ INSTALLS += target
     isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
 
     load(resolve_target)
+    cmd = $$shell_path($$QMAKE_RESOLVED_TARGET)
+    deps = $$resolve_depends(QT, "QT.")
+    !isEmpty(deps) {
+        for(dep, deps) {
+            deppath += $$shell_path($$eval(QT.$${dep}.libs))
+        }
+        deppath = $$unique(deppath)
+        equals(QMAKE_DIR_SEP, /) {
+            equals(QMAKE_HOST.os, Windows): \
+                var = PATH
+            else:contains(QMAKE_HOST.os, Linux): \
+                var = LD_LIBRARY_PATH
+            else:equals(QMAKE_HOST.os, Darwin): \
+                var = DYLD_LIBRARY_PATH
+            else: \
+                error("Operating system not supported.")
+            cmd = "$$var=$$join(deppath, :)${$$var:+:\$$$var} $$cmd"
+        } else {
+            # Escape closing parens when expanding %PATH%, otherwise cmd confuses itself.
+            cmd = "(set PATH=$$join(deppath, ;);%PATH:)=^)%) & $$cmd"
+        }
+    }
 
     TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_$${MODULE}.pri
 
-    TOOL_PRI_CONT = \
-        "QT_TOOL.$${MODULE}.binary = $$QMAKE_RESOLVED_TARGET" \
-        "QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")"
+    TOOL_PRI_CONT = "QT_TOOL.$${MODULE}.command = $$val_escape(cmd)"
     write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")
 
     # Then, inject the new tool into the current cache state