3 Commits

Author SHA1 Message Date
005155e486 Feat: fix windows build script 2026-03-18 13:39:45 +01:00
712bd4e74e Feat: fix windows build script 2026-03-18 13:35:17 +01:00
144c2487c2 Feat: fix windows build script 2026-03-18 13:30:41 +01:00
2 changed files with 35 additions and 15 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

@@ -23,6 +23,7 @@ from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from rich.console import Console, Group from rich.console import Console, Group
from rich.markup import escape
from rich.live import Live from rich.live import Live
from rich.panel import Panel from rich.panel import Panel
from rich.progress_bar import ProgressBar from rich.progress_bar import ProgressBar
@@ -441,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}")
@@ -505,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)
@@ -647,7 +651,7 @@ def _build_display(
if recent: if recent:
lines: list[str] = [] lines: list[str] = []
for alias, line in recent: for alias, line in recent:
lines.append(f"[dim]{alias}[/] {line.rstrip()}") lines.append(f"[dim]{alias}[/] {escape(line.rstrip())}")
log_text = Text("\n") + Text.from_markup("\n".join(lines)) log_text = Text("\n") + Text.from_markup("\n".join(lines))
else: else:
log_text = Text("\nwaiting for output...", style="dim") log_text = Text("\nwaiting for output...", style="dim")
@@ -792,7 +796,7 @@ def _print_platform_log(r: PlatformResult, verbose: bool = False) -> None:
lines = [f" ... ({len(r.log_lines) - _FAILURE_LOG_TAIL} lines omitted, use --verbose for full output)"] + lines[-_FAILURE_LOG_TAIL:] lines = [f" ... ({len(r.log_lines) - _FAILURE_LOG_TAIL} lines omitted, use --verbose for full output)"] + lines[-_FAILURE_LOG_TAIL:]
console.print(Panel( console.print(Panel(
"\n".join(lines) if lines else "[dim]no output[/]", "\n".join(escape(l) for l in lines) if lines else "[dim]no output[/]",
title=f"{r.platform.label} [{status}] {r.elapsed:.1f}s", title=f"{r.platform.label} [{status}] {r.elapsed:.1f}s",
border_style=style, border_style=style,
)) ))