# Rebuild and relink

Use Python 3, GNU Make, CMake, Node 24, and the official Emscripten SDK 4.0.23 (LLVM/Binaryen/Node tools supplied by that SDK). No credentials or hosted service are required. Each source archive and numbered fragment is hashed in source/manifest.json. Concatenate numbered fragments in filename order before extraction; retain all notices.

1. Extract leaf-browser-integration.tar.gz into an empty project root. Run `npm ci` to obtain the pinned browser build tools. The included readable fflate browser source and its MIT notice match the bundled adapter.
2. Create artifacts/expansion/endless-sky and put the joined modern-source.tar.gz and libjpeg-turbo-2.1.0.tar.gz there. The preparation script validates pinned upstream hashes and extracts both. Ubuntu archives are supplementary notices/source, not native compilation inputs.
3. Activate the SDK. Run `python3 scripts/expansion/prepare-endless-sky.py`, then `bash scripts/expansion/build-endless-sky.sh /path/to/emsdk`. It compiles the original game and writes a completed-build marker after success. The matching SDL/libpng/zlib/mpg123 source archives, full Emscripten tools/ports definitions and generated config templates are supplied; the SDK normally retrieves those exact archives by their pinned SHA-512 values. Its OpenAL/WebGL/FS/libc/libc++ source is included, too.
4. Run `python3 scripts/expansion/package-endless-sky-resources.py`, then `python3 scripts/expansion/package-endless-sky.py /path/to/emsdk`. The default output is private artifacts/expansion/endless-sky/release-player. To reproduce the supplementary source bundle, put the two provided Ubuntu archives under their names in endless-sky-font-sources.json in the same artifacts directory. Serve the result with a static local HTTP server; gameplay does not use a server API.

For modifications/relinking, prepare once, then edit artifacts/expansion/endless-sky/engine/source or the preparation script and native library source. Rebuild the affected SDK port archive (clear its cached static library when changing it), run `make -C artifacts/expansion/endless-sky/engine -j4 endless-sky.js`, and run `python3 scripts/expansion/endless-sky-build-record.py write` after success. The complete prepared-engine-source.tar.gz also supplies the exact preferred native code and Makefile directly. The browser sources and package manifest hashes are editable; no private signing key is needed. The publication audit checks fidelity to this release and can be adjusted for a deliberately modified fork. Do not interpret that audit as a restriction on modifying the GPL/LGPL software.

Platform source files identify their changes; original source/resource notices stay in place. Retain UPSTREAM-COPYRIGHT.txt, GPL/LGPL/native library notices and separate font/image/audio permissions when distributing a modified build. No proprietary assets, credentials, browser saves or compiled user data are included in the source archives.
