chore #14740: windows cross-build script

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-05 13:50:31 +01:00
co-authored by Claude Opus 5.5
parent 91f8315680
commit 5a381b8f56
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Cross-build the Windows NSIS installer for Gesprächsrekorder from Debian,
# using cargo-xwin (MSVC cross-linking) and makensis for bundling.
#
# Usage: scripts/build-windows.sh
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd -P)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd -P)"
export PATH="${HOME}/.cargo/bin:${PATH}"
TARGET="x86_64-pc-windows-msvc"
missing=()
if ! command -v makensis >/dev/null 2>&1; then
missing+=("makensis (NSIS) not found on PATH")
fi
if ! command -v cargo-xwin >/dev/null 2>&1; then
missing+=("cargo-xwin not found on PATH (expected under ~/.cargo/bin)")
fi
if ! rustup target list --installed 2>/dev/null | grep -qx "${TARGET}"; then
missing+=("rustup target '${TARGET}' is not installed (run: rustup target add ${TARGET})")
fi
if [ "${#missing[@]}" -gt 0 ]; then
echo "Missing prerequisites for Windows cross-build:" >&2
for item in "${missing[@]}"; do
echo " - ${item}" >&2
done
exit 1
fi
cd "${REPO_ROOT}"
cargo tauri build \
--runner cargo-xwin \
--target "${TARGET}" \
--bundles nsis
BUNDLE_DIR="${REPO_ROOT}/target/${TARGET}/release/bundle/nsis"
echo "Build finished. NSIS installer(s):"
find "${BUNDLE_DIR}" -maxdepth 1 -name '*.exe' -print