summaryrefslogtreecommitdiff
path: root/crates/gipfel-wasm/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'crates/gipfel-wasm/build.sh')
-rwxr-xr-xcrates/gipfel-wasm/build.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/gipfel-wasm/build.sh b/crates/gipfel-wasm/build.sh
new file mode 100755
index 0000000..8d1d812
--- /dev/null
+++ b/crates/gipfel-wasm/build.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Build the gipfel WASM spike and serve the demo page.
+# Requires: rustup (for the wasm target) and wasm-pack.
+set -e
+cd "$(dirname "$0")"
+
+if ! rustup target list --installed 2>/dev/null | grep -q wasm32-unknown-unknown; then
+ echo "adding wasm32-unknown-unknown target ..."
+ rustup target add wasm32-unknown-unknown
+fi
+command -v wasm-pack >/dev/null 2>&1 || {
+ echo "wasm-pack not found. Install it once with:"
+ echo " cargo install wasm-pack (or: cargo binstall wasm-pack)"
+ exit 1
+}
+
+wasm-pack build --target web
+
+echo
+echo "built. serve the demo with:"
+echo " (cd crates/gipfel-wasm && python3 -m http.server 8080)"
+echo "then open http://localhost:8080/demo/"