[TS] Use -O1 on debug builds as otherwise they can be unusable slow
[ldk-java] / genbindings.sh
index ce9411e1c012cc43020c1d6c70b6c60661eed6ea..3c669556f4b46185e570c789aae26be55075476e 100755 (executable)
@@ -203,13 +203,13 @@ else
        # 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=
-       [ "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,reallocarray -Wl,-wrap,malloc -Wl,-wrap,free"
+       [ "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,reallocarray -Wl,-wrap,malloc -Wl,-wrap,aligned_alloc -Wl,-wrap,free"
        if [ "$3" = "true" ]; then
                WASM_FILE=liblightningjs_debug.wasm
-               $COMPILE -o liblightningjs_debug.wasm -g -I"$1"/lightning-c-bindings/include/ ts/bindings.c "$1"/lightning-c-bindings/target/wasm32-wasi/debug/libldk.a $EXTRA_LINK
+               $COMPILE -o liblightningjs_debug.wasm -g -O1 -I"$1"/lightning-c-bindings/include/ ts/bindings.c "$1"/lightning-c-bindings/target/wasm32-wasi/debug/libldk.a $EXTRA_LINK
        else
                WASM_FILE=liblightningjs_release.wasm
-               $COMPILE -o liblightningjs_release.wasm -s -Os -I"$1"/lightning-c-bindings/include/ ts/bindings.c "$1"/lightning-c-bindings/target/wasm32-wasi/release/libldk.a $EXTRA_LINK
+               $COMPILE -o liblightningjs_release.wasm -s -Oz -I"$1"/lightning-c-bindings/include/ ts/bindings.c "$1"/lightning-c-bindings/target/wasm32-wasi/release/libldk.a $EXTRA_LINK
        fi
 
        if [ -x "$(which tsc)" ]; then