#!/bin/sh set -eu SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ANDROID_REPOSITORY=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd) CORE_REPOSITORY=${PEACH_NOISE_CORE_DIR:-"$ANDROID_REPOSITORY/../peach-browser/crypto-core"} NDK_HOME=${ANDROID_NDK_HOME:-/opt/homebrew/share/android-commandlinetools/ndk/27.3.13750724} if [ ! -f "$CORE_REPOSITORY/Cargo.toml" ]; then echo "Canonical Peach Noise core not found: $CORE_REPOSITORY" >&2 exit 1 fi if [ ! -d "$NDK_HOME" ]; then echo "Android NDK not found: $NDK_HOME" >&2 exit 1 fi cd "$CORE_REPOSITORY" cargo fmt --check cargo test --locked cargo build --locked --release ANDROID_NDK_HOME="$NDK_HOME" cargo ndk \ --target arm64-v8a \ --target armeabi-v7a \ --target x86 \ --target x86_64 \ --platform 26 \ --output-dir "$ANDROID_REPOSITORY/app/src/main/jniLibs" \ build --locked --release shasum -a 256 "$ANDROID_REPOSITORY"/app/src/main/jniLibs/*/libpeach_noise_core.so