aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/nsis
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2023-05-29 19:06:51 +0100
committerJoão Valverde <j@v6e.pt>2023-05-30 13:36:19 +0000
commit95355bd165771ea05ab1b4ff9c388a0d23e864d3 (patch)
tree815081a4d6e13d6384f87a398463617f24817d6f /packaging/nsis
parent6789e8710643e61ecee285334a6d1d34a0db6b0e (diff)
NSIS: Deploy Qt DLLs when cross-compiling
Deploy Qt DLLs when cross compiling using MinGW and Fedora Linux. Currently the DLLs are read from a text file because windeployqt in not available when cross-compiling from Linux. The windeployqt-to-nsis.py script is modified to accept a text file static mapping instead of invoking windeployqt. We need to manually copy the Qt translation files, a task that is also usually performed by windeployqt. Fix some missing MinGW DLL dependencies (opus, winpthread).
Diffstat (limited to 'packaging/nsis')
-rw-r--r--packaging/nsis/CMakeLists.txt16
-rw-r--r--packaging/nsis/InstallMinGW.cmake3
-rw-r--r--packaging/nsis/mingw64-qt-mapping.txt30
-rw-r--r--packaging/nsis/windeployqt-to-nsis.py62
4 files changed, 86 insertions, 25 deletions
diff --git a/packaging/nsis/CMakeLists.txt b/packaging/nsis/CMakeLists.txt
index a068bdccd8..7a11d99d31 100644
--- a/packaging/nsis/CMakeLists.txt
+++ b/packaging/nsis/CMakeLists.txt
@@ -305,14 +305,26 @@ macro( ADD_NSIS_PACKAGE_TARGETS )
$<$<CONFIG:Debug>:-DebugConfig>
DEPENDS "${_nsis_source_dir}/windeployqt-to-nsis.ps1"
)
- else()
+ elseif(HAVE_MSYSTEM)
add_custom_command(OUTPUT ${_nsis_binary_dir}/wireshark-qt-manifest.nsh
COMMAND ${Python3_EXECUTABLE} "${_nsis_source_dir}/windeployqt-to-nsis.py"
- $<TARGET_FILE:wireshark>
+ --executable $<TARGET_FILE:wireshark>
${_nsis_binary_dir}/wireshark-qt-manifest.nsh
#$<$<CONFIG:Debug>:-DebugConfig>
DEPENDS "${_nsis_source_dir}/windeployqt-to-nsis.py"
)
+ elseif(MINGW AND CMAKE_CROSSCOMPILING)
+ add_custom_command(OUTPUT ${_nsis_binary_dir}/wireshark-qt-manifest.nsh
+ COMMAND ${Python3_EXECUTABLE} "${_nsis_source_dir}/windeployqt-to-nsis.py"
+ --mapping "${_nsis_source_dir}/mingw64-qt-mapping.txt"
+ ${_nsis_binary_dir}/wireshark-qt-manifest.nsh
+ #$<$<CONFIG:Debug>:-DebugConfig>
+ DEPENDS
+ "${_nsis_source_dir}/windeployqt-to-nsis.py"
+ "${_nsis_source_dir}/mingw64-qt-mapping.txt"
+ )
+ else()
+ message(FATAL_ERROR "Unknown Qt deployment method")
endif()
endif()
diff --git a/packaging/nsis/InstallMinGW.cmake b/packaging/nsis/InstallMinGW.cmake
index 1d8b985549..9c6760346b 100644
--- a/packaging/nsis/InstallMinGW.cmake
+++ b/packaging/nsis/InstallMinGW.cmake
@@ -30,6 +30,7 @@ if(MINGW AND NOT USE_MSYSTEM)
${MINGW_BIN}/liblzma-5.dll
${MINGW_BIN}/libminizip-3.dll
${MINGW_BIN}/libnettle-8.dll
+ ${MINGW_BIN}/libopus-0.dll
${MINGW_BIN}/libp11-kit-0.dll
${MINGW_BIN}/libpcre2-16-0.dll
${MINGW_BIN}/libpcre2-8-0.dll
@@ -37,8 +38,8 @@ if(MINGW AND NOT USE_MSYSTEM)
${MINGW_BIN}/libspeexdsp-1.dll
${MINGW_BIN}/libssp-0.dll
${MINGW_BIN}/libstdc++-6.dll
- ${MINGW_BIN}/libstdc++-6.dll
${MINGW_BIN}/libtasn1-6.dll
+ ${MINGW_BIN}/libwinpthread-1.dll
${MINGW_BIN}/libxml2-2.dll
${MINGW_BIN}/libzstd.dll
${MINGW_BIN}/zlib1.dll
diff --git a/packaging/nsis/mingw64-qt-mapping.txt b/packaging/nsis/mingw64-qt-mapping.txt
new file mode 100644
index 0000000000..7396783e01
--- /dev/null
+++ b/packaging/nsis/mingw64-qt-mapping.txt
@@ -0,0 +1,30 @@
+#
+# Generated by running
+# "windeployqt6.exe --no-compiler-runtime --no-translations --list mapping /path/to/Wireshark.exe"
+# on a Windows machine and editing by hand.
+#
+
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Core.dll" "Qt6Core.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Core5Compat.dll" "Qt6Core5Compat.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Gui.dll" "Qt6Gui.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Multimedia.dll" "Qt6Multimedia.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Network.dll" "Qt6Network.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6PrintSupport.dll" "Qt6PrintSupport.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Svg.dll" "Qt6Svg.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/Qt6Widgets.dll" "Qt6Widgets.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/opengl32sw.dll" "opengl32sw.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/bin/D3Dcompiler_47.dll" "D3Dcompiler_47.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/generic/qtuiotouchplugin.dll" "generic/qtuiotouchplugin.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/iconengines/qsvgicon.dll" "iconengines/qsvgicon.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/imageformats/qgif.dll" "imageformats/qgif.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/imageformats/qico.dll" "imageformats/qico.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/imageformats/qjpeg.dll" "imageformats/qjpeg.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/imageformats/qsvg.dll" "imageformats/qsvg.dll"
+#"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/multimedia/ffmpegmediaplugin.dll" "multimedia/ffmpegmediaplugin.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/multimedia/windowsmediaplugin.dll" "multimedia/windowsmediaplugin.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/networkinformation/qnetworklistmanager.dll" "networkinformation/qnetworklistmanager.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/platforms/qwindows.dll" "platforms/qwindows.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/styles/qwindowsvistastyle.dll" "styles/qwindowsvistastyle.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/tls/qcertonlybackend.dll" "tls/qcertonlybackend.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/tls/qopensslbackend.dll" "tls/qopensslbackend.dll"
+"/usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt6/plugins/tls/qschannelbackend.dll" "tls/qschannelbackend.dll"
diff --git a/packaging/nsis/windeployqt-to-nsis.py b/packaging/nsis/windeployqt-to-nsis.py
index 1c5d9dcd02..85e9037b00 100644
--- a/packaging/nsis/windeployqt-to-nsis.py
+++ b/packaging/nsis/windeployqt-to-nsis.py
@@ -17,42 +17,60 @@
import sys
import os
+import argparse
import subprocess
-EXECUTABLE = sys.argv[1]
-OUTFILE = sys.argv[2]
+parser = argparse.ArgumentParser()
+group = parser.add_mutually_exclusive_group(required=True)
+group.add_argument('--mapping')
+group.add_argument('--executable')
+parser.add_argument('outfile')
+args = parser.parse_args()
-# Qt version
-qmake_out = subprocess.run("qmake6 -query QT_VERSION", shell=True, check=True, capture_output=True, encoding="utf-8")
-qt_version = qmake_out.stdout.strip()
+if args.mapping:
+ qt_version = None
+ with open(args.mapping, 'r', encoding='utf-8') as f:
+ out = f.read()
+else:
+ # Qt version
+ qmake_command = [
+ 'qmake6.exe',
+ '-query', 'QT_VERSION'
+ ]
+ qmake_out = subprocess.run(qmake_command, check=True, capture_output=True, encoding="utf-8")
+ qt_version = qmake_out.stdout.strip()
-# XXX The powershell script asserts that the Qt version is greater than 5.3. We already require Qt6 to build the
-# installer using MSYS2 (currently not enforced).
+ # XXX The powershell script asserts that the Qt version is greater than 5.3. We already require Qt6 to build the
+ # installer using MSYS2 (currently not enforced).
-# Windeploy output
-windeploy_command = [
- "windeployqt6.exe",
- "--no-compiler-runtime",
- "--no-translations",
- "--list", "mapping",
- EXECUTABLE
-]
+ # Windeployqt output
+ windeploy_command = [
+ "windeployqt6.exe",
+ "--no-compiler-runtime",
+ "--no-translations",
+ "--list", "mapping",
+ args.executable
+ ]
+ out = subprocess.run(windeploy_command, check=True, capture_output=True, encoding="utf-8").stdout
-out = subprocess.run(windeploy_command, shell=True, check=True, capture_output=True, encoding="utf-8")
-
-with open(OUTFILE, 'w') as f:
- command_name = os.path.split(sys.argv[0])[1]
+with open(args.outfile, 'w') as f:
header = """\
#
# Automatically generated by {}
-#
+#""".format(parser.prog)
+
+ if qt_version:
+ header += """\
# Qt version {}
-#""".format(command_name, qt_version)
+#""".format(qt_version)
print(header, file=f)
current_dir = ""
- for line in out.stdout.splitlines():
+ for line in out.splitlines():
+ line = line.strip()
+ if not line or line.startswith('#'):
+ continue
path, relative = line.split(" ")
rel_path = os.path.split(relative)
if len(rel_path) > 1: