Add the Android app shell; cap cross-build parallelism

Cap both halves of the container build: CARGO_BUILD_JOBS limits how many
rustc processes cargo starts, while --cpus limits what the container gets
regardless of what nested build scripts spawn — cc, cmake, and ring's asm
build all parallelise on their own account and do not consult cargo. Without
both, a full cross-compile takes every thread on the host and makes the
machine unusable for the length of a background build.

Assisted-by: LLM
This commit is contained in:
2026-08-09 21:10:00 +02:00
parent 170252cfc9
commit 5dc1279429
5 changed files with 274 additions and 8 deletions
+28
View File
@@ -0,0 +1,28 @@
[package]
name = "darkroom-android"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
# A cdylib, not a bin: Android loads the app as a shared library and calls
# `android_main` through android-activity's glue. Nothing execs a binary, so
# there is no `main` to provide.
[lib]
name = "darkroom"
crate-type = ["cdylib"]
[dependencies]
# No backend feature to select: dr-ui picks its Slint backend from the target,
# so building for aarch64-linux-android gets android-activity automatically.
dr-ui.workspace = true
anyhow.workspace = true
log.workspace = true
android_logger = "0.15"
[features]
# Mirrors darkroom-desktop: the CPU readback path stays on until spike S1
# lands zero-copy. On Adreno this is the same wrong path as on desktop, only
# with less memory bandwidth to absorb it (ARCH §6.1).
default = ["readback"]
readback = ["dr-ui/readback"]
+36
View File
@@ -0,0 +1,36 @@
//! DarkRoom Android entry point.
//!
//! The counterpart to `darkroom-desktop`'s `main`, with two differences that
//! come from the platform rather than from choice:
//!
//! * There are no command-line paths. Android's SAF hands out document URIs,
//! not filesystem paths (ARCH §6.9), so the viewer opens with an empty
//! browsing list and the library grid is the only way in.
//! * Logging goes to logcat. `env_logger` writes to stderr, which Android
//! discards.
/// TRACES: M-13 | M-14
/// Android application entry point, called by android-activity's glue.
#[no_mangle]
fn android_main(app: slint::android::AndroidApp) {
android_logger::init_once(
android_logger::Config::default()
.with_max_level(log::LevelFilter::Info)
.with_tag("DarkRoom"),
);
log::info!("DarkRoom v{}", env!("CARGO_PKG_VERSION"));
if let Err(e) = slint::android::init(app) {
log::error!("Slint Android backend failed to initialise: {e}");
return;
}
// Empty rather than the desktop's argv: see the module note above.
//
// Returning from `android_main` ends the process, so a failure here is
// logged rather than propagated — there is no shell to show `Err` to.
if let Err(e) = dr_ui::run(Vec::new()) {
log::error!("DarkRoom exited with error: {e:#}");
}
}