diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-27 16:42:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-27 22:09:08 -0300 |
| commit | 98b62629795e24de19f535f1072b8a25dcf9f018 (patch) | |
| tree | fedea7e9b6648236220c054c30e6d2b4f8938288 /build.zig.zon | |
| parent | 147ebd4a36ec7199074ba05bcfb79d4a656c0b74 (diff) | |
| download | pardes-98b62629795e24de19f535f1072b8a25dcf9f018.tar.gz pardes-98b62629795e24de19f535f1072b8a25dcf9f018.zip | |
build: pardes builds without the ESP32-P4 toolchain checkout beside it
`build.zig.zon` named `../05-zig-p4` as a path dependency, and `build.zig`
`@import`ed it inside `if (-Desp32p4-firmware)`. But `@import` in a build script
is resolved when the SCRIPT is compiled, not when the branch that needs it is
taken -- so naming the package at all meant anyone without that sibling checkout
could not build pardes AT ALL. Not the firmware: the terminal shell, the SDL
shell, the tests. `zig build` failed with
build.zig:1073: error: no module named 'zig_p4' available within module 'root.@build'
from a line inside an `if` that was false.
Neither escape hatch works for a PATH dependency, and both were tried rather
than assumed. `.lazy = true` is about FETCHING; a path dep whose directory is
absent is generated as a package with no `build.zig` rather than one marked
unavailable, so `b.lazyImport` -- which exists for exactly this and is what the
standard library says is to `@import` what `lazyDependency` is to `dependency`
-- reaches a `@compileError` instead of returning null. Making it a fetched
dependency instead is not available either: the toolchain has no remote.
So the duplicate goes. That build tree's firmware block linked an image the
toolchain repository already knows how to link -- its own build.zig has
`-Dpardes`, `-Dapp=<root>` and `-Dpardes-obj=<path>`, and its comments record
having learned this same lesson from the other direction, where nesting pardes's
~30-package graph under it broke every build there. The object is the seam: it
crosses by PATH and never by package, and each repository builds what it owns
the pieces of.
zig build -Dplatform=esp32p4 # here, no toolchain needed
zig build -Dpardes # there, the console image
zig build -Dpardes -Dapp=<pardes>/src/esp32p4_9p.zig # there, the 9P image
For the second and third to work with no module map, `src/board9p.zig` and the
9P firmware root now reach the codec by PATH instead of through a named `ninep`
module that only pardes's own build.zig knew to inject -- which is also why the
root moved from `src/esp32p4/nine.zig` up to `src/esp32p4_9p.zig`, beside
`src/esp32p4.zig`: a path import may not escape its module's own directory. Both
files are now self-contained, and `zig test src/board9p.zig` works with no flags.
`-Desp32p4-port`, `-Desp32p4-prof` and `-Desp32p4-cpu-mhz` go with the block. An
option this build cannot honour is worse than no option, because it accepts the
flag and then ignores it; all three are spelled the same way in the toolchain.
Verified by moving ../05-zig-p4 out of the way: `zig build`, `zig build
-Dplatform=esp32p4` and `zig build unit-test` all pass without it. With it back,
the toolchain still links both images -- console 812,720 B, 9P 88,096 B.
next-steps.txt gains the six features the 9P chain shipped.
Diffstat (limited to 'build.zig.zon')
| -rw-r--r-- | build.zig.zon | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/build.zig.zon b/build.zig.zon index 380a5d8a..2d745db6 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -179,24 +179,6 @@ .url = "git+https://github.com/allyourcodebase/freetype#884fd2235e6ae1ec4306eda30b3259f20930ed2e", .hash = "freetype-2.14.3-C3-WdXSKAAB-kHs4qgRoeoFnRkNQn6M_SSlUGZ6ywgBQ", }, - // The ESP32-P4 toolchain: the SoC/HAL/register layer, the generated - // linker script, the ELF->image builder, the ROM flasher and the - // interactive serial console. A PATH dependency, because it is a - // sibling checkout rather than something to pin a commit of, and - // because the firmware build reads an ESP-IDF checkout off this - // machine anyway. - // - // Safe to declare unconditionally, and that is measured rather than - // assumed. The failure this whole seam exists to avoid runs the OTHER - // way: nesting THIS package's ~30-package graph under that one broke - // every build there (std/Build.zig:2091's comptime branch quota over - // the enlarged dependency table, plus seven cached tree_sitter - // versions whose build.zig no longer compiles on 0.16) — see - // src/esp32p4.zig:8-15. In this direction there is nothing to enlarge: - // zig_p4 declares no dependencies at all, so it adds exactly zero - // packages here, and its `build()` early-returns when it is not the - // root package. Not lazy, because `build.zig` @imports it. - .zig_p4 = .{ .path = "../05-zig-p4" }, }, .minimum_zig_version = "0.16.0", .paths = .{""}, |
