#!/bin/sh # Cargo target runner for x86_64-pc-windows-gnu: run a Windows .exe under Wine. # Set via CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER (scripts/windows-cross-env.sh). # A private, reusable Wine prefix keeps runs isolated from any desktop Wine # setup and avoids re-creating the prefix (~10 s) for every test binary. set -e export WINEPREFIX="${ALKANE_WINEPREFIX:-$HOME/.cache/alkane-wine}" export WINEDEBUG="${WINEDEBUG:--all}" # No Wine menu entries/file associations, no Gecko/Mono install prompts. export WINEDLLOVERRIDES="${WINEDLLOVERRIDES:-winemenubuilder.exe=d;mscoree=d;mshtml=d}" WINE="${WINE:-$(command -v wine64 || command -v wine)}" if [ ! -f "$WINEPREFIX/system.reg" ]; then mkdir -p "$WINEPREFIX" # The registry (system.reg, the "prefix is ready" marker) is only written # when the wine server shuts down, so finish the boot explicitly. "$WINE" wineboot --init >/dev/null 2>&1 || true "$WINE" wineboot --shutdown >/dev/null 2>&1 || true wineserver -w 2>/dev/null || true fi exec "$WINE" "$@"