Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / packaging / nsis / windeployqt-to-nsis.ps1
blob14883f1a3a19d204f3cfbc00048abe630742150e
1 # windeployqt-to-nsh
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
14 #requires -version 2
17 .SYNOPSIS
18 Creates NSIS "File" function calls required for Qt packaging.
20 .DESCRIPTION
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.
27 .PARAMETER Executable
28 The path to a Qt application. It will be examined for dependent DLLs.
30 .PARAMETER FilePath
31 Output filename.
33 .PARAMETER DebugConfig
34 Assume debug binaries.
36 .INPUTS
37 -Executable Path to the Qt application.
38 -FilePath Output NSIS file.
40 .OUTPUTS
41 List of NSIS commands required to package supporting DLLs.
43 .EXAMPLE
44 C:\PS> .\windeployqt-to-nsis.ps1 windeployqt.exe ..\..\staging\wireshark.exe wireshark-qt-manifest.nsh [-DebugConfig]
47 Param(
48 [Parameter(Mandatory=$true, Position=0)]
49 [String] $Executable,
51 [Parameter(Position=1)]
52 [String] $FilePath = "wireshark-qt-manifest.nsh",
54 [Parameter(Mandatory=$false)]
55 [Switch] $DebugConfig
59 try {
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 `
73 $DebugOrRelease `
74 --no-compiler-runtime `
75 --no-translations `
76 --list relative `
77 $Executable
79 $basePath = Split-Path -Parent $Executable
81 $currentDir = ""
83 foreach ($entry in $wdqtList) {
84 $dir = Split-Path -Parent $entry
85 if ($dir -and $dir -ne $currentDir) {
86 $nsisCommands += "SetOutPath `"`$INSTDIR\$dir`""
87 $currentDir = $dir
89 $nsisCommands += "File `"$basePath\$entry`""
93 catch {
95 $nsisCommands = @"
96 # Qt not configured
102 Set-Content $FilePath @"
104 # Automatically generated by $($MyInvocation.MyCommand.Name)
108 Add-Content $FilePath $nsisCommands