android: TETHER_FEATURES switch in build-android.sh (build the iroh core)
Mirrors build-apple.sh: TETHER_FEATURES=iroh-transport ./build-android.sh builds libtethercore.so with the iroh stack. Verified: .so builds for arm64-v8a + x86_64 (2378 iroh symbols in the arm64 .so) and Kotlin bindings generate. Android joins the build-verified-on-iroh set; only the web/WASM target remains. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,12 @@ cd "$(dirname "$0")"
|
||||
APP="../android/app/src/main"
|
||||
ABIS=(arm64-v8a x86_64)
|
||||
|
||||
# Optional Cargo features, e.g. TETHER_FEATURES=iroh-transport for the iroh core.
|
||||
# Plain string (not an array) for macOS bash 3.2 + `set -u`.
|
||||
FEATURES="${TETHER_FEATURES:-}"
|
||||
FEAT_ARGS=""
|
||||
[ -n "$FEATURES" ] && FEAT_ARGS="--features $FEATURES" && echo "▸ features: $FEATURES"
|
||||
|
||||
if ! command -v cargo-ndk >/dev/null; then
|
||||
echo "missing cargo-ndk → cargo install cargo-ndk; also install the Android NDK and set ANDROID_NDK_HOME" >&2
|
||||
exit 1
|
||||
@@ -18,10 +24,12 @@ fi
|
||||
|
||||
echo "▸ building .so for ${ABIS[*]}…"
|
||||
rustup target add aarch64-linux-android x86_64-linux-android >/dev/null 2>&1 || true
|
||||
cargo ndk -t arm64-v8a -t x86_64 -o "$APP/jniLibs" build --release
|
||||
# shellcheck disable=SC2086 # intentional word-split of FEAT_ARGS
|
||||
cargo ndk -t arm64-v8a -t x86_64 -o "$APP/jniLibs" build --release $FEAT_ARGS
|
||||
|
||||
echo "▸ generating Kotlin bindings…"
|
||||
cargo build --release --lib
|
||||
# shellcheck disable=SC2086
|
||||
cargo build --release --lib $FEAT_ARGS
|
||||
cargo run --release --bin uniffi-bindgen -- \
|
||||
generate --library target/release/libtethercore.dylib \
|
||||
--language kotlin --out-dir "$APP/java"
|
||||
|
||||
Reference in New Issue
Block a user