-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
249 lines (227 loc) · 10.4 KB
/
Copy pathdeploy.ps1
File metadata and controls
249 lines (227 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
###########################################################################
# Project TupiTube Server #
# Project Contact: info@tupitube.com #
# Project Website: http://www.tupitube.com #
# #
# License: GNU General Public License v2 #
###########################################################################
#
# deploy.ps1 - Post-build deployment script for TupiTube Server (Windows)
#
# Run this AFTER a successful build (make) to collect all runtime
# dependencies into bin\ and prepare the directory for InnoSetup.
#
# Usage:
# .\deploy.ps1 [-TupitubeDir <path>] [-QtDir <path>] [-FfmpegDir <path>] [-QuazipDir <path>]
#
# Parameters:
# -TupitubeDir Path to the TupiTube Desk source tree (same value as
# configure.ps1 -TupitubeDir; default: C:\devel\sources\tupitube.desk)
# -QtDir Qt 5.15 MinGW-64 kit root
# (default: C:\devel\Qt\5.15.2\mingw81_64)
# -FfmpegDir FFmpeg root directory (default: C:\ffmpeg)
# -QuazipDir QuaZip root directory (default: C:\Quazip)
# -SndfileDir libsndfile root directory (default: C:\devel\sources\libsndfile)
param(
[Parameter(HelpMessage = "Path to the TupiTube Desk source tree")]
[string]$TupitubeDir = "C:\devel\sources\tupitube.desk",
[Parameter(HelpMessage = "Qt 5.15 MinGW-64 kit root")]
[string]$QtDir = "C:\devel\Qt\5.15.2\mingw81_64",
[Parameter(HelpMessage = "FFmpeg root directory")]
[string]$FfmpegDir = "C:\ffmpeg",
[Parameter(HelpMessage = "QuaZip root directory")]
[string]$QuazipDir = "C:\Quazip",
[Parameter(HelpMessage = "libsndfile root directory")]
[string]$SndfileDir = "C:\devel\sources\libsndfile"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$projectRoot = $PSScriptRoot
$binDir = Join-Path $projectRoot "bin"
$serverExe = Join-Path $binDir "tupitube.server.exe"
Write-Host ""
Write-Host "TupiTube Server - Windows Deploy"
Write-Host "================================`n"
# ---------------------------------------------------------------------------
# Verify the binary exists
# ---------------------------------------------------------------------------
if (-not (Test-Path $serverExe)) {
Write-Error "Binary not found: $serverExe`nBuild the project first with: make -j4"
exit 1
}
Write-Host "Binary found ............. $serverExe"
# ---------------------------------------------------------------------------
# Validate TupiTube Desk source tree
# ---------------------------------------------------------------------------
if (-not (Test-Path $TupitubeDir)) {
Write-Error "TupiTube Desk source tree not found: $TupitubeDir"
exit 1
}
# ---------------------------------------------------------------------------
# Validate Qt directory
# ---------------------------------------------------------------------------
$qtBinDir = Join-Path $QtDir "bin"
if (-not (Test-Path $qtBinDir)) {
Write-Error "Qt bin directory not found: $qtBinDir"
exit 1
}
# Add Qt bin to PATH for windeployqt / lrelease
$env:PATH = "$qtBinDir;$env:PATH"
# ---------------------------------------------------------------------------
# Step 1: Copy TupiTube Desk runtime DLLs into bin\
# These are the specific DLLs the server links against, sourced directly
# from the source tree's release/ directories (not from the installed app).
# ---------------------------------------------------------------------------
Write-Host "`n[1/7] Copying TupiTube Desk DLLs..."
$tupiDlls = @(
"src\framework\core\release\tupifwcore.dll",
"src\framework\gui\release\tupifwgui.dll",
"src\libbase\release\tupibase.dll",
"src\store\release\tupistore.dll",
"src\libtupi\release\tupi.dll"
)
$copiedCount = 0
foreach ($rel in $tupiDlls) {
$src = Join-Path $TupitubeDir $rel
if (Test-Path $src) {
Copy-Item $src -Destination $binDir -Force
$copiedCount++
} else {
Write-Warning "DLL not found (build TupiTube Desk first?): $src"
}
}
Write-Host " $copiedCount of $($tupiDlls.Count) TupiTube Desk DLL(s) copied"
# Copy tupiffmpegplugin.dll into bin\plugins\ so the server's QPluginLoader
# can find it at runtime (PLUGINS_DIR = <exe dir>/plugins on Windows).
$srcPlugin = Join-Path $TupitubeDir "src\plugins\export\ffmpegplugin\release\tupiffmpegplugin.dll"
if (Test-Path $srcPlugin) {
$destPluginsDir = Join-Path $binDir "plugins"
New-Item -ItemType Directory -Path $destPluginsDir -Force | Out-Null
Copy-Item $srcPlugin -Destination $destPluginsDir -Force
Write-Host " Copied tupiffmpegplugin.dll -> bin\plugins\"
} else {
Write-Warning "tupiffmpegplugin.dll not found: $srcPlugin`n Build TupiTube Desk ffmpegplugin first."
}
# ---------------------------------------------------------------------------
# Step 2: Copy sndfile runtime DLL (required by tupifwcore.dll)
# ---------------------------------------------------------------------------
Write-Host "`n[2/7] Copying sndfile DLL..."
$sndfileBinDir = Join-Path $SndfileDir "bin"
$sndfileDll = Join-Path $sndfileBinDir "sndfile.dll"
if (-not (Test-Path $sndfileDll)) {
Write-Error "sndfile.dll not found: $sndfileDll`nCheck your -SndfileDir parameter."
exit 1
}
Copy-Item $sndfileDll -Destination $binDir -Force
Write-Host " Copied sndfile.dll -> bin\"
# ---------------------------------------------------------------------------
# Step 3: Copy FFmpeg runtime DLLs
# ---------------------------------------------------------------------------
Write-Host "`n[3/7] Copying FFmpeg DLLs..."
$ffmpegBinDir = Join-Path $FfmpegDir "bin"
if (-not (Test-Path $ffmpegBinDir)) {
Write-Error "FFmpeg bin directory not found: $ffmpegBinDir`nCheck your -FfmpegDir parameter."
exit 1
}
$ffmpegDlls = @(
"avutil-59.dll",
"avcodec-61.dll",
"avformat-61.dll",
"avdevice-61.dll",
"avfilter-10.dll",
"postproc-58.dll",
"swresample-5.dll",
"swscale-8.dll"
)
$copiedCount = 0
foreach ($dll in $ffmpegDlls) {
$src = Join-Path $ffmpegBinDir $dll
if (Test-Path $src) {
Copy-Item $src -Destination $binDir -Force
$copiedCount++
} else {
Write-Warning "FFmpeg DLL not found: $src"
}
}
Write-Host " $copiedCount of $($ffmpegDlls.Count) FFmpeg DLL(s) copied"
# ---------------------------------------------------------------------------
# Step 4: Copy QuaZip runtime DLL
# ---------------------------------------------------------------------------
Write-Host "`n[4/7] Copying QuaZip DLL..."
$quazipBinDir = Join-Path $QuazipDir "bin"
$quazipDll = Join-Path $quazipBinDir "libquazip1-qt5.dll"
if (-not (Test-Path $quazipDll)) {
Write-Error "QuaZip DLL not found: $quazipDll`nCheck your -QuazipDir parameter."
exit 1
}
Copy-Item $quazipDll -Destination $binDir -Force
Write-Host " Copied libquazip1-qt5.dll -> bin\"
# ---------------------------------------------------------------------------
# Step 5: Copy Qt5Sql.dll (not shipped with TupiTube Desk)
# ---------------------------------------------------------------------------
Write-Host "`n[5/7] Copying Qt5Sql.dll..."
$qt5SqlSrc = Join-Path $QtDir "bin\Qt5Sql.dll"
if (-not (Test-Path $qt5SqlSrc)) {
Write-Error "Qt5Sql.dll not found at: $qt5SqlSrc`nCheck your -QtDir parameter."
exit 1
}
Copy-Item $qt5SqlSrc -Destination $binDir -Force
Write-Host " Copied Qt5Sql.dll -> bin\"
# ---------------------------------------------------------------------------
# Step 6: Copy sqldrivers\qsqlite.dll (not shipped with TupiTube Desk)
# ---------------------------------------------------------------------------
Write-Host "`n[6/7] Copying sqldrivers\qsqlite.dll..."
$qsqliteSrc = Join-Path $QtDir "plugins\sqldrivers\qsqlite.dll"
if (-not (Test-Path $qsqliteSrc)) {
Write-Error "qsqlite.dll not found at: $qsqliteSrc`nCheck your -QtDir parameter."
exit 1
}
$sqldriversDest = Join-Path $binDir "sqldrivers"
New-Item -ItemType Directory -Path $sqldriversDest -Force | Out-Null
Copy-Item $qsqliteSrc -Destination $sqldriversDest -Force
Write-Host " Copied qsqlite.dll -> bin\sqldrivers\"
# ---------------------------------------------------------------------------
# Step 7: Run windeployqt to collect remaining Qt runtime dependencies
# Runs after our manual copies so windeployqt sees the full dependency set.
# Qt 5.15.2 MinGW windeployqt may report "Unable to find the platform plugin"
# and exit with code 1 even when it deploys successfully; we copy
# platforms\qwindows.dll explicitly as a safety net and treat that specific
# failure as a non-fatal warning.
# ---------------------------------------------------------------------------
Write-Host "`n[7/7] Running windeployqt..."
$windeployqt = Join-Path $qtBinDir "windeployqt.exe"
if (-not (Test-Path $windeployqt)) {
Write-Error "windeployqt.exe not found at: $windeployqt"
exit 1
}
# Ensure platforms\qwindows.dll is present regardless of windeployqt behaviour
$qwindowsSrc = Join-Path $QtDir "plugins\platforms\qwindows.dll"
$platformsDest = Join-Path $binDir "platforms"
if (Test-Path $qwindowsSrc) {
New-Item -ItemType Directory -Path $platformsDest -Force | Out-Null
Copy-Item $qwindowsSrc -Destination $platformsDest -Force
Write-Host " Pre-copied platforms\qwindows.dll -> bin\platforms\"
} else {
Write-Warning "qwindows.dll not found at: $qwindowsSrc"
}
& $windeployqt --release $serverExe
if ($LASTEXITCODE -ne 0) {
Write-Warning "windeployqt exited with code $LASTEXITCODE (platform-plugin false positive is common with Qt 5.15.2 MinGW; verifying critical files...)"
if (-not (Test-Path (Join-Path $platformsDest "qwindows.dll"))) {
Write-Error "platforms\qwindows.dll is missing after windeployqt - deployment incomplete."
exit 1
}
Write-Host " Critical platform plugin present. Continuing."
}
# ---------------------------------------------------------------------------
# Summary
# ---------------------------------------------------------------------------
$fileCount = (Get-ChildItem -Path $binDir -Recurse -File).Count
Write-Host ""
Write-Host "Deployment complete."
Write-Host "----------------------------------------------------"
Write-Host "bin\ now contains $fileCount file(s) and is ready for InnoSetup."
Write-Host ""
Write-Host "Build installer with:"
Write-Host " `"C:\Program Files (x86)\Inno Setup 6\iscc.exe`" installer\tupitube_server.iss"
Write-Host ""