else
echo "Creating TS bindings..."
mkdir -p ts/{enums,structs}
- rm -f ts/{enums,structs,}/*.{mjs,mts}
+ rm -f ts/{enums,structs,}/*.{mjs,mts,mts.part}
if [ "$4" = "false" ]; then
./genbindings.py "./lightning.h" ts ts ts $DEBUG_ARG typescript node
else
cat ts/bindings.c.body >> ts/bindings.c
echo "Building TS bindings..."
- COMPILE="$COMMON_COMPILE -flto -Wl,--no-entry -Wl,--export-dynamic -Wl,-allow-undefined -nostdlib --target=wasm32-wasi"
+ COMPILE="$COMMON_COMPILE -flto -Wl,--no-entry -nostdlib --target=wasm32-wasi -Wl,-z -Wl,stack-size=$((8*1024*1024)) -Wl,--initial-memory=$((16*1024*1024)) -Wl,--max-memory=$((1024*1024*1024)) -Wl,--global-base=4096"
# We only need malloc and assert/abort, but for now just use WASI for those:
#EXTRA_LINK=/usr/lib/wasm32-wasi/libc.a
EXTRA_LINK=
if [ -x "$(which tsc)" ]; then
cd ts
- rm -r structs # TODO: Make the human-types compile
+ for F in structs/*; do
+ cat imports.mts.part | grep -v " $(basename -s .mts $F)[ ,]" | cat - $F > $F.tmp
+ mv $F.tmp $F
+ done
+ rm imports.mts.part
if [ "$4" = "true" ]; then
tsc
else