[PATCH 5/6] Use wildcards in the NSIS installer rules for Qt DLLs

Thiago Macieira thiago at macieira.org
Wed Nov 27 17:42:49 UTC 2013


That way, the NSIS rules also work for creating an installer for debug
builds. Which you'd do by running:
  make -f Makefile.Debug installer

Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
 packaging/windows/subsurface.nsi.in | 15 ++++-----------
 subsurface-install.pri              | 36 +++++++++++++++++++++++++++++-------
 subsurface.pro                      |  7 ++++++-
 3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/packaging/windows/subsurface.nsi.in b/packaging/windows/subsurface.nsi.in
index c4a5809..ed9c9a8 100644
--- a/packaging/windows/subsurface.nsi.in
+++ b/packaging/windows/subsurface.nsi.in
@@ -103,9 +103,11 @@ Section
     File /r data
     File /r images
     File /r icons
+    File /r plugins
     File iconv.dll
     File libdivecomputer-0.dll
     File libpng15-15.dll
+    File libjpeg-*.dll
     File libusb-1.0.dll
     File libxml2-2.dll
     File libxslt-1.dll
@@ -114,17 +116,8 @@ Section
     File libsqlite3-0.dll
     File libgcc_s_sjlj-1.dll
     File libstdc++-6.dll
-    File QtCore4.dll
-    File QtGui4.dll
-    File QtNetwork4.dll
-    File QtSvg4.dll
-    File QtWebKit4.dll
-    File QtDeclarative4.dll
-    File QtScript4.dll
-    File QtSql4.dll
-    File QtXmlPatterns4.dll
-    File QtXml4.dll
-    File libmarblewidget.dll
+    File libmarblewidget*dll
+    File Qt*4.dll
     File subsurface.ico
 
     # Store installation folder in registry
diff --git a/subsurface-install.pri b/subsurface-install.pri
index 4b06e17..89d1958 100644
--- a/subsurface-install.pri
+++ b/subsurface-install.pri
@@ -55,10 +55,37 @@ mac {
 
     qt_conf.commands = echo \'[Paths]\' > $@
     qt_conf.commands += $${nltab}echo \'Prefix=.\' >> $@
-    qt_conf.commands += $${nltab}echo \'Plugins=.\' >> $@
     qt_conf.target = $$PWD/packaging/windows/qt.conf
     install.depends += qt_conf
 
+    # Plugin code
+    defineTest(deployPlugin) {
+        plugin = $$1
+        plugintype = $$dirname(1)
+        CONFIG(debug, debug|release): plugin = $${plugin}d4.dll
+        else: plugin = $${plugin}4.dll
+
+        abs_plugin = $$[QT_INSTALL_PLUGINS]/$$plugin
+        ABS_DEPLOYMENT_PLUGIN += $$abs_plugin
+        export(ABS_DEPLOYMENT_PLUGIN)
+
+        safe_name = $$replace(1, /, _)
+        INSTALLS += $$safe_name
+
+        # Work around qmake bug in Qt4 that it can't handle $${xx}.yy properly
+        eval(safe_name_files = $${safe_name}.files)
+        eval(safe_name_path = $${safe_name}.path)
+        $$safe_name_files = $$abs_plugin
+        $$safe_name_path = $$WINDOWSSTAGING/plugins/$$plugintype
+        export($$safe_name_files)
+        export($$safe_name_path)
+        export(INSTALLS)
+    }
+    # Convert plugin names to the relative DLL path
+    for(plugin, $$list($$DEPLOYMENT_PLUGIN)) {
+        deployPlugin($$plugin)
+    }
+
     !win32-msvc* {
         #!equals($$QMAKE_HOST.os, "Windows"): dlls.commands += OBJDUMP=`$$QMAKE_CC -dumpmachine`-objdump
         dlls.commands += PATH=\$\$PATH:`$$QMAKE_CC -print-search-dirs | sed -nE \'/^libraries: =/{s///;s,/lib/?(:|\$\$),/bin\\1,g;p;q;}\'`
@@ -68,12 +95,7 @@ mac {
         CONFIG(debug, debug|release): dlls.commands += $$OUT_PWD/debug/subsurface$$EXE_SUFFIX
         else: dlls.commands += $$OUT_PWD/release/$$TARGET$$EXE_SUFFIX
 
-        for(plugin, $$list($$DEPLOYMENT_PLUGIN)) {
-            CONFIG(debug, debug|release): dlls.depends += $$[QT_INSTALL_PLUGINS]/$${plugin}d4.dll
-            else: dlls.depends += $$[QT_INSTALL_PLUGINS]/$${plugin}4.dll
-        }
-
-        dlls.commands += $$LIBS
+        dlls.commands += $$ABS_DEPLOYMENT_PLUGIN $$LIBS
         dlls.commands += | while read name; do $(INSTALL_FILE) \$\$name $$PWD/$$WINDOWSSTAGING; done
         dlls.depends += $(DESTDIR_TARGET)
 
diff --git a/subsurface.pro b/subsurface.pro
index 8754f1d..a84b904 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -175,7 +175,12 @@ XSLT_FILES = xslt
 ICONS_FILES = icons
 DOC_FILES = $$OUT_PWD/Documentation/user-manual.html Documentation/images
 MARBLEDIR = marbledata/maps marbledata/bitmaps
-DEPLOYMENT_PLUGIN += imageformats/qjpeg
+
+#DEPLOYMENT_PLUGIN += bearer/qnativewifibearer
+DEPLOYMENT_PLUGIN += codecs/qcncodecs codecs/qjpcodecs codecs/qkrcodecs codecs/qtwcodecs
+DEPLOYMENT_PLUGIN += imageformats/qgif imageformats/qjpeg imageformats/qsvg
+DEPLOYMENT_PLUGIN += iconengines/qsvgicon
+#DEPLOYMENT_PLUGIN += sqldrivers/qsqlite
 
 # This information will go into the Windows .rc file and linked into the .exe
 QMAKE_TARGET_COMPANY = subsurface team
-- 
1.7.11.7



More information about the subsurface mailing list