62 lines
1.9 KiB
Shell
Executable file
62 lines
1.9 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Build NSIS GUI setup.exe for Windows (amd64 / arm64).
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
VERSION="${VERSION:-0.1.2}"
|
|
OUT="${OUT:-$ROOT/build/windows-installer}"
|
|
MAKENSIS="${MAKENSIS:-$(command -v makensis || true)}"
|
|
MAKENSIS="${MAKENSIS:-/opt/homebrew/bin/makensis}"
|
|
|
|
if [[ ! -x "$MAKENSIS" ]]; then
|
|
echo "makensis not found — brew install nsis" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$OUT"
|
|
|
|
build_arch() {
|
|
local arch="$1"
|
|
local src="$ROOT/build/win-linux/VeraePrintStamp-windows-${arch}-${VERSION}"
|
|
if [[ ! -f "$src/verae-print.exe" ]]; then
|
|
src="$ROOT/build/win-linux/VeraePrintStamp-windows-${arch}-0.1.2"
|
|
fi
|
|
if [[ ! -f "$src/verae-print.exe" ]]; then
|
|
echo "missing $src/verae-print.exe — run scripts/build-win-linux.sh first" >&2
|
|
exit 1
|
|
fi
|
|
# Stage with Windows-style paths for File directives
|
|
local stage="$OUT/stage-${arch}"
|
|
rm -rf "$stage"
|
|
mkdir -p "$stage"
|
|
cp "$src/verae-print.exe" "$stage/"
|
|
cp "$ROOT/platform/windows/README.txt" "$stage/"
|
|
cp "$ROOT/platform/windows/LICENSE.txt" "$stage/"
|
|
|
|
local nsi="$ROOT/platform/windows/installer.nsi"
|
|
# NSIS OutFile is relative to cwd
|
|
(
|
|
cd "$OUT"
|
|
"$MAKENSIS" -V2 \
|
|
-DVERSION="$VERSION" \
|
|
-DARCH="$arch" \
|
|
-DSRCDIR="$stage" \
|
|
"$nsi"
|
|
)
|
|
local exe="$OUT/VeraePrintStamp-windows-${arch}-${VERSION}-setup.exe"
|
|
if [[ ! -f "$exe" ]]; then
|
|
# NSIS may write next to nsi or cwd
|
|
exe=$(find "$OUT" "$ROOT/platform/windows" -name "VeraePrintStamp-windows-${arch}-${VERSION}-setup.exe" 2>/dev/null | head -1)
|
|
fi
|
|
if [[ -z "$exe" || ! -f "$exe" ]]; then
|
|
echo "setup.exe not produced for $arch" >&2
|
|
ls -la "$OUT" "$ROOT/platform/windows" | head -40
|
|
exit 1
|
|
fi
|
|
cp -f "$exe" "$OUT/VeraePrintStamp-windows-${arch}-setup.exe"
|
|
echo "built $exe ($(wc -c <"$exe") bytes)"
|
|
}
|
|
|
|
build_arch amd64
|
|
build_arch arm64
|
|
(cd "$OUT" && shasum -a 256 *-setup.exe | tee SHA256SUMS)
|
|
ls -lh "$OUT"/*-setup.exe
|