Skip to content

Commit

Permalink
Merge pull request #10 from jan3dev/fix/ios-build
Browse files Browse the repository at this point in the history
Fix/ios build
  • Loading branch information
i5hi authored Jun 27, 2024
2 parents 3ae3dae + 7dcb33c commit ef7e4d6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 188 deletions.
171 changes: 0 additions & 171 deletions ios/Classes/bindings.h

This file was deleted.

10 changes: 5 additions & 5 deletions ios/boltz_dart.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ fi
#
Pod::Spec.new do |s|
s.name = 'boltz_dart'
s.version = '0.1.1'
s.version = "#{tag_version}"
s.summary = 'A boltz swap client.'
s.description = <<-DESC
A boltz swap client
DESC
s.homepage = 'http://github.com/SatoshiPortal'
s.license = { :file => '../LICENSE' }
s.homepage = 'https://github.com/SatoshiPortal'
s.author = { 'SatoshiPortal' => 'ishi@satoshiportal.com' }

s.source = { :http => "#{url}" }

s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
Expand All @@ -56,8 +56,8 @@ A boltz swap client
s.swift_version = '5.0'
s.public_header_files = 'Classes**/*.h'
s.source_files = 'Classes/**/*'
s.static_framework = true
s.vendored_frameworks = "libboltz.xcframework"
s.static_framework = false
s.vendored_frameworks = "#{framework}"

# # This will ensure the source files in Classes/ are included in the native
# # builds of apps using this FFI plugin. Podspec does not support relative
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
[lib]
name = "boltzclient"
doctest = false
crate-type = ["cdylib"]
crate-type = ["cdylib", "staticlib"]

[dependencies]
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust.git", rev = "9c3fd15c741749206735ff57d55e75dcd6f2d5d2" }
Expand Down
14 changes: 11 additions & 3 deletions rust/copy.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
ROOT="target"
VERSION=$1
NAME="libboltz"
BUILD_DIR=$ROOT/$NAME.$VERSION
# MACOS_DIR="../macos" # final binaries stored here
# IOS_DIR="../ios" # final binaries stored here
FRAMEWORK="libboltz.xcframework"

# if [ -d "../android/src/main/jniLibs" ]; then rm -r ../android/src/main/jniLibs
# fi
# if [ -d "../ios/rust_bdk_ffi.xcframework" ]; then rm -r ../ios/rust_bdk_ffi.xcframework
# fi
if [ -d "../ios/$FRAMEWORK" ]; then rm -r "../ios/$FRAMEWORK"
fi
# if [ -d "../macos/rust_bdk_ffi.xcframework" ]; then rm -r ../macos/rust_bdk_ffi.xcframework
# fi

Expand All @@ -15,4 +23,4 @@
# cp target/i686-linux-android/release/librust_bdk_ffi.so ../android/src/main/jniLibs/x86
# cp target/x86_64-linux-android/release/librust_bdk_ffi.so ../android/src/main/jniLibs/x86_86
# cp -r bdk.0.30.0/rust_bdk_ffi.xcframework ../macos/
# cp -r bdk.0.30.0/rust_bdk_ffi.xcframework ../ios/
cp -r "$BUILD_DIR/$FRAMEWORK" ../ios/
5 changes: 3 additions & 2 deletions rust/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ for TARGET in \
# aarch64-apple-darwin
do
rustup target add $TARGET
cargo build -r --target=$TARGET
cargo build --release --target=$TARGET
done

cargo install cargo-lipo
cargo lipo --release

# Create XCFramework zip
lipo -create -output $IOS_LIPO \
target/aarch64-apple-ios-sim/release/$LIBNAME \
Expand All @@ -49,7 +51,6 @@ lipo -create -output $IOS_LIPO \
# target/aarch64-apple-darwin/release/$LIBNAME \
# target/x86_64-apple-darwin/release/$LIBNAME


xcodebuild -create-xcframework \
-library $IOS_LIPO \
-library target/aarch64-apple-ios/release/$LIBNAME \
Expand Down
13 changes: 7 additions & 6 deletions rust/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ init:
## :

## all: Compile iOS, Android & Linux binaries
all: init unit-test jniLibs zip
all: init unit-test jniLibs xcframework zip copy-build

linux:
@echo "[Creating linux binary ...] $@"
Expand All @@ -34,7 +34,7 @@ jniLibs:
@echo "[Done ✅]"

xcframework:
@echo "[Creating rust_bdk_ffi.xcframework ...] $@"
@echo "[Creating xcframework ...] $@"
sh darwin.sh $(VERSION)
@echo "[Done ✅]"

Expand All @@ -47,10 +47,11 @@ unit-test:
@echo "[Creating unit-test binaries ...] $@"
sh unit-test.sh $(VERSION)
@echo "[Done ✅]"
# copy-build:
# @echo "[COPYING BINARIES TO FLUTTER PACKAGE ...] $@"
# sh copy.sh
# @echo "[Done ✅]"

copy-build:
@echo "[COPYING BINARIES TO FLUTTER PACKAGE ...] $@"
sh copy.sh $(VERSION)
@echo "[Done ✅]"



Expand Down

0 comments on commit ef7e4d6

Please sign in to comment.