- promptForFilename setting (default true; env VERAE_PROMPT_FOR_FILENAME), 'verae-print config --prompt-for-filename', last Save As folder in ~/.verae/state.json - Windows helper: common file dialog (PDF filter, overwrite prompt, topmost owner) before stamping; macOS printer path: choose file name (NSSavePanel) via 'stamp -prompt-name -title'; cancel discards the job (no stamp/credit) - job.Options.OutPath: original saved at the chosen path, certificate and .verae.json next to it with the chosen base name (never overwritten) - held jobs keep the chosen path (pendingMeta.OutPath) - installer: 'Ask for a file name for each print' checkbox; removed the 'Open the user guide' finish-page checkbox; mac-key-setup asks too - auth test no longer touches the real macOS keychain (VERAE_SKIP_KEYCHAIN) - version 0.3.2
27 lines
2.1 KiB
PowerShell
27 lines
2.1 KiB
PowerShell
# Build the Windows installer natively on Windows (Go + NSIS).
|
|
# Usage: powershell -ExecutionPolicy Bypass -File platform\windows\build-windows.ps1 [-Arch amd64|arm64]
|
|
param([string]$Arch = "amd64", [string]$Version = "0.3.2")
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
|
|
$Out = Join-Path $Root "dist\windows"
|
|
$Stage = Join-Path $Out "stage-$Arch"
|
|
$Go = (Get-Command go -ErrorAction SilentlyContinue).Source; if (-not $Go) { $Go = "C:\Program Files\Go\bin\go.exe" }
|
|
$Nsis = (Get-Command makensis -ErrorAction SilentlyContinue).Source; if (-not $Nsis) { $Nsis = "${env:ProgramFiles(x86)}\NSIS\makensis.exe" }
|
|
Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force -Path $Stage, (Join-Path $Stage "scripts") | Out-Null
|
|
Push-Location $Root
|
|
try {
|
|
$env:CGO_ENABLED = "0"; $env:GOOS = "windows"; $env:GOARCH = $Arch
|
|
& $Go version
|
|
& $Go test ./internal/... ./cmd/... ; if ($LASTEXITCODE) { throw "go test failed" }
|
|
& $Go build -trimpath -ldflags "-s -w" -o (Join-Path $Stage "verae-print.exe") ./cmd/verae-print; if ($LASTEXITCODE) { throw "build cli failed" }
|
|
& $Go build -trimpath -ldflags "-s -w -H windowsgui" -o (Join-Path $Stage "verae-printhelper.exe") ./cmd/verae-print; if ($LASTEXITCODE) { throw "build helper failed" }
|
|
} finally { Pop-Location; Remove-Item Env:GOOS, Env:GOARCH -ErrorAction SilentlyContinue }
|
|
Copy-Item (Join-Path $PSScriptRoot "scripts\*.ps1") (Join-Path $Stage "scripts")
|
|
Copy-Item (Join-Path $PSScriptRoot "LICENSE.txt"), (Join-Path $PSScriptRoot "README-WINDOWS.txt") $Stage
|
|
& $Nsis /V3 "/DVERSION=$Version" "/DARCH=$Arch" "/DSRCDIR=$Stage" "/DOUTDIR=$Out" (Join-Path $PSScriptRoot "installer-windows.nsi")
|
|
if ($LASTEXITCODE) { throw "makensis failed" }
|
|
# raw files alongside the installer
|
|
Copy-Item (Join-Path $Stage "*") $Out -Recurse -Force
|
|
Get-ChildItem $Out -File | Where-Object { $_.Name -ne "SHA256SUMS.txt" -and $_.Extension -ne ".bundle" } | Get-FileHash -Algorithm SHA256 | ForEach-Object { "$($_.Hash.ToLower()) $(Split-Path $_.Path -Leaf)" } | Set-Content (Join-Path $Out "SHA256SUMS.txt")
|
|
Get-ChildItem $Out -File | Format-Table Name, Length -AutoSize
|