set -e
set -x
+function is_gnu_sed(){
+ sed --version >/dev/null 2>&1
+}
+
if [ "$CC" != "" ]; then
COMMON_COMPILE="$CC -std=c11 -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-unused-function -Wno-nullability-completeness -Wno-pointer-sign -Wdate-time -ffile-prefix-map=$(pwd)="
else
fi
cp "$1/lightning-c-bindings/include/lightning.h" ./
-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
+if is_gnu_sed; then
sed -i "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
+else
+ # OSX sed is for some reason not compatible with GNU sed
+ sed -i '' "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
fi
if [ "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" = "" ]; then
LDK_TARGET_CPU="sandybridge"
fi
- 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
+ if is_gnu_sed; then
sed -i "s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" pom.xml
+ else
+ # 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
fi
echo "Creating Java bindings..."
fi
rm -f ts/bindings.c
sed -i 's/^ "version": .*/ "version": "'${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}'",/g' ts/package.json
+ sed -i 's/^ "version": .*/ "version": "'${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}'",/g' node-net/package.json
+ sed -i 's/^ "lightningdevkit": .*/ "lightningdevkit": "'${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}'"/g' node-net/package.json
if [ "$3" = "true" ]; then
echo "#define LDK_DEBUG_BUILD" > ts/bindings.c
elif [ "$3" = "leaks" ]; then
tsc --types node --typeRoots .
cp ../$WASM_FILE liblightningjs.wasm
cp ../README.md README.md
+ cd ../node-net
+ tsc --types node --typeRoots .
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
+ cd ../ts
+ node --stack_trace_limit=200 --trace-uncaught test/node.mjs
+ cd ../node-net
+ node --stack_trace_limit=200 --trace-uncaught test/test.mjs
fi
fi
fi