upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorbhimio rice <bhimio@bhimio.xyz>2026-11-23 20:57:32 -0500
committerbhimio rice <bhimio@bhimio.xyz>2026-11-23 20:59:34 -0500
commit8e9708fd5fc8dada98efeb76ccdc9f78e03b94e3 (patch)
tree42ea78a02c547bcd34488a1c969978b25c00b119 /docs
parent6fbb25e4de7e895205e8ba240c5af6e57305846a (diff)
docs(linux): a Linux page: what runs natively, the packages, Build.sh, the runtime under Wine
docs/linux.md gathers what a Linux user needs in one place: which pieces run natively and which run under Wine or Proton, with the CI job that checks each; the Ubuntu 26.04 packages for each stage (no .NET 8 SDK is packaged there, and the .NET 10 SDK builds rpf9dump through global.json's roll-forward); ./Build.sh; the clang-cl + xwin cross-build of gta6rt; and why there is no native Linux gta6rt (imports bind to host Windows DLLs, Windows x64 ABI, RtlAddFunctionTable, the TLS host DLL, a vectored exception handler), which is the work Wine already does. README's How to build and Platforms rows and docs/README.md link it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md1
-rw-r--r--docs/linux.md114
2 files changed, 115 insertions, 0 deletions
diff --git a/docs/README.md b/docs/README.md
index 133f1ab13..9b2d0114e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -11,6 +11,7 @@ method, scope and caveats. No game data is included.
11| [design.md](design.md) | Overall project design, asset status, translator contract and open blockers. | 11| [design.md](design.md) | Overall project design, asset status, translator contract and open blockers. |
12| [related_projects.md](related_projects.md) | Prior art we may read and the licence boundaries on it. | 12| [related_projects.md](related_projects.md) | Prior art we may read and the licence boundaries on it. |
13| [rpf.md](rpf.md) | RPF9 archive layout, the carve tools and the unreadable encrypted TOC. | 13| [rpf.md](rpf.md) | RPF9 archive layout, the carve tools and the unreadable encrypted TOC. |
14| [linux.md](linux.md) | Linux in one page: what runs natively and what runs under Wine or Proton, the Ubuntu packages, `Build.sh`, the runtime cross-build, and why there is no native Linux `gta6rt`. |
14| [testing.md](testing.md) | Running the GPU tests on your own GPU: setup per OS, wave64 emulation, running without a GPU on Mesa llvmpipe, and known problems. | 15| [testing.md](testing.md) | Running the GPU tests on your own GPU: setup per OS, wave64 emulation, running without a GPU on Mesa llvmpipe, and known problems. |
15| [modding.md](modding.md) | The mod format: `mods/<folder>/mod.json`, checked and loaded in name order by `gta6rt`; a swap takes effect once the game's archetype lookup is hooked (needs the executable, RT-5). A mod names game models and holds no game data. | 16| [modding.md](modding.md) | The mod format: `mods/<folder>/mod.json`, checked and loaded in name order by `gta6rt`; a swap takes effect once the game's archetype lookup is hooked (needs the executable, RT-5). A mod names game models and holds no game data. |
16| [progress_dashboard.md](progress_dashboard.md) | A local page of what works, what changed since it last passed and what blocks next: unit and runtime tests, the translator contract by confirmation method, measured imports, corpus counts and, with `--github`, CI and the D3D- items (`tools/progress_dashboard.py`). | 17| [progress_dashboard.md](progress_dashboard.md) | A local page of what works, what changed since it last passed and what blocks next: unit and runtime tests, the translator contract by confirmation method, measured imports, corpus counts and, with `--github`, CI and the D3D- items (`tools/progress_dashboard.py`). |
diff --git a/docs/linux.md b/docs/linux.md
new file mode 100644
index 000000000..e7ca27455
--- /dev/null
+++ b/docs/linux.md
@@ -0,0 +1,114 @@
1# Linux
2
3What a Linux user (x86-64, a Vulkan GPU) can do today, from one page: the build of the shaders and assets runs
4natively, the Vulkan test tools build natively with GCC or Clang, and the loader (`gta6rt`) is a Windows program that
5runs under Wine or Proton. Nothing is playable on any platform yet (README, *Project status*).
6
7The package names below were checked on Ubuntu 26.04 LTS. Other distributions have the same tools under their own
8names; the build lists anything it can't find before it starts.
9
10## What runs where
11
12| Piece | On Linux | How it is checked |
13|---|---|---|
14| `make_game.py`: check, shaders, assets, pipelines | Native | CI (`stdlib-tests-linux`, `translator-tests`, `semantic-tests`) |
15| `Build.sh`, `Mods.sh` | Native (`/bin/sh`) | `tests/test_shell_launchers.py`, in the standard-library loop of `stdlib-tests-linux` |
16| Shader translator, its tests and the GPU test tools (`vk_harness`, `vk_pipeline_check`, ...) | Native, GCC or Clang | CI (`linux-gpu-tools`: GCC, tests on llvmpipe); Clang builds them too, but no CI job uses it yet |
17| `rpf9dump` (asset export) | Native, .NET 8 or newer | CI builds it on Windows only (the `check` job) |
18| `gta6rt`, its shims and their tests | Windows program, under Wine or Proton | Cross-built with clang-cl and xwin; CI runs the Windows build under Wine on pushes to `main` |
19
20## Build the port
21
22Install the prerequisites (Ubuntu 26.04; the comment says what each is for):
23
24```sh
25sudo apt install git python3 \
26 llvm-21 spirv-tools \
27 dotnet-sdk-10.0 \
28 cmake ninja-build g++ libvulkan-dev \
29 ffmpeg zenity python3-tk
30# git, python3 the clone and make_game.py (Python 3.12 or newer)
31# llvm-21, spirv-tools the shaders stage: llvm-mc with the AMDGPU target, spirv-as and spirv-val
32# dotnet-sdk-10.0 the assets stage builds rpf9dump; Ubuntu 26.04 packages no .NET 8 SDK, and 10 builds the
33# net8.0 project through global.json's roll-forward
34# cmake ... libvulkan-dev the pipelines stage builds vk_pipeline_check
35# ffmpeg optional: XMA2 audio and --wav
36# zenity, python3-tk optional: the --pick folder dialog and the mod manager window
37```
38
39Then, with your own copy of the game already readable on disk:
40
41```sh
42git clone --recursive https://github.com/ubiquitarianism/leonida
43cd leonida
44./Build.sh --find # list the copies found: the home folder, Downloads, Documents, /mnt, /media/<user>, ...
45./Build.sh --check # check your copy, build nothing
46./Build.sh # build into ~/Documents/Leonida
47```
48
49`./Build.sh` is `python3 -I make_game.py` with the newest Python 3.12+ it finds, so every `make_game.py` option in
50the README works with it (`--game`, `--out`, `--work`, `--stages`, ...). Without the cross-build tools below, the
51default stages leave `runtime` out (`check,shaders,assets,pipelines`).
52
53Notes:
54
55- **llvm-mc**: Debian and Ubuntu's `llvm-21` installs it only as `llvm-mc-21` and `/usr/lib/llvm-21/bin/llvm-mc`.
56 With `LLVM_MC` unset the tools use the plain `llvm-mc` when it is on `PATH` and otherwise the newest of those
57 versioned names (`tools/mc_command.py`). Set `LLVM_MC` to choose another one.
58- **File names are case-sensitive.** The build opens the package's files by their exact names
59 (`MicrosoftGame.Config`, `Catalog000.bin`, ...). A copy whose names changed case on the way is reported with the
60 name it found and the one it needs; nothing is renamed for you.
61- **Mods**: `./Mods.sh` opens the mod manager window ([modding.md](modding.md)); `python3 -I tools/leonida_mods.py`
62 is the same manager on the command line.
63
64## The runtime, under Wine or Proton
65
66`gta6rt` is a Windows program. To build it on Linux, add the LLVM cross tools and an MSVC CRT and Windows SDK laid
67out by [xwin](https://github.com/Jake-Shadle/xwin) (running xwin downloads them from Microsoft and means accepting
68Microsoft's licence):
69
70```sh
71sudo apt install clang-21 lld-21 llvm-21 wine
72xwin --accept-license --sdk-version 10.0.26100 splat --use-winsysroot-style --preserve-ms-arch-notation \
73 --output ~/.local/share/xwin-sdk
74./Build.sh --stages runtime
75```
76
77On Ubuntu 24.04, `clang-cl-<N>` is in `clang-tools-<N>` instead ([testing.md](testing.md#known-problems)).
78`make_game.py` finds the five tools under one version suffix (`clang-cl-21`, `lld-link-21`, `llvm-lib-21`,
79`llvm-rc-21`, `llvm-mt-21`) or their plain names. Without the SDK it lists what is missing before any work starts.
80`--runtime-build <folder>` takes a Windows build made elsewhere instead, such as the `runtime-windows` artifact of the
81Runtime workflow. The stage writes `<out>/gta6rt.sh`, which starts `gta6rt.exe` with `wine` or the Wine named by `WINE`
82(for Proton, its `files/bin/wine`); README, *Running the loader on Linux*, has the commands.
83[testing.md](testing.md#the-windows-runtime-on-linux-under-wine-or-proton) has the test runs under Wine and Proton
84and what fails there.
85
86### Why there is no native Linux `gta6rt`
87
88A native (ELF) loader is not a matter of build flags:
89
90- The loader shims only the console's own modules and a few Win32 entry points it has to own (GDK, XMem,
91 `d3d12_xs`, the library loader, the process and file-system shims). Every other import binds to the host's Windows
92 DLLs unchanged (`runtime/src/pe_loader.cpp`; [runtime_imports.md](runtime_imports.md): `XboxBvhBuilder.dll`
93 alone binds 4 imports to shims and 53 to the host). On Linux, those host DLLs are what Wine provides.
94- The mapped code uses the Windows x64 calling convention and the Windows thread and exception model: the loader
95 registers unwind tables with `RtlAddFunctionTable`, keeps a module TLS slot through `gta6rt_tls_host.dll`, and
96 `main.cpp` installs a vectored exception handler. The shims are written against `windows.h`.
97
98A Linux-native host would have to reimplement each of those Win32 APIs, which is the work Wine already does, so the
99supported way is the Windows build under Wine or Proton with the D3D12 layer on native Vulkan. What does build
100natively is everything that doesn't touch Win32: the Vulkan tools and the portable runtime pieces with their tests
101(`ctest` on a Linux build runs them, including the root-signature model and the host CPU check).
102
103## Build and test without the game
104
105```sh
106cmake -S runtime -B runtime/build/linux -G Ninja # CC=clang CXX=clang++ for Clang
107cmake --build runtime/build/linux --parallel
108ctest --test-dir runtime/build/linux --output-on-failure # Vulkan tests run on Mesa's lavapipe without a GPU
109python3 -I scripts/run_semantic_tests.py tests/semantic # translator suite
110python3 -I tests/test_<name>.py # one standard-library test
111```
112
113[testing.md](testing.md) covers the GPU tests (`scripts/run_gpu_tests.py`), running them on llvmpipe, and choosing
114the GPU.