summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 23:33:40 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:18 -0300
commit0623947ca0a0a8a0fca32780c4c7d4ee09328606 (patch)
treeca1eb7fb6fea74124567c4008b0c116db42d452b
parentd93579184a16f72e14e5bfdc4551b89e6217b70d (diff)
downloadpardes-0623947ca0a0a8a0fca32780c4c7d4ee09328606.tar.gz
pardes-0623947ca0a0a8a0fca32780c4c7d4ee09328606.zip
-Dplatform=esp32p4 with another -Dtarget is refused, as build.zig meant: the check reads the target asked for, not the board's pinned one
The refusal compared the resolved target, which build.zig pins to the board for esp32p4, so it could never fire and -Dtarget=x86_64-linux built firmware anyway, silently. It now reads -Dtarget as given and refuses any target but riscv32-freestanding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--build.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index c6f9dc2a..85cc29cc 100644
--- a/build.zig
+++ b/build.zig
@@ -179,7 +179,11 @@ pub fn build(b: *std.Build) void {
if (!is_web and (is_web_target or target.result.os.tag == .emscripten)) return failBuild(b, web_step, "wasm browser targets require -Dplatform=web");
if (platform == .web and dump_path == null) return failBuild(b, web_step, "-Dplatform=web requires -Ddump=<dump.zon> (the browser has no ptys; state replays from an embedded dump)");
if (enable_mupdf and is_web) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tty/Kitty and gui/SDL backends");
- if (is_esp32p4 and !is_esp32p4_target) return failBuild(b, web_step, "-Dplatform=esp32p4 requires -Dtarget=riscv32-freestanding (ESP32-P4 firmware)");
+ // The board's target is pinned (`target` above), so what is asked of
+ // -Dtarget is checked, not what was resolved: another arch is refused,
+ // not silently built for the board anyway.
+ const requested_board = requested_target.result.cpu.arch == .riscv32 and requested_target.result.os.tag == .freestanding;
+ if (is_esp32p4 and !requested_board) return failBuild(b, web_step, "-Dplatform=esp32p4 requires -Dtarget=riscv32-freestanding (ESP32-P4 firmware)");
if (enable_mupdf and is_esp32p4) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tty/Kitty and gui/SDL backends");
if (is_esp32p4 and requested_grammars != null and requested_grammars.? != .disabled) return failBuild(b, web_step, "-Dplatform=esp32p4 has no tree-sitter: the grammars' parse tables are megabytes and the flash partition is 1.5 MiB (-Dtree-sitter=disabled)");