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
+13
View File
@@ -46,6 +46,19 @@ ARGS=(
-w /work
)
# Build parallelism. A full cross-compile will otherwise take every thread on
# the host and make the machine unusable for the length of the build, which is
# a poor trade when it is running in the background.
#
# Both halves are needed: CARGO_BUILD_JOBS caps how many rustc processes cargo
# starts, while --cpus caps what the container gets no matter what any nested
# build script decides to spawn (cc, cmake, and ring's asm build all parallelise
# on their own account and do not consult cargo).
JOBS="${DARKROOM_BUILD_JOBS:-8}"
if [[ "${JOBS}" != "0" ]]; then
ARGS+=(--cpus "${JOBS}" -e "CARGO_BUILD_JOBS=${JOBS}")
fi
# Rootless podman already maps the host user; docker needs it stated.
if [[ "${ENGINE}" == "docker" ]]; then
ARGS+=(--user "$(id -u):$(id -g)")