3535 sed -i " s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
3636fi
3737
38+ if [ " $LDK_GARBAGECOLLECTED_GIT_OVERRIDE " = " " ]; then
39+ export LDK_GARBAGECOLLECTED_GIT_OVERRIDE=$( git describe --tag --dirty)
40+ fi
41+ if [ " ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 0: 1} " != " v" ]; then
42+ echo " Version tag should start with a v" > /dev/stderr
43+ exit 1
44+ fi
45+
3846if [ " $2 " != " wasm" ]; then
3947 TARGET_STRING=" $LDK_TARGET "
4048 if [ " $TARGET_STRING " = " " ]; then
@@ -61,14 +69,6 @@ if [ "$2" != "wasm" ]; then
6169 LDK_TARGET_CPU=" sandybridge"
6270 fi
6371
64- if [ " $LDK_GARBAGECOLLECTED_GIT_OVERRIDE " = " " ]; then
65- export LDK_GARBAGECOLLECTED_GIT_OVERRIDE=$( git describe --tag --dirty)
66- fi
67- if [ " ${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 0: 1} " != " v" ]; then
68- echo " Version tag should start with a v" > /dev/stderr
69- exit 1
70- fi
71-
7272 if [ " $( rustc --version --verbose | grep " host:" ) " = " host: x86_64-apple-darwin" ]; then
7373 # OSX sed is for some reason not compatible with GNU sed
7474 sed -i ' ' " s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 1: 100} <\/version>/g" pom.xml
@@ -203,13 +203,13 @@ else
203203 # We only need malloc and assert/abort, but for now just use WASI for those:
204204 # EXTRA_LINK=/usr/lib/wasm32-wasi/libc.a
205205 EXTRA_LINK=
206- [ " $3 " != " false" ] && COMPILE=" $COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,reallocarray -Wl,-wrap,malloc -Wl,-wrap,free"
206+ [ " $3 " != " false" ] && COMPILE=" $COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,reallocarray -Wl,-wrap,malloc -Wl,-wrap,aligned_alloc -Wl,-wrap, free"
207207 if [ " $3 " = " true" ]; then
208208 WASM_FILE=liblightningjs_debug.wasm
209- $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
209+ $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
210210 else
211211 WASM_FILE=liblightningjs_release.wasm
212- $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
212+ $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
213213 fi
214214
215215 if [ -x " $( which tsc) " ]; then
@@ -223,11 +223,11 @@ else
223223 tsc
224224 else
225225 tsc --types node --typeRoots .
226+ cp ../$WASM_FILE liblightningjs.wasm
227+ echo Ready to publish!
226228 if [ -x " $( which node) " ]; then
227229 NODE_V=" $( node --version) "
228230 if [ " ${NODE_V: 1: 2} " -gt 14 ]; then
229- rm -f liblightningjs.wasm
230- ln -s " $( pwd) " /../$WASM_FILE liblightningjs.wasm
231231 node test/node.mjs
232232 fi
233233 fi
0 commit comments