3 # Windeployqt-to-nsh - Convert the output of windeployqt to an equivalent set of
4 # NSIS "File" function calls.
6 # Copyright 2014 Gerald Combs <gerald@wireshark.org>
8 # Wireshark - Network traffic analyzer
9 # By Gerald Combs <gerald@wireshark.org>
10 # Copyright 1998 Gerald Combs
12 # SPDX-License-Identifier: GPL-2.0-or-later
18 Creates NSIS
"File" function calls required for Qt packaging
.
21 This script creates an NSIS-compatible file based on the output of
22 windeployqt
. If Qt is present
, version
5.3 or later is required
.
23 Otherwise a dummy file will be created
.
25 If building with Qt
, QMake must be
in your PATH
.
28 The path to a Qt application
. It will be examined for dependent DLLs
.
33 .PARAMETER DebugConfig
34 Assume debug binaries
.
37 -Executable Path to the Qt application
.
38 -FilePath Output NSIS file
.
41 List of NSIS commands required to package supporting DLLs
.
44 C
:\PS
> .\windeployqt-to-nsis
.ps1 windeployqt
.exe
..\
..\staging\wireshark
.exe wireshark-qt-manifest
.nsh
[-DebugConfig
]
48 [Parameter
(Mandatory
=$true, Position
=0)]
51 [Parameter
(Position
=1)]
52 [String
] $FilePath = "wireshark-qt-manifest.nsh",
54 [Parameter
(Mandatory
=$false)]
60 $qtVersion = [version
](qmake
-query QT_VERSION
)
61 $nsisCommands = @
("# Qt version " + $qtVersion ; "#")
63 if ($qtVersion -lt
"5.3") {
64 Throw
"Qt " + $qtVersion + " found. 5.3 or later is required."
67 $DebugOrRelease = If
($DebugConfig) {"--debug"} Else
{"--release"}
69 # windeployqt lists translation files that it don't exist (e.g.
70 # qtbase_ar.qm), so we handle those by hand.
71 # https://bugreports.qt.io/browse/QTBUG-65974
72 $wdqtList = windeployqt `
74 --no-compiler-runtime `
79 $basePath = Split-Path -Parent
$Executable
83 foreach ($entry in $wdqtList) {
84 $dir = Split-Path -Parent
$entry
85 if ($dir -and
$dir -ne
$currentDir) {
86 $nsisCommands += "SetOutPath `"`
$INSTDIR\
$dir`
""
89 $nsisCommands += "File `"$basePath\
$entry`
""
102 Set-Content $FilePath @
"
104 # Automatically generated by $($MyInvocation.MyCommand.Name)
108 Add-Content $FilePath $nsisCommands