fix(android,build): restore multi-ABI build via cmake-rs patch (DEC-032 exit)

Closes DEC-032. Restores the canonical Android ABI set
{arm64-v8a, armeabi-v7a, x86_64} per SDD-073 item 4 / SDD-118 item 3.

Root cause was the audiopus_sys + cmake-rs + NDK toolchain-file gap:
cargo-ndk 4.x sets ANDROID_ABI / ANDROID_PLATFORM as env vars per
invocation, but upstream cmake-rs 0.x does not forward them to the
child cmake invocation as -D variables, so armeabi-v7a and x86_64
configure steps fell through to the toolchain-file default and
failed to build.

Fix:
- Cargo.toml: add a workspace [patch.crates-io] stanza pinning the
  cmake crate to fork pr2502/cmake-rs @ commit
  bdad5edc569d82151922c5c6c4685b1563f12aa1 (branch android-build),
  which carries cmake-rs PR #257
  (https://github.com/rust-lang/cmake-rs/pull/257). The patch is a
  9-line addition that forwards ANDROID_ABI and ANDROID_PLATFORM
  from the env to the child cmake as -D variables.
- Cargo.lock: regenerated by 'cargo update -p cmake'; the lone
  cmake entry now points at the fork rev.
- apps/chanora_flutter/android/app/build.gradle.kts: restore
  abiFilters to {arm64-v8a, armeabi-v7a, x86_64}; remove the
  TODO(x86_64/armv7 follow-up) comment.
- docs/governance/product-decision-register.md: mark DEC-032 as
  Resolved (2026-05-18) with the resolution mechanism, update the
  §3 / §7 rows, and append a 0.9.8.1 change-history entry.

Verification (host: Linux):
  cargo update -p cmake                          -> pulled fork rev
  cargo check --workspace --all-targets          -> PASS
  cargo test --workspace                         -> PASS (no regressions)
  cargo ndk --platform 28 -t arm64-v8a build -p chanora_bridge   -> PASS
  cargo ndk --platform 28 -t armeabi-v7a build -p chanora_bridge -> PASS
  cargo ndk --platform 28 -t x86_64 build -p chanora_bridge      -> PASS

Upstream tracking: re-evaluate the [patch.crates-io] override once
cmake-rs PR #257 merges and a fresh cmake release lands on
crates.io; at that point switch to a plain dep bump and remove the
override.
This commit is contained in:
EdisonJwa
2026-05-18 14:48:16 +08:00
parent 167aef5760
commit 477394d83e
4 changed files with 58 additions and 14 deletions
+17
View File
@@ -62,3 +62,20 @@ readme = "README.md"
thiserror = "2"
tracing = "0.1"
serde = { version = "1", features = ["derive"] }
# DEC-032 exit step: override the `cmake` crate with the fork carrying
# cmake-rs PR #257 (https://github.com/rust-lang/cmake-rs/pull/257).
# The patch forwards `ANDROID_ABI` and `ANDROID_PLATFORM` environment
# variables (set per-invocation by cargo-ndk >= 4.x and reinforced by
# our SDD-118 item 5 cleanEnv map) to the child `cmake` invocation as
# `-D` variables, so audiopus_sys's libopus CMake build picks up the
# correct per-ABI target on multi-ABI Android builds. Without it the
# child cmake falls through to the NDK toolchain file's default and
# armeabi-v7a / x86_64 fail to compile.
#
# Pinned by exact commit SHA (the `android-build` branch tip on
# pr2502/cmake-rs as of 2026-05-18) so the patch is reproducible.
# Re-evaluate and remove once PR #257 merges and a fresh `cmake`
# release lands on crates.io (current upstream is 0.7.2).
[patch.crates-io]
cmake = { git = "https://github.com/pr2502/cmake-rs", rev = "bdad5edc569d82151922c5c6c4685b1563f12aa1" }