summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/nsis/Makefile.nmake22
-rw-r--r--packaging/nsis/windeployqt-to-nsis.ps1103
2 files changed, 74 insertions, 51 deletions
diff --git a/packaging/nsis/Makefile.nmake b/packaging/nsis/Makefile.nmake
index e61e89a7e1..0e44a15ecb 100644
--- a/packaging/nsis/Makefile.nmake
+++ b/packaging/nsis/Makefile.nmake
@@ -232,26 +232,12 @@ NSIS_FLAGS=\
wireshark.nsi: qt-dll-manifest.nsh
qt-dll-manifest.nsh: windeployqt-to-nsis.ps1 Makefile.nmake
-!IF EXIST("$(QT5_BASE_DIR)\bin\windeployqt.exe")
+!IF EXIST("$(QT5_BASE_DIR)\bin\qmake.exe")
set PATH=%PATH%;$(QT5_BASE_DIR)\bin
- $(POWERSHELL) windeployqt-to-nsis.ps1 \
- windeployqt.exe ..\..\wireshark-qt-release\qtshark.exe $@
-!ELSE IF EXIST("..\..\wireshark-qt-release\Qt5Core.dll")
- type << > $@
-File "..\..\wireshark-qt-release\Qt5Core.dll"
-File "..\..\wireshark-qt-release\Qt5Gui.dll"
-File "..\..\wireshark-qt-release\Qt5Widgets.dll"
-File "..\..\wireshark-qt-release\Qt5PrintSupport.dll"
-File "..\..\wireshark-qt-release\platforms\qwindows.dll"
-<<
-!ELSE IF EXIST("..\..\wireshark-qt-release\QtCore4.dll")
- type << > $@
-File "..\..\wireshark-qt-release\QtCore4.dll"
-File "..\..\wireshark-qt-release\QtGui4.dll"
-<<
-!ELSE
- copy nul $@ /y
!ENDIF
+ $(POWERSHELL) windeployqt-to-nsis.ps1 \
+ -Executable ..\..\wireshark-qt-release\qtshark.exe \
+ -FilePath $@
$(STAGING_DIR)\uninstall.exe : $(NSI)
rm -f $(UNINSTALL_INSTALLER)
diff --git a/packaging/nsis/windeployqt-to-nsis.ps1 b/packaging/nsis/windeployqt-to-nsis.ps1
index 8fe9d965f4..530d2785c2 100644
--- a/packaging/nsis/windeployqt-to-nsis.ps1
+++ b/packaging/nsis/windeployqt-to-nsis.ps1
@@ -27,16 +27,22 @@
<#
.SYNOPSIS
-Convert the output of windeployqt to an equivalent set of NSIS "File"
-function calls.
+Creates NSIS "File" function calls required for Qt packaging.
.DESCRIPTION
-This script reads the output of Qt's "windeployqt" utility and converts it to a
-set of file packaging commands suitable for use with NSIS. Windeployqt lists the
-DLLs required to run a Qt application. It ships with Qt 5.2 and later.
+This script creates an NSIS-compatible file based on the following Qt
+versions:
-.PARAMETER Windeployqt
-Specifies the path to the windeployqt utility.
+ - 5.3 and later: A list of DLLs and directories based on the output of the
+ "windeployqt" utility. Windeployqt lists the DLLs required to run a Qt
+ application. (The initial version that shipped with Qt 5.2 is unusable.)
+
+ - 5.2 and earlier: A hard-coded list of Qt DLLs and directories appropriate
+ for earlier Qt versions.
+
+ - None: A dummy file.
+
+If building with Qt, QMake must be in your PATH.
.PARAMETER Executable
The path to a Qt application. It will be examined for dependent DLLs.
@@ -45,7 +51,6 @@ The path to a Qt application. It will be examined for dependent DLLs.
Output filename.
.INPUTS
--Windeployqt Path to the windeployqt utility.
-Executable Path to the Qt application.
-FilePath Output NSIS file.
@@ -58,36 +63,74 @@ C:\PS> .\windeployqt-to-nsis.ps1 windeployqt.exe ..\..\staging\wireshark.exe qt-
Param(
[Parameter(Mandatory=$true, Position=0)]
- [String] $Windeployqt,
-
- [Parameter(Mandatory=$true, Position=1)]
[String] $Executable,
- [Parameter(Position=2)]
+ [Parameter(Position=1)]
[String] $FilePath = "qt-dll-manifest.nsh"
)
-$wdqtList = & $Windeployqt `
- --release `
- --no-compiler-runtime `
- --list relative `
- $Executable
-$dllPath = Split-Path -Parent $Executable
+try {
+ $qtVersion = [version](qmake -query QT_VERSION)
+ $nsisCommands = @("# Qt version " + $qtVersion ; "#")
+
+ if ($qtVersion -ge "5.3") {
+ # Qt 5.3 or later. Windeployqt is present and works
+
+ $wdqtList = windeployqt `
+ --release `
+ --no-compiler-runtime `
+ --list relative `
+ $Executable
+
+ $dllPath = Split-Path -Parent $Executable
+
+ $dllList = @()
+ $dirList = @()
+
+ foreach ($entry in $wdqtList) {
+ $dir = Split-Path -Parent $entry
+ if ($dir) {
+ $dirList += "File /r `"$dllPath\$dir`""
+ } else {
+ $dllList += "File `"$dllPath\$entry`""
+ }
+ }
+
+ $dirList = $dirList | Sort-Object | Get-Unique
+
+ $nsisCommands += $dllList + $dirList
+
+ } elseif ($qtVersion -ge "5.0") {
+ # Qt 5.0 - 5.2. Windeployqt is buggy or not present
-$dllList = @()
-$dirList = @()
+ $nsisCommands += @"
+File "..\..\wireshark-qt-release\Qt5Core.dll"
+File "..\..\wireshark-qt-release\Qt5Gui.dll"
+File "..\..\wireshark-qt-release\Qt5Widgets.dll"
+File "..\..\wireshark-qt-release\Qt5PrintSupport.dll"
+File /r "..\..\wireshark-qt-release\platforms"
+"@
-foreach ($entry in $wdqtList) {
- $dir = Split-Path -Parent $entry
- if ($dir) {
- $dirList += $dir
} else {
- $dllList += $entry
+ # Assume Qt 4
+
+ $nsisCommands += @"
+File "..\..\wireshark-qt-release\QtCore4.dll"
+File "..\..\wireshark-qt-release\QtGui4.dll"
+"@
+
}
}
-$dirList = $dirList | Sort-Object | Get-Unique
+catch {
+
+ $nsisCommands = @"
+# Qt not configured
+#
+"@
+
+}
Set-Content $FilePath @"
#
@@ -95,10 +138,4 @@ Set-Content $FilePath @"
#
"@
-foreach ($entry in $dllList) {
- Add-Content $FilePath "File `"$dllPath\$entry`""
-}
-
-foreach ($entry in $dirList) {
- Add-Content $FilePath "File /r `"$dllPath\$entry`""
-}
+Add-Content $FilePath $nsisCommands \ No newline at end of file