From 5a381b8f56c26b8a325dfa611452d0887ab00534 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 5 Nov 2026 13:50:31 +0100 Subject: [PATCH] chore #14740: windows cross-build script Co-Authored-By: Claude Opus 5.5 (1M context) --- scripts/build-windows.sh | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 scripts/build-windows.sh diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh new file mode 100755 index 0000000..4d128c6 --- /dev/null +++ b/scripts/build-windows.sh @@ -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