#!/usr/bin/env bash # Builds the app inside a Debian container and stages an install in build//stage, # ready to copy to the Steam Frame. # # scripts/container-build.sh cross x86_64 host → aarch64, uses the target's # system Qt 6.8.x (default way to deploy) # scripts/container-build.sh native same for the host's own architecture # (run on the Frame for a native arm64 build) # scripts/container-build.sh cross-bundle / native-bundle # self-contained: Qt bundled (fallback if the # target's Qt doesn't fit) # scripts/container-build.sh shell interactive shell in that container # # Uses podman if available, else docker (override with CONTAINER_ENGINE). set -euo pipefail root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" mode="${1:-}" case "$mode" in cross) dockerfile=cross-arm64.Dockerfile; preset=cross-arm64 ;; native) dockerfile=native.Dockerfile; preset=native-systemqt ;; cross-bundle) dockerfile=cross-arm64.Dockerfile; preset=cross-arm64-bundle ;; native-bundle) dockerfile=native.Dockerfile; preset=native-bundle ;; *) echo "usage: $0 cross|native|cross-bundle|native-bundle [shell]" >&2; exit 2 ;; esac image="frameassistant-build-${dockerfile%.Dockerfile}" engine="${CONTAINER_ENGINE:-$(command -v podman || command -v docker)}" "$engine" build -q -t "$image" -f "$root/docker/$dockerfile" "$root/docker" >/dev/null run=("$engine" run --rm -v "$root:$root:z" -w "$root") if [[ "$(basename "$engine")" == docker ]]; then run+=(--user "$(id -u):$(id -g)") else run+=(--userns=keep-id) fi [[ -t 0 ]] && run+=(-it) if [[ "${2:-}" == shell ]]; then exec "${run[@]}" "$image" bash fi "${run[@]}" "$image" bash -c " set -e cmake --preset $preset cmake --build --preset $preset rm -rf build/$preset/stage cmake --install build/$preset --prefix build/$preset/stage " echo "Staged: $root/build/$preset/stage"