Redirect the per-channel build scratch to /dev/shm and skip UPX, a big win when building from a USB stick / SD card (I/O-bound on flash): - TMPDIR + PIP_CACHE_DIR -> tmpfs - PyInstaller: --workpath -> tmpfs (PYI_WORKPATH); UPX off via TESTIUM_NO_UPX - Flatpak: build dir + ostree repo -> tmpfs (FLATPAK_BUILDDIR/REPODIR); the .flatpak-builder download cache stays on disk - AppImage: bind-mount a tmpfs dir at the in-container AppDir path (APPIMAGE_APPDIR_TMPFS) Scratch is freed on exit. Each build.sh honors the env vars with on-disk defaults, so behavior is unchanged without --ram. With --ram, prefer --serial on RAM-limited machines (flatpak+appimage are ~1 GB each). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
2.0 KiB
Bash
Executable File
64 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build the testium AppImage inside a Debian container (Podman or Docker).
|
|
# The resulting .AppImage file is written to this directory.
|
|
|
|
set -e
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
APP_VERSION="$(<"$REPO_ROOT/src/VERSION")"
|
|
|
|
if command -v podman &>/dev/null; then
|
|
RUNTIME=podman
|
|
elif command -v docker &>/dev/null; then
|
|
RUNTIME=docker
|
|
else
|
|
echo "Error: neither podman nor docker found." >&2
|
|
exit 1
|
|
fi
|
|
echo "Using $RUNTIME — building testium $APP_VERSION AppImage..."
|
|
|
|
# APPIMAGE_APPDIR_TMPFS (set by build_all --ram) bind-mounts a host tmpfs dir at
|
|
# the AppDir build path, keeping the ~1 GB AppDir churn off slow storage.
|
|
APPDIR_MOUNT=""
|
|
if [ -n "$APPIMAGE_APPDIR_TMPFS" ]; then
|
|
mkdir -p "$APPIMAGE_APPDIR_TMPFS"
|
|
APPDIR_MOUNT="-v $APPIMAGE_APPDIR_TMPFS:/work/package/appimage/AppDir"
|
|
fi
|
|
|
|
# APPIMAGE_EXTRACT_AND_RUN=1 lets appimagetool run without FUSE in the container.
|
|
$RUNTIME run --rm \
|
|
--privileged \
|
|
-e APPIMAGE_EXTRACT_AND_RUN=1 \
|
|
-v "$REPO_ROOT:/work" \
|
|
$APPDIR_MOUNT \
|
|
-w /work/package/appimage \
|
|
debian:bookworm bash -c "
|
|
set -e
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
apt-get update -qq
|
|
apt-get install -y -qq \
|
|
python3 python3-pip python3-venv python3-build \
|
|
dpkg-dev fakeroot squashfs-tools wget curl file binutils \
|
|
libglib2.0-0 patchelf zsync > /dev/null
|
|
|
|
# Build the wheel
|
|
cd /work/src
|
|
python3 -m build --wheel --outdir dist/ > /dev/null
|
|
cd /work/package/appimage
|
|
|
|
# Install appimage-builder
|
|
pip3 install appimage-builder --quiet --break-system-packages
|
|
|
|
# Run the build
|
|
export APP_VERSION=$APP_VERSION
|
|
appimage-builder --recipe AppImageBuilder.yml --skip-test
|
|
"
|
|
|
|
APPIMAGE_FILE=$(ls -1t Testium-*-x86_64.AppImage 2>/dev/null | head -1)
|
|
echo "Done: ${APPIMAGE_FILE}"
|
|
|
|
if [ "${1}" = "install" ] && [ -n "${APPIMAGE_FILE}" ]; then
|
|
install -v "${APPIMAGE_FILE}" "${HOME}/.local/bin/testium"
|
|
fi
|