aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 8024f351ad20547d0255f06368063e9f434d0184
parent 69fb4c4751c7167c18edbd96ee810ec036ce771c
Author: anon <anon@example.com>
Date:   Mon,  9 Nov 2026 23:19:14 +0000

Add pinned offline WASM builder image

Diffstat:
MDEVELOPERS.md | 46++++++++++++++++++++++++++++++++++++++++++++++
Atools/client/Dockerfile.wasm | 18++++++++++++++++++
Atools/client/build_wasm_container.sh | 12++++++++++++
Atools/client/wasm-requirements.txt | 2++
4 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/DEVELOPERS.md b/DEVELOPERS.md @@ -499,6 +499,52 @@ gameplay validation continue. For native clients, keep the server running in a separate terminal and use the commands below. Players create accounts through the game. +### Build the browser client with Podman + +The archived builder is the preferred way to preserve the WASM build environment. +The Dockerfile pins the Linux amd64 Emscripten 6.0.12 image by digest and Brotli +by version and checksum. It also retains the checked audio source archives and +Emscripten ports, so client builds need no network access or host SDK. + +From the repository root, prepare the image once (requires network access): + +```sh +podman build -t localhost/ao-wasm:6.0.12 -f tools/client/Dockerfile.wasm tools/client +``` + +Build from a regular Git checkout, including any current source edits: + +```sh +mkdir -p local/wasm-output +podman run --rm --network=none \ + -v "$PWD:/source:ro" -v "$PWD/local/wasm-output:/output" \ + localhost/ao-wasm:6.0.12 +``` + +Use rootless Podman on Linux amd64. +The container copies only client sources and build scripts; it does not reuse +host object files, audio libraries or compiler caches. Each run performs a clean +client build with eight compiler/linker workers. Allow several gigabytes of disk +space, substantial compilation time and enough memory for linking. The six +published files appear in `local/wasm-output/`. After validation, copy that complete +bundle into `server/assets/client/` to publish it. + +Archive the prepared image and record its checksum alongside the source revision: + +```sh +podman save --format oci-archive -o local/ao-wasm-6.0.12.tar localhost/ao-wasm:6.0.12 +sha256sum local/ao-wasm-6.0.12.tar > local/ao-wasm-6.0.12.tar.sha256 +``` + +Keep both files in durable backup storage along with the repository. Restore with +`podman load -i local/ao-wasm-6.0.12.tar`, then use the same offline run command. +The Dockerfile alone still depends on upstream downloads remaining available. +Rebuild and archive the image when changing the SDK, audio dependencies or Brotli. +Validation on November 9, 2026: two independent clean offline builds produced +identical six-file bundles, and their runtime files matched the tracked bundle. +The archive loaded successfully and its checksum passed. Recheck byte-for-byte +reproducibility when changing build inputs. + ### Build the browser client on Debian Only the client build machine needs this toolchain. Install the native build diff --git a/tools/client/Dockerfile.wasm b/tools/client/Dockerfile.wasm @@ -0,0 +1,18 @@ +# Emscripten 6.0.12, including its SDK checkout and Linux amd64 build tools. +FROM docker.io/emscripten/emsdk:6.0.12@sha256:52549e68ad6dd0f3509ff378bc1a5d317d40030c8991919cada0dad95d85e00c + +COPY wasm-requirements.txt /opt/wasm-requirements.txt +RUN python3 -m pip install --require-hashes --only-binary=:all: \ + --target=/opt/wasm-python -r /opt/wasm-requirements.txt +ENV PYTHONPATH=/opt/wasm-python + +# Preserve downloaded sources, compiled audio libraries and Emscripten ports. +WORKDIR /build +RUN mkdir -p toolchains && ln -s /emsdk toolchains/emsdk +COPY build_wasm_dependencies.py tools/client/build_wasm_dependencies.py +RUN python3 tools/client/build_wasm_dependencies.py \ + && emcc local/wasm/dependency-probe.c -pthread -sUSE_ZLIB=1 \ + -o local/wasm/zlib-probe.js + +COPY build_wasm_container.sh /usr/local/bin/build-wasm +CMD ["bash", "/usr/local/bin/build-wasm"] diff --git a/tools/client/build_wasm_container.sh b/tools/client/build_wasm_container.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euo pipefail + +# Copy current sources without importing host toolchains or build caches. +tar -C /source --exclude=client/build -cf - .gitignore Makefile client tools/client \ + | tar -xf - +GIT_DIR=$(git -C /source rev-parse --absolute-git-dir) +export GIT_DIR GIT_WORK_TREE=/build + +# Keep all intermediate files inside the disposable container. +make wasm -j8 +cp server/assets/client/* /output/ diff --git a/tools/client/wasm-requirements.txt b/tools/client/wasm-requirements.txt @@ -0,0 +1,2 @@ +Brotli==1.1.0 \ + --hash=sha256:d0c5516f0aed654134a2fc936325cc2e642f8a0e096d075209672eb321cff408