Compare commits
3 Commits
260bc9dbdf
...
005155e486
| Author | SHA1 | Date | |
|---|---|---|---|
| 005155e486 | |||
| 712bd4e74e | |||
| 144c2487c2 |
@@ -39,8 +39,12 @@ Unicode True
|
||||
Section "Cagire (required)" SecCore
|
||||
SectionIn RO
|
||||
SetOutPath "$INSTDIR"
|
||||
!ifdef CLI_EXE
|
||||
File "/oname=cagire.exe" "${CLI_EXE}"
|
||||
!endif
|
||||
!ifdef DESKTOP_EXE
|
||||
File "/oname=cagire-desktop.exe" "${DESKTOP_EXE}"
|
||||
!endif
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
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" "Publisher" "Raphael Forment"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "UninstallString" '"$INSTDIR\uninstall.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" "HelpLink" "https://cagire.raphaelforment.fr"
|
||||
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
|
||||
SectionEnd
|
||||
|
||||
!ifdef DESKTOP_EXE
|
||||
Section "Start Menu Shortcut" SecStartMenu
|
||||
CreateDirectory "$SMPROGRAMS\Cagire"
|
||||
CreateShortCut "$SMPROGRAMS\Cagire\Cagire.lnk" "$INSTDIR\cagire-desktop.exe" "" "$INSTDIR\cagire-desktop.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\Cagire\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
||||
SectionEnd
|
||||
!endif
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!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."
|
||||
!ifdef DESKTOP_EXE
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Add a Cagire shortcut to the Start Menu."
|
||||
!endif
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
Section "Uninstall"
|
||||
!ifdef CLI_EXE
|
||||
Delete "$INSTDIR\cagire.exe"
|
||||
!endif
|
||||
!ifdef DESKTOP_EXE
|
||||
Delete "$INSTDIR\cagire-desktop.exe"
|
||||
!endif
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
from rich.console import Console, Group
|
||||
from rich.markup import escape
|
||||
from rich.live import Live
|
||||
from rich.panel import Panel
|
||||
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"):
|
||||
log.append(" makensis not found, skipping NSIS installer")
|
||||
return None
|
||||
|
||||
log.append(" Building NSIS installer")
|
||||
abs_root = str(root.resolve())
|
||||
run_cmd([
|
||||
cmd = [
|
||||
"makensis",
|
||||
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"-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"
|
||||
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)
|
||||
|
||||
if p.os == "windows":
|
||||
nsis = make_nsis(root, rd, version, out, log)
|
||||
nsis = make_nsis(root, rd, version, out, config, log)
|
||||
if nsis:
|
||||
artifacts.append(nsis)
|
||||
|
||||
@@ -647,7 +651,7 @@ def _build_display(
|
||||
if recent:
|
||||
lines: list[str] = []
|
||||
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))
|
||||
else:
|
||||
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:]
|
||||
|
||||
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",
|
||||
border_style=style,
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user