aboutsummaryrefslogtreecommitdiff
path: root/src/web/build.sh
diff options
context:
space:
mode:
authorGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
committerGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
commitecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 (patch)
tree70e0af76a1b13affff7c6cc8aac7b3e6ef960478 /src/web/build.sh
a
Diffstat (limited to 'src/web/build.sh')
-rwxr-xr-xsrc/web/build.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/web/build.sh b/src/web/build.sh
new file mode 100755
index 0000000..48c784e
--- /dev/null
+++ b/src/web/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# builds src/web/zc.wasm (or the path given as the first argument): the microcore, with the compiler genome inside, as
+# WebAssembly. needs clang with the wasm32 target and wasm-ld. the page
+# (src/web/index.html) loads it next to src/web/zc.js.
+set -e
+cd "$(dirname "$0")/../.."
+clang --target=wasm32 -O2 -w -fwrapv -nostdlib -fno-builtin -mbulk-memory -DJTYPE=int \
+ -Isrc/core -Isrc/micro src/micro/micro.c src/web/port_wasm.c \
+ -Wl,--no-entry -Wl,--export=wasm_input -Wl,--export=wasm_input_cap -Wl,--export=wasm_set_input -Wl,--export=wasm_run \
+ -Wl,--export=memory -Wl,--allow-undefined -Wl,--initial-memory=33554432 -Wl,-z,stack-size=65536 \
+ -o "${1:-src/web/zc.wasm}"
+ls -l "${1:-src/web/zc.wasm}"