The setup's builds name every path relative to the build kit, so a moved game folder rebuilds incrementally (#845)

tools/build_game.py --portable writes build.ninja paths on the tools' drive relative to the kit, also through '..'
(the generated C and objects in build-cache/work), names the compiler, windres and ar the same way (backslashes:
CreateProcess does not find a relative program with forward slashes), and passes clang -resource-dir and --sysroot
relative to the kit, because clang names its own headers by its absolute folder whatever argv[0] says. The Ninja deps
log then holds no absolute path. installer/steps.py build_args passes --portable for the build kit.

Measured on an install moved after a portable build: the rebuild compiled modules.c only, 3.5 s; before, the move cost
a full compile of 430 objects (335 s on 12 cores). Without --portable build.ninja is byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-17 11:57:12 +03:00
1 parent 8c9c18a6d2
commit e7c901b864
5 files changed
+61 -13

No files matched your search

+7 -5
View File
@@ -142,11 +142,13 @@ cheats or ExeFS patch files the build lacks, `totk.exe` runs it at start and exi
failed or cancelled rebuild offers to start the game with the code it has; `build-cache/rebuild.skip` then keeps the
same files from starting it again, until "Rebuild the game now" on the Cheats or Mods tab. A command that does not start
at all leaves no `rebuild.skip`, so the next start tries it again. `[mods] mods_rebuild = off` turns it off. A moved
install folder keeps working, but its first rebuild compiles everything once: Ninja's records hold the old absolute
paths of the generated C and of the compiler's own headers. On Linux the command starts the AppImage file itself
(`$APPIMAGE --rebuild <install folder>`), because the AppImage's mounted folder is gone once the setup exits; a moved or
deleted AppImage means running a setup again. Installs set up by an AppImage before this change hold a command into that
mount: running the new setup once on the install folder writes the new one.
install folder keeps its incremental rebuild: the kit's builds run `tools/build_game.py --portable`, whose Ninja file
and deps log name every path relative to the kit (3.5 s to rebuild after a move instead of a full compile). A build with
a mod plugin names the plugin's file by its absolute path (`recomp/layout.py`), so after a move the game finds it gone
and runs the rebuild once. On Linux the command starts the AppImage file itself (`$APPIMAGE --rebuild <install
folder>`), because the AppImage's mounted folder is gone once the setup exits; a moved or deleted AppImage means running
a setup again. Installs set up by an AppImage before this change hold a command into that mount: running the new setup
once on the install folder writes the new one.
## Command line
+1 -1
View File
@@ -81,7 +81,7 @@ ahead of time, so these patches are built into `totk.exe`:
3. After the rebuild the mod switches on and off from the Mods tab like any other, without another rebuild.
The rebuild runs from `build-kit` in the game folder, which the setup put there: the setup folder can be deleted
and the game folder moved. The first rebuild after a move compiles the whole game once (several minutes). A game
and the game folder moved. After a move, a game with a code plugin mod rebuilds once at its next start. A game
installed by an older setup (no `build-kit` in its folder) still rebuilds from that setup folder until a newer
setup runs once on it.
`mods_rebuild = off` under `[mods]` in `totk.ini` turns the automatic rebuild off.