diff --git a/platform/windows/build-windows-release.sh b/platform/windows/build-windows-release.sh new file mode 100755 index 0000000..702aa3d --- /dev/null +++ b/platform/windows/build-windows-release.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Linux/macOS equivalent of build-windows.ps1: cross-compile the Windows release +# (CLI + windowless helper), stage scripts, build the NSIS release installer +# (installer-windows.nsi) and a portable .zip for amd64 and arm64. +# Usage: platform/windows/build-windows-release.sh # VERSION from internal/job/job.go +# VERSION=0.3.4 ARCHES="amd64" platform/windows/build-windows-release.sh +# Needs: go, makensis (apt install nsis / brew install nsis), zip. +# Output is unsigned; Authenticode signing is a separate step. +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +WIN="$ROOT/platform/windows" +VERSION="${VERSION:-$(grep -E 'HelperVersion\s*=' "$ROOT/internal/job/job.go" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')}" +ARCHES="${ARCHES:-amd64 arm64}" +OUT="${OUT:-$ROOT/dist/windows}" +MAKENSIS="${MAKENSIS:-$(command -v makensis || echo /opt/homebrew/bin/makensis)}" +SHA="$(command -v sha256sum || echo 'shasum -a 256')" +[[ -x "$MAKENSIS" ]] || { echo "makensis not found" >&2; exit 1; } +mkdir -p "$OUT" +cd "$ROOT" +echo "==> go test (host)"; go test ./internal/... ./cmd/... +for arch in $ARCHES; do + stage="$OUT/stage-$arch"; rm -rf "$stage"; mkdir -p "$stage/scripts" + echo "==> windows/$arch $VERSION" + CGO_ENABLED=0 GOOS=windows GOARCH="$arch" go build -trimpath -ldflags "-s -w" -o "$stage/verae-print.exe" ./cmd/verae-print + CGO_ENABLED=0 GOOS=windows GOARCH="$arch" go build -trimpath -ldflags "-s -w -H windowsgui" -o "$stage/verae-printhelper.exe" ./cmd/verae-print + cp "$WIN"/scripts/*.ps1 "$stage/scripts/" + cp "$WIN/LICENSE.txt" "$WIN/README-WINDOWS.txt" "$stage/" + "$MAKENSIS" -V2 -DVERSION="$VERSION" -DARCH="$arch" -DSRCDIR="$stage" -DOUTDIR="$OUT" "$WIN/installer-windows.nsi" + setup="$OUT/VeraePrintStamp-windows-$arch-$VERSION-setup.exe" + [[ -f "$setup" ]] || { echo "missing $setup" >&2; exit 1; } + cp -f "$setup" "$OUT/VeraePrintStamp-windows-$arch-setup.exe" + zdir="VeraePrintStamp-windows-$arch-$VERSION" + rm -rf "$OUT/$zdir" "$OUT/$zdir.zip"; cp -r "$stage" "$OUT/$zdir" + (cd "$OUT" && zip -qr "$zdir.zip" "$zdir" && cp -f "$zdir.zip" "VeraePrintStamp-windows-$arch.zip" && rm -rf "$zdir") +done +(cd "$OUT" && $SHA VeraePrintStamp-windows-*.exe VeraePrintStamp-windows-*.zip | tee SHA256SUMS) +ls -l "$OUT"/VeraePrintStamp-windows-* diff --git a/platform/windows/build-windows.ps1 b/platform/windows/build-windows.ps1 index 41b68ca..8371967 100644 --- a/platform/windows/build-windows.ps1 +++ b/platform/windows/build-windows.ps1 @@ -1,6 +1,6 @@ # 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") +param([string]$Arch = "amd64", [string]$Version = "0.3.4") $ErrorActionPreference = "Stop" $Root = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path $Out = Join-Path $Root "dist\windows" diff --git a/platform/windows/installer-windows.nsi b/platform/windows/installer-windows.nsi index d4196b9..f2ac8ca 100644 --- a/platform/windows/installer-windows.nsi +++ b/platform/windows/installer-windows.nsi @@ -7,7 +7,7 @@ ; Logging: one concise %ProgramData%\Verae\logs\installer-