summary refs log tree commit diff stats
path: root/gui/build_script.sh
blob: 5d7c649b0fda611c3547a478f6ccc84b2ee92803 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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