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