Files
dat-thang/build-windows-installer.ps1
T

37 lines
1.3 KiB
PowerShell
Raw Normal View History

2026-10-19 00:12:36 -04:00
param(
[string]$MsysRoot = 'C:\msys64',
[string]$InnoSetupCompiler = ''
)
$ErrorActionPreference = 'Stop'
$repo = Split-Path -Parent $MyInvocation.MyCommand.Path
$iss = Join-Path $repo 'dat-thang.iss'
if (!$InnoSetupCompiler) {
$candidate = Get-Command ISCC.exe -ErrorAction SilentlyContinue
if ($candidate) { $InnoSetupCompiler = $candidate.Source }
else {
foreach ($path in @(
'C:\Program Files (x86)\Inno Setup 6\ISCC.exe',
'C:\Program Files\Inno Setup 6\ISCC.exe'
)) {
if (Test-Path -LiteralPath $path) { $InnoSetupCompiler = $path; break }
}
}
}
if (!$InnoSetupCompiler -or !(Test-Path -LiteralPath $InnoSetupCompiler)) {
throw 'Inno Setup 6 is required to create the installer. Install Inno Setup 6, then rerun .\build-windows-installer.ps1.'
}
Push-Location $repo
try {
& (Join-Path $repo 'build-windows.ps1') -MsysRoot $MsysRoot
if ($LASTEXITCODE -ne 0) { throw "Windows app build failed with exit code $LASTEXITCODE" }
$version = (Get-Content -LiteralPath (Join-Path $repo 'VERSION') -Raw).Trim()
& $InnoSetupCompiler "/DAppVersion=$version" $iss
if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" }
}
finally {
Pop-Location
}
Write-Host "Windows installer and portable ZIP are in $(Join-Path $repo 'dist\installers')"