summary refs log tree commit diff stats
path: root/gui/build_script.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gui/build_script.sh')
-rwxr-xr-xgui/build_script.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/gui/build_script.sh b/gui/build_script.sh
new file mode 100755
index 0000000..5d7c649
--- /dev/null
+++ b/gui/build_script.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+s_EXPORTED_FUNCTIONS="-s EXPORTED_FUNCTIONS=_init,_render"
+
+shared_flags="-Oz -flto -fno-inline -fno-unroll-loops -mnontrapping-fptoint"
+compile_flags="$shared_flags --std=c23"
+link_flags="$shared_flags -s MALLOC=emmalloc -s ASSERTIONS=0 -s INITIAL_MEMORY=65536 -s TOTAL_STACK=16384 -s STANDALONE_WASM=1 -s PURE_WASI=1 -s STACK_OVERFLOW_CHECK=0 -s WASM_BIGINT=1 -s ABORTING_MALLOC=0 -s MEMORY_GROWTH_GEOMETRIC_STEP=0 -s ALLOW_MEMORY_GROWTH=1"
+
+emcc --no-entry $s_EXPORTED_FUNCTIONS $link_flags $compile_flags -o radio-receiver.wasm radio-receiver.c
+
+mkdir -p ../src/main/resources/assets/pirate-radio/guis
+cp radio-receiver.wasm ../src/main/resources/assets/pirate-radio/guis/radio-receiver.wasm
+
+exit 0