README: how to build Linux and Android, the 855 / 849 gates, 45 contract exports

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJUFwdiGCHipsxLkgxssSR
This commit is contained in:
donnyandClaude Fable 5.1 committed 2026-10-15 10:34:59 -07:00
1 parent 73aecf9c15
commit 3f2e2c3e72
1 file changed
+38 -1
+38 -1
View File
@@ -11,6 +11,8 @@ library per platform, `ygol-engine`, behind a written contract. Proposal 47 in t
| `core/` | The rules core (C++, Lua 5.4 inside). Plain directory, no submodule. |
| `server/` | The duel server (C++, libevent) with its third-party sources vendored inside. Its premake builds the core from `../core`. |
| `build/windows.ps1` | Builds `out/win64/ygol-engine.dll` (+ `engine.json`), checks the contract header, runs the export gate. |
| `build/Dockerfile` | The Linux x64 and Android arm64 builds, targets `linux` and `android`, same checks and gates. |
| `build/linux.sh`, `build/android.sh` | Run the Docker targets into `out/linux-x64/` and `out/android-arm64/`. Need Docker and nothing else. |
| `contract/` | The contract: `engine-contract.md` (the one spec), `ocgapi.h` (the public header), `probe-feature-messages.py` (the wire gate), `lua-reference/` (the generated Lua API). |
| `CHANGELOG.md` | One row per contract change; the replayed patches 0001-0024 first. |
@@ -79,7 +81,7 @@ pwsh C:\ygol-engine\build\windows.ps1 -Version v0.0.1
The script FAILS unless the DLL exports exactly **334** symbols: `start_server`, `stop_server`,
`ygol_engine_version`, and the core's whole C API re-exported, including the six `ygol_sb_*` Sandbox
exports and `ygol_preview_attack` (44 contract exports + 289 `sqlite3_*`; see the contract). A different count means the wrong tree, not "a small difference". For the
exports and `ygol_preview_attack` (45 contract exports + 289 `sqlite3_*`; see the contract). A different count means the wrong tree, not "a small difference". For the
record: the Unity repo's old `ygoserver.dll` exported 327 because its build applied patch 0008
(the `ygol_sb_*` six) only to `ocgcore.dll`, never to the server's own core copy; with one core they
are in the one library.
@@ -88,6 +90,41 @@ The wire probe (`python contract/probe-feature-messages.py --dll out/win64/ygol-
the Unity repo root because the library reads `./expansions`) checks the fork's messages and
capability bits against a running server.
## Build (Linux and Android)
Both run in Docker from `build/Dockerfile`; the host needs Docker and nothing else (not this
Windows VM: it has no nested virtualisation). From a clean clone on any Linux box:
```bash
./build/linux.sh v0.0.1 # out/linux-x64/libygol-engine.so, ygoserver, engine.json
./build/android.sh v0.0.1 # out/android-arm64/libygol-engine.so, engine.json
```
- The argument is the version `ygol_engine_version()` returns (`local` when not given).
- Base image: Ubuntu 22.04 pinned by digest. Its glibc (2.35) is the floor of the outputs: they
run on Ubuntu 22.04, Debian bookworm and anything newer, not on Ubuntu 20.04 (a bookworm build
would need 2.36; bullseye, 2.31, is end of life and its package pool is gone); premake
5.0.0-beta8 bootstrapped from its tag; every dependency built from the vendored
sources (`BUILD_ALL`), libevent configured by its own generated `configure`
(`.ci/configure-libevent.sh`; `server/event/build-aux/` is the tarball's, put back for it).
`obj/`, `bin/`, `build/` are wiped before every compile.
- Linux builds the tree twice: the library (`SERVER_PRO3_SUPPORT`, `libygol-engine.so`) and the
plain server executable (project `ygopro`, with the zip support and tag surrender confirm PRO3
turns on, so it carries the same rules), renamed `ygoserver`; it is what the server repo's
`duel-server` runs. `-static-libstdc++ -static-libgcc`, AVX2 like the Windows build.
- Android: NDK r23b (`23.1.7779620`, the build id in the shipped `.so`, pinned by sha1), API
level 26, arm64 only, upstream's `exec_android_pro3` job. One library; `libocgcore.so` is not
built any more.
- The same contract-header check runs first, and the same export gate runs last, with the plain C
export count (`nm --dynamic --defined-only --extern-only`, names without a leading underscore; C++
symbols are `_Z`-mangled) and every name in `contract/ocgapi.h` present. Expected: **Linux 855**,
**Android 849** (the shipped Android server had 842: 841 + `ygol_preview_attack`; one core adds
the six `ygol_sb_*` and `ygol_engine_version`; `lua_*`, `event_*`, `z*`, ... count on these
platforms, unlike on Windows, so the numbers differ from 334; Linux has one more than Android,
`evutil_secure_rng_add_bytes`, which libevent only builds where glibc has no `arc4random`, so the
number belongs to the pinned base image). `engine.json` is written the same way as on Windows. A
`docker build` that fails the gate leaves nothing in `out/`.
## Line endings
The repo stores LF (`core.autocrlf=false` when importing; `git archive` on a machine with