build: fix Windows packaging to produce the NSIS installer

The bundling loop ran under set -euo pipefail; once no new /mingw64 deps
remained, grep exited 1 and aborted the script before makensis ran, so no
Setup.exe was produced. Disable strict mode in that subshell and collect
deps before copying. Anchor all installer source paths to the script dir
via ${__FILEDIR__} and switch the File glob to "\*" so extensionless files
and plugin subfolders are included.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tronax 2026-06-15 03:04:49 +02:00
parent 7a4f3f312b
commit 83a26ef0cf
Signed by: Tronax
SSH key fingerprint: SHA256:2pKKXDZucWvaF/GzXNz0FY53EAO1YDLN80bqS+TTz/o
2 changed files with 18 additions and 9 deletions

View file

@ -62,14 +62,17 @@ echo "==> Bundling MinGW runtime + transitive dependencies"
# repeat a few passes so transitive deps (incl. those of the deployed plugins)
# are all picked up.
( cd "$DIST_DIR"
# Disable strict mode here: once everything is copied, grep finds no new
# /mingw64 deps and returns 1, which would otherwise abort the whole script.
set +e +o pipefail
for _ in $(seq 1 6); do
find . \( -name '*.exe' -o -name '*.dll' \) -print0 \
deps="$(find . \( -name '*.exe' -o -name '*.dll' \) -print0 \
| xargs -0 -I{} ldd "{}" 2>/dev/null \
| grep -io '/mingw64/bin/[^ ]*\.dll' \
| sort -u \
| while read -r f; do
[ -e "./$(basename "$f")" ] || cp "$f" .
done
| sort -u)"
for f in $deps; do
[ -e "./$(basename "$f")" ] || cp "$f" .
done
done
)

View file

@ -14,8 +14,12 @@ Unicode true
!include "MUI2.nsh"
; Anchor all source paths to this script's own directory so makensis works
; regardless of the current working directory it is invoked from.
!define ROOT "${__FILEDIR__}"
Name "${APPNAME}"
OutFile "UltimateMediaTracker-Setup.exe"
OutFile "${ROOT}\UltimateMediaTracker-Setup.exe"
InstallDir "$PROGRAMFILES64\${APPNAME}"
InstallDirRegKey HKLM "Software\${APPNAME}" "InstallDir"
RequestExecutionLevel admin
@ -27,8 +31,8 @@ VIAddVersionKey "FileVersion" "${VERSION}"
VIAddVersionKey "FileDescription" "${APPNAME} Installer"
VIAddVersionKey "LegalCopyright" "${COMPANY}"
!define MUI_ICON "resources\icons\appicon.ico"
!define MUI_UNICON "resources\icons\appicon.ico"
!define MUI_ICON "${ROOT}\resources\icons\appicon.ico"
!define MUI_UNICON "${ROOT}\resources\icons\appicon.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
@ -45,7 +49,9 @@ VIAddVersionKey "LegalCopyright" "${COMPANY}"
Section "Install"
SetOutPath "$INSTDIR"
File /r "${SOURCEDIR}\*.*"
; "\*" (not "*.*") also grabs extensionless files and all subfolders
; (platforms\, tls\, sqldrivers\, imageformats\, iconengines\ ...).
File /r "${ROOT}\${SOURCEDIR}\*"
; Shortcuts
CreateDirectory "$SMPROGRAMS\${APPNAME}"