The 2026-05-12 engine-slop pass removed runtime std::env::set_var mutation from src-tauri/src/lib.rs and replaced it with warn_if_x11_env_unset_on_wayland. With no launcher owning the contract, Linux Wayland dogfood was about to regress. run.sh: - now owns Linux launcher env defaults via case "$(uname -s)" LIBCLANG_PATH=/usr/lib64/llvm21/lib64 (user-set wins) WEBKIT_DISABLE_DMABUF_RENDERER=1 (always on Linux; user-set wins) GDK_BACKEND=x11, WINIT_UNIX_BACKEND=x11 (Wayland only; user-set wins) - 60s Vite readiness timeout - detects early Vite exit (kill -0 + wait) instead of hanging forever - trap installed before wait so Ctrl-C cleans up - args forwarded: ./run.sh --release etc. - non-exec final Tauri launch preserved so cleanup trap fires package.json: - "dev:tauri": "./run.sh" — canonical discoverable dev command Docs: - README, dev-setup, architecture-map runtime + launcher pages updated with the new contract; canonical command is npm run dev:tauri (./run.sh as direct equivalent) - dev-launcher-and-scripts.md replaces the incorrect "kills process group" claim with honest "kills the spawned npm process" - dev-setup.md path /CORBEL-Projects/magnotia → /CORBEL-Projects/transcription-app - gpu-tuning/plan.md gets a superseded note rather than rewriting the original rationale - engine-slop-residuals.md gains Area F (packaged-binary launcher contract) with honest wrapper-vs-.desktop trade-off documented Verification: bash -n run.sh; shellcheck clean; cargo check -p magnotia green; npm pkg get 'scripts.dev:tauri' returns "./run.sh"; stale-ref sweep clean across living docs.
52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Magnotia dev launcher. Starts Vite first, waits for it to bind port 1420,
|
|
# then runs Tauri without triggering a second Vite instance.
|
|
# Sets the Linux rendering env vars that warn_if_x11_env_unset_on_wayland
|
|
# (src-tauri/src/lib.rs) expects the launcher to own.
|
|
# For performance testing use: npm run tauri build
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
case "$(uname -s)" in
|
|
Linux)
|
|
# Bindgen libclang path. Fedora 41/LLVM 21 default; user-set wins.
|
|
export LIBCLANG_PATH="${LIBCLANG_PATH:-/usr/lib64/llvm21/lib64}"
|
|
# iGPU idle-cost workaround. Set to 0 explicitly to opt out.
|
|
export WEBKIT_DISABLE_DMABUF_RENDERER="${WEBKIT_DISABLE_DMABUF_RENDERER:-1}"
|
|
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
|
|
export GDK_BACKEND="${GDK_BACKEND:-x11}"
|
|
export WINIT_UNIX_BACKEND="${WINIT_UNIX_BACKEND:-x11}"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
printf 'Starting Vite dev server...\n' >&2
|
|
npm run dev:frontend &
|
|
VITE_PID=$!
|
|
|
|
cleanup() {
|
|
kill "$VITE_PID" 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
# Wait up to 60s for Vite, bailing if it exits early.
|
|
for _ in $(seq 1 120); do
|
|
if curl -sf http://localhost:1420 > /dev/null 2>&1; then
|
|
break
|
|
fi
|
|
if ! kill -0 "$VITE_PID" 2>/dev/null; then
|
|
printf 'Vite dev server exited before becoming ready.\n' >&2
|
|
wait "$VITE_PID"
|
|
exit 1
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
|
|
if ! curl -sf http://localhost:1420 > /dev/null 2>&1; then
|
|
printf 'Timed out waiting for Vite on http://localhost:1420\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf 'Vite ready. Launching Tauri...\n' >&2
|
|
npx tauri dev --config '{"build":{"beforeDevCommand":""}}' "$@"
|