Expand description
Android NDK toolchain resolution for the hot-patch link step.
Mirrors whisker-build/src/android.rs’s NDK lookup (deliberately
duplicated, not shared) so the dev-server doesn’t pull the
whole whisker-build crate into its dep tree just for two
helpers. The two implementations need to stay in sync — if NDK
layouts shift, both have to learn about the new shape.
What this module gives us:
- resolve the NDK root (env first, then
$ANDROID_HOME/ndk/<v>) - pick a host-tag for the toolchain bin dir
- locate
<prefix><api>-clangfor an ABI
Tier 1’s link step (build_link_plan + run_link_plan) uses the
returned clang as both linker_path (what we spawn) and
WHISKER_REAL_LINKER (what the linker shim forwards to during the
fat build). Same binary on both sides keeps SDK / sysroot
resolution consistent.
Functions§
- abi_
from_ jni_ libs_ path - Pure helper: convert an existing-on-disk dylib path under a
jniLibs tree to its ABI. Used by the patcher to figure out which
NDK clang to use without the caller having to plumb the ABI
separately. Returns
Noneif the path doesn’t fit the…/jniLibs/<abi>/lib<crate>.soshape. - android_
clang_ for - Locate the NDK clang for
(abi, api). The returned path is the API-pinned wrapper (e.g.aarch64-linux-android21-clang) — bothBuilder::with_capture(asWHISKER_REAL_LINKER) and the thin-rebuild link step (aslinker_path) need this same binary. - android_
home - Find the Android SDK root. Honours
ANDROID_HOME; otherwise falls back to the macOS default install location. - clang_
target_ prefix - clang’s
--target=<prefix><api>prefix per ABI. Differs from the Rust triple forarmeabi-v7a(clang wantsarmv7a-linux-androideabi). - host_
tag - NDK toolchain host tag (
darwin-x86_64/linux-x86_64/ …). NDK shipsdarwin-x86_64even on Apple Silicon. - ndk_
bin_ dir <NDK>/toolchains/llvm/prebuilt/<host>/bin. Pulled out so future helpers (llvm-ar, ranlib, lld-link) don’t have to recompose it.- ndk_
home - Find the NDK root.
ANDROID_NDK_HOMEwins; otherwise picks the first installed entry from [PREFERRED_NDKS] under<ANDROID_HOME>/ndk/.