CI / test (push) Failing after 17s
The Rust host stays as a fallback: just run-rust, run-drm-rust, install-session-rust (session/install.py --rust-host). build-wasmhost.sh fetches the wasmtime C API when it is missing and replaces build/wasmhost by renaming, so a running dev session keeps its copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiNfjrw2edja7LiRLB
23 lines
1.3 KiB
Bash
Executable File
23 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the compositor itself as a wasm component: build/compositor.wasm.
|
|
# It imports the chandra:host interfaces (wit/host) and exports `run`; the host (wasmhost/,
|
|
# build/wasmhost; or the Rust host-wasm/) provides the imports. Needs moon and wasm-tools.
|
|
# scripts/build-compositor-wasm.sh
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
|
|
export PATH="$ROOT/.tools/bin:$HOME/.moon/bin:$PATH"
|
|
for t in moon wasm-tools; do
|
|
command -v "$t" >/dev/null || { echo "error: $t not found" >&2; exit 1; }
|
|
done
|
|
moon build --target wasm --release components/compositor/gen 2>&1 | grep -E '^Error' -A8 || true
|
|
[ "${PIPESTATUS[0]}" -eq 0 ] || { echo "error: moon build failed" >&2; exit 1; }
|
|
core="_build/wasm/release/build/components/compositor/gen/gen.wasm"
|
|
[ -f "$core" ] || { echo "error: $core missing" >&2; exit 1; }
|
|
mkdir -p build
|
|
wasm-tools component embed wit/host "$core" --world compositor --encoding utf16 -o build/compositor.embed.wasm
|
|
wasm-tools component new build/compositor.embed.wasm -o build/compositor.wasm
|
|
rm -f build/compositor.embed.wasm
|
|
wasm-tools validate --features component-model build/compositor.wasm
|
|
printf 'compositor.wasm %s bytes imports=[%s]\n' "$(stat -c %s build/compositor.wasm)" \
|
|
"$(wasm-tools component wit build/compositor.wasm | sed -n 's/^ import \(.*\);/\1/p' | paste -sd, -)"
|