[Installer] Make the Inno Setup installer the default, with its failure hook.

COCKATRICE_WIN_INSTALLER now defaults to InnoSetup. NSIS stays selectable for
one release as the legacy fallback, and the two can still be built from one
tree and compared on a real upgrade.

The switches question from the previous commit is settled from Inno Setup's
source: the setup command line is an if/else-if chain over the switches it
knows, with no fallback that rejects the rest, so /R, /PID= and /D= are
ignored rather than refused. The client therefore sends one command line that
drives either installer:

- /R and /PID= for NSIS, which also needs /D= last and unquoted;
- /VERYSILENT and the CloseApplications set for Setup, which releases the
  mapped runtime DLLs through Restart Manager instead of waiting for a pid;
- /UPDATER as the client's own mark, read only by the Inno Setup script.

An older client that passes only the NSIS switches still installs; it walks
the wizard once instead of running silently.

The Sentry offer that AbortInstall carried is ported: a silent run the updater
launched, which began replacing files and never reached the end, offers to
send its log through the same helper. The helper is embedded with a [Files]
dontcopy entry and extracted at send time; a repeated [Files] section merges
with the generated one instead of being a compile error. Setup prefixes every
log line with a timestamp, so the helper's ABORT scan now allows that prefix.

CI installs Inno Setup next to NSIS, dumps ISCCOutput.log and the generated
script when the installer fails to compile, and --package NSIS|InnoSetup
selects the installer through the CMake option instead of adding a second
CPack generator to the run.
This commit is contained in:
Lukas Brübach 2026-10-26 08:29:22 +01:00
parent 2c8e47a0a4
commit 0403ac9354
8 changed files with 220 additions and 73 deletions

View file

@ -327,19 +327,32 @@ if(UNIX)
endif()
endif()
elseif(WIN32)
# Which tool writes the installer. NSIS is the incumbent and stays the default;
# InnoSetup selects CPack's own Inno Setup generator (see cmake/InnoSetup.cmake). Both
# consume the same install() rules, so this is a packaging choice, never a build change,
# and the two installers can be built from one tree and compared on a real upgrade.
# Which tool writes the installer. InnoSetup, through CPack's own Inno Setup generator
# (cmake/InnoSetup.cmake), is the default. NSIS stays selectable for one release as the
# fallback for anyone who needs the old installer, and so the two can still be built from
# one tree and compared on a real upgrade. Both consume the same install() rules, so this
# is a packaging choice, never a build change.
set(COCKATRICE_WIN_INSTALLER
"NSIS"
CACHE STRING "Windows installer generator: NSIS (incumbent) or InnoSetup"
"InnoSetup"
CACHE STRING "Windows installer generator: InnoSetup (default) or NSIS (legacy)"
)
set_property(CACHE COCKATRICE_WIN_INSTALLER PROPERTY STRINGS NSIS InnoSetup)
if(NOT COCKATRICE_WIN_INSTALLER MATCHES "^(NSIS|InnoSetup)$")
message(FATAL_ERROR "COCKATRICE_WIN_INSTALLER must be NSIS or InnoSetup, not '${COCKATRICE_WIN_INSTALLER}'")
endif()
# Installer-log sender for the failure hooks of both installers (values parsed out of
# COCKATRICE_SENTRY_DSN in cmake/CrashReporting.cmake). Generated only when a DSN was
# parsed: cmake/NSIS.template.in and cmake/InnoSetup.install.iss embed it under the same
# CPACK_SENTRY_ENABLED check, so a build without reporting never references or carries the
# helper. Configured above the installer choice because both branches consume it.
if(CPACK_SENTRY_ENABLED)
configure_file(
"${COCKATRICE_CMAKE_PATH}/SendInstallerLog.ps1.in" "${PROJECT_BINARY_DIR}/SendInstallerLog.ps1" @ONLY
)
set(COCKATRICE_SENTRY_INSTALLER_LOG "${PROJECT_BINARY_DIR}/SendInstallerLog.ps1")
endif()
if(COCKATRICE_WIN_INSTALLER STREQUAL "InnoSetup")
include(${COCKATRICE_CMAKE_PATH}/InnoSetup.cmake)
else()
@ -354,15 +367,6 @@ elseif(WIN32)
configure_file("${COCKATRICE_CMAKE_PATH}/NSIS.definitions.nsh.in" "${PROJECT_BINARY_DIR}/NSIS.definitions.nsh")
endif()
# Installer-log sender for the AbortInstall Sentry hook (values parsed out of COCKATRICE_SENTRY_DSN in
# cmake/CrashReporting.cmake). Generated only when a DSN was parsed: cmake/NSIS.template.in embeds it under
# the same CPACK_SENTRY_ENABLED check, so a build without reporting never references or carries the helper.
if(CPACK_SENTRY_ENABLED)
configure_file(
"${COCKATRICE_CMAKE_PATH}/SendInstallerLog.ps1.in" "${PROJECT_BINARY_DIR}/SendInstallerLog.ps1" @ONLY
)
endif()
# Every runtime DLL a Windows install has to contain, as paths relative to the
# install root. .ci/compile.sh reads this and fails the build when the packaged
# installer is missing one of them, or carries a runtime it does not know about.