Establishes the v0.1 foundations on both platforms: - dr-types: SourceRef (never a filesystem path — Android SAF has none), Format, Availability, Validator with ETag quote normalisation - dr-gpu: wgpu device, compute pass writing a storage texture, resize - dr-ui: Slint shell with FR-UI-1 adaptive layout, computed in Rust to avoid a binding loop - docker/android: pinned toolchain, verified producing API 28 ARM binaries Measured the cost of the temporary CPU readback path (dr-gpu bench): compute is 0.06-0.28ms across sizes while readback is 0.63-7.43ms, so readback is 90-96% of frame time and scales with area. Recorded in ARCH §6.1 — this is why spike S1 is the priority. Mitigations pending S1: reuse the staging buffer, apply at most one resize per frame, and cap render resolution at 2048 on the long edge. 10 tests passing; core crates cross-compile for aarch64-linux-android.
60 lines
1.8 KiB
Bash
Executable File
60 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run a command inside the DarkRoom Android build container.
|
|
#
|
|
# ./docker/android/build.sh cargo ndk -t arm64-v8a build --release
|
|
# ./docker/android/build.sh cargo check --target aarch64-linux-android
|
|
# ./docker/android/build.sh # interactive shell
|
|
#
|
|
# Builds the image on first use. Rebuild after editing the Dockerfile with:
|
|
# ./docker/android/build.sh --rebuild
|
|
set -euo pipefail
|
|
|
|
IMAGE="darkroom-android:latest"
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO="$(cd "${HERE}/../.." && pwd)"
|
|
|
|
# Prefer podman (rootless by default); fall back to docker.
|
|
if command -v podman >/dev/null 2>&1; then
|
|
ENGINE=podman
|
|
elif command -v docker >/dev/null 2>&1; then
|
|
ENGINE=docker
|
|
else
|
|
echo "error: neither podman nor docker found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${1:-}" == "--rebuild" ]]; then
|
|
shift
|
|
"${ENGINE}" build -t "${IMAGE}" "${HERE}"
|
|
elif ! "${ENGINE}" image exists "${IMAGE}" 2>/dev/null && \
|
|
! "${ENGINE}" image inspect "${IMAGE}" >/dev/null 2>&1; then
|
|
echo "==> building ${IMAGE} (first run; several minutes)"
|
|
"${ENGINE}" build -t "${IMAGE}" "${HERE}"
|
|
fi
|
|
|
|
# Persist the cargo registry and target dir across runs, or every build
|
|
# re-downloads the crate index.
|
|
CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}/darkroom-android"
|
|
mkdir -p "${CACHE}/registry" "${CACHE}/target"
|
|
|
|
ARGS=(
|
|
--rm
|
|
-v "${REPO}:/work:z"
|
|
-v "${CACHE}/registry:/opt/cargo/registry:z"
|
|
-v "${CACHE}/target:/work/target-android:z"
|
|
-e CARGO_TARGET_DIR=/work/target-android
|
|
-w /work
|
|
)
|
|
|
|
# Rootless podman already maps the host user; docker needs it stated.
|
|
if [[ "${ENGINE}" == "docker" ]]; then
|
|
ARGS+=(--user "$(id -u):$(id -g)")
|
|
fi
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
ARGS+=(-it)
|
|
set -- /bin/bash
|
|
fi
|
|
|
|
exec "${ENGINE}" run "${ARGS[@]}" "${IMAGE}" "$@"
|