@@ -16,6 +16,10 @@ usage() {
1616set -e
1717set -x
1818
19+ function is_gnu_sed(){
20+ sed --version > /dev/null 2>&1
21+ }
22+
1923if [ " $CC " != " " ]; then
2024 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) ="
2125else
@@ -29,11 +33,11 @@ if [ "$3" = "leaks" ]; then
2933fi
3034
3135cp " $1 /lightning-c-bindings/include/lightning.h" ./
32- if [ " $( rustc --version --verbose | grep " host:" ) " = " host: x86_64-apple-darwin" ] || [ " $( rustc --version --verbose | grep " host:" ) " = " host: aarch64-apple-darwin" ]; then
33- # OSX sed is for some reason not compatible with GNU sed
34- sed -i ' ' " s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
35- else
36+ if is_gnu_sed; then
3637 sed -i " s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
38+ else
39+ # OSX sed is for some reason not compatible with GNU sed
40+ sed -i ' ' " s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
3741fi
3842
3943if [ " $LDK_GARBAGECOLLECTED_GIT_OVERRIDE " = " " ]; then
@@ -71,11 +75,11 @@ if [ "$2" != "wasm" ]; then
7175 LDK_TARGET_CPU=" sandybridge"
7276 fi
7377
74- if [ " $( rustc --version --verbose | grep " host:" ) " = " host: x86_64-apple-darwin" ] || [ " $( rustc --version --verbose | grep " host:" ) " = " host: aarch64-apple-darwin" ]; then
75- # OSX sed is for some reason not compatible with GNU sed
76- sed -i ' ' " s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 1: 100} <\/version>/g" pom.xml
77- else
78+ if is_gnu_sed; then
7879 sed -i " s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 1: 100} <\/version>/g" pom.xml
80+ else
81+ # OSX sed is for some reason not compatible with GNU sed
82+ sed -i ' ' " s/^ <version>.*<\/version>/ <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE: 1: 100} <\/version>/g" pom.xml
7983 fi
8084
8185 echo " Creating Java bindings..."
0 commit comments