echo "debug should either be true, false, or leaks"
echo "debug of leaks turns on leak tracking on an optimized release bianry"
echo "android_web should either be true or false and indicates if we build for android (Java) or web (WASM)"
+ echo "Note that web currently generates the same results as !web (ie Node.JS)"
exit 1
}
[ "$1" = "" ] && usage
fi
cp "$1/lightning-c-bindings/include/lightning.h" ./
-if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then
+if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ] || [ "$(rustc --version --verbose | grep "host:")" = "host: aarch64-apple-darwin" ]; then
# OSX sed is for some reason not compatible with GNU sed
sed -i '' "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
else
LDK_JAR_TARGET=true
;;
"aarch64-apple-darwin"*)
+ LDK_TARGET_CPU="apple-a14"
LDK_TARGET_SUFFIX="_MacOSX-aarch64"
LDK_JAR_TARGET=true
;;
LDK_TARGET_CPU="sandybridge"
fi
- if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then
+ if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ] || [ "$(rustc --version --verbose | grep "host:")" = "host: aarch64-apple-darwin" ]; then
# OSX sed is for some reason not compatible with GNU sed
sed -i '' "s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" pom.xml
else
echo "Archive contained non-object files!"
exit 1
fi
- if [ "$(ar t "$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a | grep ldk.ldk.*-cgu.*.rcgu.o | wc -l)" != "1" ]; then
+ if [ "$(ar t "$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a | grep ldk.*-cgu.*.rcgu.o | wc -l)" != "1" ]; then
echo "Archive contained more than one LDK object file"
exit 1
fi
rm -f tmp/*
ar x --output=tmp "$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a
pushd tmp
- llvm-dis ldk.ldk.*-cgu.*.rcgu.o
- sed -i 's/br i1 icmp eq (i8\* @__cxa_thread_atexit_impl, i8\* null)/br i1 icmp eq (i8* null, i8* null)/g' ldk.ldk.*-cgu.*.rcgu.o.ll
- llvm-as ldk.ldk.*-cgu.*.rcgu.o.ll -o ./libldk.bc
+ llvm-dis ldk*-cgu.*.rcgu.o
+ sed -i 's/br i1 icmp eq (i8\* @__cxa_thread_atexit_impl, i8\* null)/br i1 icmp eq (i8* null, i8* null)/g' ldk*-cgu.*.rcgu.o.ll
+ llvm-as ldk*-cgu.*.rcgu.o.ll -o ./libldk.bc
ar q libldk.a *.o
popd
LDK_LIB="tmp/libldk.bc tmp/libldk.a"
fi
- $COMPILE -o liblightningjni_release$LDK_TARGET_SUFFIX.so -flto -O3 -I"$1"/lightning-c-bindings/include/ $2 src/main/jni/bindings.c $LDK_LIB
+ $COMPILE -o liblightningjni_release$LDK_TARGET_SUFFIX.so -flto -O3 -I"$1"/lightning-c-bindings/include/ $2 src/main/jni/bindings.c $LDK_LIB -lm
if [ "$IS_MAC" = "false" -a "$4" = "false" ]; then
GLIBC_SYMBS="$(objdump -T liblightningjni_release$LDK_TARGET_SUFFIX.so | grep GLIBC_ | grep -v "GLIBC_2\.2\." | grep -v "GLIBC_2\.3\(\.\| \)" | grep -v "GLIBC_2.\(14\|17\) " || echo)"
if [ "$GLIBC_SYMBS" != "" ]; then
mv $F.tmp $F
done
rm imports.mts.part
- if [ "$4" = "true" ]; then
- tsc
- else
- tsc --types node --typeRoots .
- cp ../$WASM_FILE liblightningjs.wasm
- echo Ready to publish!
- if [ -x "$(which node)" ]; then
- NODE_V="$(node --version)"
- if [ "${NODE_V:1:2}" -gt 14 ]; then
- node test/node.mjs
- fi
+ tsc --types node --typeRoots .
+ cp ../$WASM_FILE liblightningjs.wasm
+ cp ../README.md README.md
+ echo Ready to publish!
+ if [ -x "$(which node)" ]; then
+ NODE_V="$(node --version)"
+ if [ "${NODE_V:1:2}" -gt 14 ]; then
+ node test/node.mjs
fi
fi
fi