From 83a26ef0cf4493d7a87906b2a83520d49a5c2336 Mon Sep 17 00:00:00 2001 From: Tronax Date: Mon, 15 Jun 2026 03:04:49 +0200 Subject: [PATCH] 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 --- build-windows.sh | 13 ++++++++----- installer.nsi | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/build-windows.sh b/build-windows.sh index 790c461..379177c 100755 --- a/build-windows.sh +++ b/build-windows.sh @@ -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 ) diff --git a/installer.nsi b/installer.nsi index e175743..b1af592 100644 --- a/installer.nsi +++ b/installer.nsi @@ -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}"