Feat: fix windows build script

This commit is contained in:
2026-03-18 13:39:45 +01:00
parent 712bd4e74e
commit 005155e486
2 changed files with 32 additions and 13 deletions

View File

@@ -39,8 +39,12 @@ Unicode True
Section "Cagire (required)" SecCore Section "Cagire (required)" SecCore
SectionIn RO SectionIn RO
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "/oname=cagire.exe" "${CLI_EXE}" !ifdef CLI_EXE
File "/oname=cagire-desktop.exe" "${DESKTOP_EXE}" File "/oname=cagire.exe" "${CLI_EXE}"
!endif
!ifdef DESKTOP_EXE
File "/oname=cagire-desktop.exe" "${DESKTOP_EXE}"
!endif
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Cagire" "InstallDir" "$INSTDIR" WriteRegStr HKLM "Software\Cagire" "InstallDir" "$INSTDIR"
@@ -50,7 +54,11 @@ Section "Cagire (required)" SecCore
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "Publisher" "Raphael Forment" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "Publisher" "Raphael Forment"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayIcon" '"$INSTDIR\cagire-desktop.exe"' !ifdef DESKTOP_EXE
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayIcon" '"$INSTDIR\cagire-desktop.exe"'
!else
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayIcon" '"$INSTDIR\cagire.exe"'
!endif
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "URLInfoAbout" "https://git.raphaelforment.fr/BuboBubo/cagire" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "URLInfoAbout" "https://git.raphaelforment.fr/BuboBubo/cagire"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "HelpLink" "https://cagire.raphaelforment.fr" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "HelpLink" "https://cagire.raphaelforment.fr"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "NoModify" 1
@@ -64,21 +72,29 @@ Section "Add to PATH" SecPath
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd SectionEnd
!ifdef DESKTOP_EXE
Section "Start Menu Shortcut" SecStartMenu Section "Start Menu Shortcut" SecStartMenu
CreateDirectory "$SMPROGRAMS\Cagire" CreateDirectory "$SMPROGRAMS\Cagire"
CreateShortCut "$SMPROGRAMS\Cagire\Cagire.lnk" "$INSTDIR\cagire-desktop.exe" "" "$INSTDIR\cagire-desktop.exe" 0 CreateShortCut "$SMPROGRAMS\Cagire\Cagire.lnk" "$INSTDIR\cagire-desktop.exe" "" "$INSTDIR\cagire-desktop.exe" 0
CreateShortCut "$SMPROGRAMS\Cagire\Uninstall.lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$SMPROGRAMS\Cagire\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SectionEnd SectionEnd
!endif
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Installs Cagire CLI and Desktop binaries." !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Installs Cagire CLI and Desktop binaries."
!insertmacro MUI_DESCRIPTION_TEXT ${SecPath} "Add the install location to the PATH system environment variable." !insertmacro MUI_DESCRIPTION_TEXT ${SecPath} "Add the install location to the PATH system environment variable."
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Add a Cagire shortcut to the Start Menu." !ifdef DESKTOP_EXE
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Add a Cagire shortcut to the Start Menu."
!endif
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall" Section "Uninstall"
Delete "$INSTDIR\cagire.exe" !ifdef CLI_EXE
Delete "$INSTDIR\cagire-desktop.exe" Delete "$INSTDIR\cagire.exe"
!endif
!ifdef DESKTOP_EXE
Delete "$INSTDIR\cagire-desktop.exe"
!endif
Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR" RMDir "$INSTDIR"

View File

@@ -442,22 +442,25 @@ def make_appimage(root: Path, binary: Path, arch: str, output_dir: Path, log: li
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def make_nsis(root: Path, rd: Path, version: str, output_dir: Path, log: list[str]) -> str | None: def make_nsis(root: Path, rd: Path, version: str, output_dir: Path, config: BuildConfig, log: list[str]) -> str | None:
if not shutil.which("makensis"): if not shutil.which("makensis"):
log.append(" makensis not found, skipping NSIS installer") log.append(" makensis not found, skipping NSIS installer")
return None return None
log.append(" Building NSIS installer") log.append(" Building NSIS installer")
abs_root = str(root.resolve()) abs_root = str(root.resolve())
run_cmd([ cmd = [
"makensis", "makensis",
f"-DVERSION={version}", f"-DVERSION={version}",
f"-DCLI_EXE={abs_root}/{rd.relative_to(root)}/cagire.exe",
f"-DDESKTOP_EXE={abs_root}/{rd.relative_to(root)}/cagire-desktop.exe",
f"-DICON={abs_root}/assets/Cagire.ico", f"-DICON={abs_root}/assets/Cagire.ico",
f"-DOUTDIR={abs_root}/{OUT}", f"-DOUTDIR={abs_root}/{OUT}",
str(root / "nsis" / "cagire.nsi"), ]
], log) if config.cli:
cmd.append(f"-DCLI_EXE={abs_root}/{rd.relative_to(root)}/cagire.exe")
if config.desktop:
cmd.append(f"-DDESKTOP_EXE={abs_root}/{rd.relative_to(root)}/cagire-desktop.exe")
cmd.append(str(root / "nsis" / "cagire.nsi"))
run_cmd(cmd, log)
installer = f"cagire-{version}-windows-x86_64-setup.exe" installer = f"cagire-{version}-windows-x86_64-setup.exe"
log.append(f" Installer -> {output_dir / installer}") log.append(f" Installer -> {output_dir / installer}")
@@ -506,7 +509,7 @@ def copy_artifacts(root: Path, p: Platform, config: BuildConfig, log: list[str])
artifacts.append(dmg) artifacts.append(dmg)
if p.os == "windows": if p.os == "windows":
nsis = make_nsis(root, rd, version, out, log) nsis = make_nsis(root, rd, version, out, config, log)
if nsis: if nsis:
artifacts.append(nsis) artifacts.append(nsis)