#!/bin/sh set -eu SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ANDROID_REPOSITORY=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd) CORE_REPOSITORY=${1:-${PEACH_NOISE_CORE_DIR:-"$ANDROID_REPOSITORY/../peach-browser/crypto-core"}} CARGO_FEATURES=${PEACH_NOISE_CORE_FEATURES:-} # shellcheck source=scripts/rust-toolchain.sh . "$SCRIPT_DIR/rust-toolchain.sh" require_pinned_rust_toolchain if [ ! -f "$CORE_REPOSITORY/Cargo.toml" ] || [ ! -f "$CORE_REPOSITORY/Cargo.lock" ]; then echo "Canonical Peach Noise core manifest/lock not found: $CORE_REPOSITORY" >&2 exit 1 fi if [ -n "$CARGO_FEATURES" ]; then (cd "$CORE_REPOSITORY" && cargo build --locked --release --features "$CARGO_FEATURES") else (cd "$CORE_REPOSITORY" && cargo build --locked --release) fi PROVENANCE_DIRECTORY="$ANDROID_REPOSITORY/build/provenance" mkdir -p "$PROVENANCE_DIRECTORY" HOST_LIBRARY="$CORE_REPOSITORY/target/release/libpeach_noise_core.dylib" { echo "rustc=$PINNED_RUSTC_VERSION" echo "cargo=$PINNED_CARGO_VERSION" echo "cargo_toml_sha256=$(hash_file "$CORE_REPOSITORY/Cargo.toml")" echo "cargo_lock_sha256=$(hash_file "$CORE_REPOSITORY/Cargo.lock")" echo "rust_sources_sha256=$(hash_rust_sources "$CORE_REPOSITORY/src")" echo "target=aarch64-apple-darwin" echo "host_library_sha256=$(hash_file "$HOST_LIBRARY")" } > "$PROVENANCE_DIRECTORY/noise-core-host.txt"