@@ -6,3 +6,64 @@ source control. Run `scripts/generate_bindings.sh` to regenerate
66
77This placeholder file keeps the ` lib/ ` directory present in the
88repository so that ` dart ` tooling can resolve the package structure.
9+
10+ ## Mobile build artifacts
11+
12+ Mobile consumers (Flutter/Dart) can build platform-specific binaries using the
13+ scripts in ` scripts/ ` .
14+
15+ ### iOS (XCFramework)
16+
17+ 1 . Generate the required static libraries:
18+ ``` bash
19+ ./scripts/generate_bindings.sh --target ios
20+ ```
21+ 2 . Package them into an XCFramework:
22+ ``` bash
23+ ./scripts/build-ios-xcframework.sh
24+ ```
25+ The framework is written to ` ios/Release/bdkffi.xcframework/ ` .
26+
27+ ### Android (.so libraries)
28+
29+ 1 . Ensure ` ANDROID_NDK_ROOT ` points to an Android NDK r26c (or compatible) installation. For example:
30+ - macOS/Linux (adjust the NDK directory as needed):
31+ ``` bash
32+ export ANDROID_NDK_ROOT=" $HOME /Library/Android/sdk/ndk/29.0.14206865"
33+ ```
34+ - Windows PowerShell:
35+ ` ` ` powershell
36+ $Env :ANDROID_NDK_ROOT = " C:\\ Users\\ <you>\\ AppData\\ Local\\ Android\\ Sdk\\ ndk\\ 29.0.14206865"
37+ ` ` `
38+ (Use ` setx ANDROID_NDK_ROOT < path> ` if you want the variable persisted for future shells.)
39+ 2. Build the shared objects:
40+ ` ` ` bash
41+ ./scripts/generate_bindings.sh --target android
42+ ` ` `
43+ 3. Stage the artifacts for inclusion in a Flutter project:
44+ ` ` ` bash
45+ ./scripts/build-android.sh
46+ ` ` `
47+ Output libraries are copied to ` android/libs/< abi> /libbdkffi.so` .
48+
49+ # ## Desktop tests (macOS/Linux)
50+
51+ - Run the base script without a target flag before executing ` dart test` :
52+ ` ` ` bash
53+ ./scripts/generate_bindings.sh
54+ ` ` `
55+ This regenerates the Dart bindings and drops the host dynamic library
56+ (` libbdkffi.dylib` on macOS, ` libbdkffi.so` on Linux) in the project root.
57+ The generated loader expects those files when running in the VM, so tests fail if you only invoke the platform-specific targets.
58+
59+ # ## Verification
60+
61+ - On iOS, confirm the framework slices:
62+ ` ` ` bash
63+ lipo -info ios/Release/bdkffi.xcframework/ios-arm64/libbdkffi.a
64+ lipo -info ios/Release/bdkffi.xcframework/ios-arm64_x86_64-simulator/libbdkffi.a
65+ ` ` `
66+ - On Android, verify the shared objects:
67+ ` ` ` bash
68+ find android/libs -name " libbdkffi.so"
69+ ` ` `
0 commit comments