From 806d732affedb57a98a98abf6954c5478df92bb8 Mon Sep 17 00:00:00 2001 From: Roman Dmitrienko Date: Tue, 5 Mar 2024 21:43:57 +0100 Subject: [PATCH] Build x86_64 and fat macOS dylibs. --- scripts/uniffi_bindgen_generate_go.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/uniffi_bindgen_generate_go.sh b/scripts/uniffi_bindgen_generate_go.sh index 9cf563a9e..64cce6a85 100755 --- a/scripts/uniffi_bindgen_generate_go.sh +++ b/scripts/uniffi_bindgen_generate_go.sh @@ -20,15 +20,13 @@ build_lib() { cp "target/$TARGET/release/$OUTPUT_FILE" "ffi/golang/ldk_node/$TARGET/" || exit 1 } -is_target_installed() { - local TARGET=$1 - rustup target list --installed | grep -q $TARGET -} - # If we're running on macOS, build the macOS library using the host compiler. # Cross compilation is not supported (needs more complex setup). if [[ "$OSTYPE" == "darwin"* ]]; then build_lib "cargo" "aarch64-apple-darwin" "libldk_node.dylib" + build_lib "cargo" "x86_64-apple-darwin" "libldk_node.dylib" + mkdir -p ffi/golang/ldk_node/universal-macos || exit 1 + lipo -create -output "ffi/golang/ldk_node/universal-macos/libldk_node.dylib" "ffi/golang/ldk_node/aarch64-apple-darwin/libldk_node.dylib" "ffi/golang/ldk_node/x86_64-apple-darwin/libldk_node.dylib" || exit 1 fi build_lib "cross" "x86_64-unknown-linux-gnu" "libldk_node.so"