Skip to content

Commit 005ec27

Browse files
committed
ios: switch to vendored prebuilt lib (matches macOS pattern)
1 parent 0f9536e commit 005ec27

6 files changed

Lines changed: 69 additions & 30 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ build/
3535
android/src/main/jniLibs/
3636

3737
/macos/frostdart.xcframework/
38+
/ios/libfrostdart.a

ios/frostdart.podspec

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
#
55
Pod::Spec.new do |s|
66
s.name = 'frostdart'
7-
s.version = '0.0.1'
8-
s.summary = 'A new Flutter project.'
7+
s.version = '0.2.0'
8+
s.summary = 'Flutter FFI plugin for FROST threshold signing.'
99
s.description = <<-DESC
10-
A new Flutter project.
10+
Flutter FFI plugin wrapping the Rust HRF (FROST) crate from
11+
kayabaNerve/serai (a fork of serai-dex/serai) for threshold-signed
12+
Bitcoin wallets.
1113
DESC
12-
s.homepage = 'http://example.com'
14+
s.homepage = 'https://github.com/cypherstack/frostdart'
1315
s.license = { :file => '../LICENSE' }
14-
s.author = { 'Your Company' => 'email@example.com' }
16+
s.author = { 'Cypher Stack' => 'heyo@cypherstack.com' }
1517

1618
# This will ensure the source files in Classes/ are included in the native
1719
# builds of apps using this FFI plugin. Podspec does not support relative
@@ -20,20 +22,19 @@ A new Flutter project.
2022
s.source = { :path => '.' }
2123
s.source_files = 'Classes/**/*'
2224

23-
s.script_phase = {
24-
:name => 'Build Rust library',
25-
# First argument is relative path to the `rust` folder, second is name of rust library
26-
:script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../src/serai/hrf frostdart',
27-
:execution_position => :before_compile,
28-
:input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'],
29-
# Let XCode know that the static library referenced in -force_load below is
30-
# created by this build step.
31-
:output_files => ["${BUILT_PRODUCTS_DIR}/libfrostdart.a"],
32-
}
25+
# libfrostdart.a is produced by scripts/ios/download.sh (release artifact)
26+
# or scripts/ios/build_all.sh (build from source). Both drop it next to this
27+
# podspec. Consumers must run one of those before `pod install`.
28+
s.vendored_libraries = 'libfrostdart.a'
29+
30+
s.dependency 'Flutter'
31+
s.platform = :ios, '15.0'
32+
3333
s.pod_target_xcconfig = {
3434
'DEFINES_MODULE' => 'YES',
3535
# Flutter.framework does not contain a i386 slice.
3636
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',
37-
'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/libfrostdart.a',
37+
'OTHER_LDFLAGS' => '-force_load ${PODS_TARGET_SRCROOT}/libfrostdart.a',
3838
}
39+
s.swift_version = '5.0'
3940
end

macos/frostdart.podspec

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
#
55
Pod::Spec.new do |s|
66
s.name = 'frostdart'
7-
s.version = '0.0.1'
8-
s.summary = 'A new Flutter project.'
7+
s.version = '0.2.0'
8+
s.summary = 'Flutter FFI plugin for FROST threshold signing.'
99
s.description = <<-DESC
10-
A new Flutter project.
10+
Flutter FFI plugin wrapping the Rust HRF (FROST) crate from
11+
kayabaNerve/serai (a fork of serai-dex/serai) for threshold-signed
12+
Bitcoin wallets.
1113
DESC
12-
s.homepage = 'http://example.com'
14+
s.homepage = 'https://github.com/cypherstack/frostdart'
1315
s.license = { :file => '../LICENSE' }
14-
s.author = { 'Your Company' => 'email@example.com' }
16+
s.author = { 'Cypher Stack' => 'heyo@cypherstack.com' }
1517

1618
s.source = { :path => '.' }
1719
s.vendored_frameworks = 'frostdart.xcframework'

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: frostdart
2-
description: A new Flutter project.
3-
version: 0.0.1
4-
homepage:
2+
description: Flutter FFI plugin wrapping the Rust HRF (FROST) crate from kayabaNerve/serai (a fork of serai-dex/serai) for threshold-signed Bitcoin wallets.
3+
version: 0.2.0
4+
homepage: https://github.com/cypherstack/frostdart
55

66
environment:
77
sdk: '>=3.0.5 <4.0.0'

scripts/ios/build_all.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/bin/bash
2+
set -e
23

3-
ROOT_DIR="$(pwd)/../.."
4+
LIB_ROOT=../..
45

5-
mkdir -p build
6+
cd "$LIB_ROOT/src/serai/hrf" || exit
67

7-
rm -rf "$ROOT_DIR"/src/serai/target
8+
# cargokit's artifact search uses the Cargo package name verbatim, but cargo
9+
# normalizes dashes to underscores in the emitted filename. Rename so cargo's
10+
# output ("libfrostdart.a") and the podspec's vendored_libraries entry agree.
11+
# BSD sed (macOS) syntax; idempotent.
12+
sed -i '' 's/^name = "hrf-api"$/name = "frostdart"/' Cargo.toml
813

9-
cd "$ROOT_DIR"/src/serai/hrf || exit
14+
export IPHONEOS_DEPLOYMENT_TARGET=15.0
15+
export RUSTFLAGS="-C link-arg=-mios-version-min=15.0"
16+
cargo build --target aarch64-apple-ios --release --lib
1017

11-
# Build is handled by cargokit which requires the rust crate be named the same
12-
sed -i .bak 's/hrf-api/frostdart/' cargo.toml
18+
cp ../target/aarch64-apple-ios/release/libfrostdart.a \
19+
"$LIB_ROOT/ios/libfrostdart.a"

scripts/ios/download.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -e
3+
4+
LIB_ROOT=../..
5+
REPO="cypherstack/frostdart"
6+
BASE_URL="https://github.com/${REPO}/releases/download"
7+
8+
TAG=$(git -C "$LIB_ROOT" describe --tags --exact-match HEAD 2>/dev/null) || {
9+
echo "Error: frostdart is not at a tagged commit."
10+
echo "Pin the submodule to a release tag to use download mode."
11+
echo "Current commit: $(git -C "$LIB_ROOT" rev-parse HEAD)"
12+
exit 1
13+
}
14+
15+
TMPDIR=$(mktemp -d)
16+
trap 'rm -rf "$TMPDIR"' EXIT
17+
18+
curl -fSL "${BASE_URL}/${TAG}/checksums.txt" -o "$TMPDIR/checksums.txt"
19+
20+
download_and_verify() {
21+
local asset="$1"
22+
curl -fSL "${BASE_URL}/${TAG}/${asset}" -o "$TMPDIR/${asset}"
23+
grep "^[0-9a-f]* ${asset}$" "$TMPDIR/checksums.txt" | (cd "$TMPDIR" && shasum -a 256 -c)
24+
}
25+
26+
download_and_verify "frostdart-ios-aarch64.a"
27+
28+
cp "$TMPDIR/frostdart-ios-aarch64.a" "$LIB_ROOT/ios/libfrostdart.a"

0 commit comments

Comments
 (0)