2022-11-22 20:37:17 -08:00
|
|
|
#!/bin/bash
|
|
|
|
# This script builds local swift-bdk Swift language bindings and corresponding bdkFFI.xcframework.
|
|
|
|
# The results of this script can be used for locally testing your SPM package adding a local package
|
|
|
|
# to your application pointing at the bdk-swift directory.
|
2023-10-17 12:33:35 -04:00
|
|
|
|
2024-04-19 14:47:26 -04:00
|
|
|
rustup default 1.77.1
|
2023-11-10 13:26:45 -06:00
|
|
|
rustup component add rust-src
|
2024-03-26 10:13:21 -04:00
|
|
|
rustup target add aarch64-apple-ios # iOS arm64
|
2023-11-21 14:48:49 -05:00
|
|
|
rustup target add x86_64-apple-ios # iOS x86_64
|
|
|
|
rustup target add aarch64-apple-ios-sim # simulator mac M1
|
|
|
|
rustup target add aarch64-apple-darwin # mac M1
|
|
|
|
rustup target add x86_64-apple-darwin # mac x86_64
|
2022-11-21 13:43:47 -06:00
|
|
|
|
2024-03-26 10:13:21 -04:00
|
|
|
cd ../bdk-ffi/ || exit
|
2022-11-21 13:43:47 -06:00
|
|
|
|
2023-03-23 12:39:22 -04:00
|
|
|
cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin
|
|
|
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin
|
|
|
|
cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-ios
|
|
|
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios
|
2023-11-10 13:26:45 -06:00
|
|
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios-sim
|
2022-11-21 13:43:47 -06:00
|
|
|
|
2024-04-30 15:54:50 -04:00
|
|
|
cargo run --bin uniffi-bindgen generate --library ./target/aarch64-apple-ios/release-smaller/libbdkffi.dylib --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format
|
|
|
|
|
2022-11-21 13:43:47 -06:00
|
|
|
mkdir -p target/lipo-ios-sim/release-smaller
|
2023-05-01 11:13:26 -05:00
|
|
|
lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a
|
2022-11-21 13:43:47 -06:00
|
|
|
mkdir -p target/lipo-macos/release-smaller
|
|
|
|
lipo target/aarch64-apple-darwin/release-smaller/libbdkffi.a target/x86_64-apple-darwin/release-smaller/libbdkffi.a -create -output target/lipo-macos/release-smaller/libbdkffi.a
|
|
|
|
|
2024-03-26 10:13:21 -04:00
|
|
|
cd ../bdk-swift/ || exit
|
2022-11-21 13:43:47 -06:00
|
|
|
mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift
|
|
|
|
cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64/bdkFFI.framework/Headers
|
|
|
|
cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/Headers
|
|
|
|
cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/Headers
|
2023-10-17 12:33:35 -04:00
|
|
|
cp ../bdk-ffi/target/aarch64-apple-ios/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64/bdkFFI.framework/bdkFFI
|
|
|
|
cp ../bdk-ffi/target/lipo-ios-sim/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/bdkFFI
|
|
|
|
cp ../bdk-ffi/target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/bdkFFI
|
2022-11-21 13:43:47 -06:00
|
|
|
rm Sources/BitcoinDevKit/bdkFFI.h
|
|
|
|
rm Sources/BitcoinDevKit/bdkFFI.modulemap
|