summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 20:52:50 -0300
committerGabriel Schneider <[email protected]>2026-11-18 21:22:58 -0300
commita75956bb3443aa8aac778d2ff12c42f5ef99e0e9 (patch)
tree17547cbf6606c8bd05be313cd8f835cb85d13e57 /build.zig
parent5b33c88476054fffc1044fff0526f7f0b28563cf (diff)
downloadpardes-a75956bb3443aa8aac778d2ff12c42f5ef99e0e9.tar.gz
pardes-a75956bb3443aa8aac778d2ff12c42f5ef99e0e9.zip
runtime: main, daemon, upgrade, crash, addon_test, 9p_io, 9p and macos.zig into runtime/ (the reorganisation's tree, step 2a), skill.txt with main.zig, its one reader: module `runtime` (runtime/root.zig) and the core, each naming the other, a product's root (main.zig, macos.zig) a module of its own over both; the files name across by module (`@import("runtime").daemon`, `@import("core").look`), pardes.zig exporting what they name (ctl, edit_cmd, tracy, selection_pipe, and the frontends until they move); core-test and shell-test run each module's test program, so the same tests run (the ledger: every named test of every suite the base's, tui and gui); nothing else changes: frames byte-identical, the same counts (tui core-test 822/963, the one more an anonymous collector)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig23
1 files changed, 15 insertions, 8 deletions
diff --git a/build.zig b/build.zig
index e7997363..dbc7e3ba 100644
--- a/build.zig
+++ b/build.zig
@@ -174,28 +174,32 @@ pub fn build(b: *std.Build) void {
// addons compiled in.
const compiled_in = target.result.os.tag != .linux;
// The macOS shell is a library whose host owns main(): it roots at
- // its own flat C ABI instead of src/main.zig. Tracy's client and BSD
+ // its own flat C ABI instead of runtime/main.zig. Tracy's client and BSD
// libutil go to the shell (and Tracy's to the core) alone, as before
// core.module.
- const root_mod = core.module(b, parts, .{ .root = if (platform == .macos) "src/macos.zig" else "src/main.zig", .config = opts, .builtin_addons = compiled_in, .tracy = true, .util = true });
+ const root_set = core.module(b, parts, .{ .root = if (platform == .macos) "runtime/macos.zig" else "runtime/main.zig", .config = opts, .builtin_addons = compiled_in, .tracy = true, .util = true });
+ const root_mod = root_set.root;
// hxdiff's headless core and pardes-isolate are the primary shell's
// configuration compiled two more ways, not two more frontends.
const core_cfg: core.Core = .{ .root = "src/pardes.zig", .config = opts, .builtin_addons = compiled_in, .tracy = true };
- const core_module = core.module(b, parts, core_cfg);
+ const core_set = core.module(b, parts, core_cfg);
+ const core_module = core_set.root;
// The core without the terminal module (docs/next-terminal.md, Phase 1):
// what core-test is compiled from. No ghostty-vt, wuffs, zstbi or C++;
// a shell boot is a scratch pane, a test that needs a terminal skips,
// and shell-test runs them all with one.
const lean_cfg: core.Core = .{ .root = "src/pardes.zig", .config = opts, .builtin_addons = compiled_in, .terminal = false };
const core_lean = core.module(b, parts, lean_cfg);
- const isolated_mod: ?*std.Build.Module = if (platform == .tui) core.module(b, parts, .{ .root = "src/main.zig", .config = opts, .builtin_addons = compiled_in, .isolated = true }) else null;
+ const isolated_mod: ?*std.Build.Module = if (platform == .tui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = opts, .builtin_addons = compiled_in, .isolated = true }).root else null;
// `zig build static`'s: the addons compiled in (Addon.zig). Linked
// statically on musl alone, as glibc links only dynamically; the gui's
// is dynamic (SDL and the GPU need the display's libraries) with the
// addons in it all the same.
const static_linkage: ?std.builtin.LinkMode = if (target.result.isMuslLibC()) .static else null;
- const static_mod: ?*std.Build.Module = if ((platform == .tui and static_linkage != null) or platform == .gui) core.module(b, parts, .{ .root = "src/main.zig", .config = opts, .builtin_addons = true }) else null;
- const gui_mod: ?*std.Build.Module = if (also_gui) core.module(b, parts, .{ .root = "src/main.zig", .config = a.gui_opts.?, .builtin_addons = compiled_in }) else null;
+ const static_set: ?core.Modules = if ((platform == .tui and static_linkage != null) or platform == .gui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = opts, .builtin_addons = true }) else null;
+ const static_mod: ?*std.Build.Module = if (static_set) |s| s.root else null;
+ const gui_set: ?core.Modules = if (also_gui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = a.gui_opts.?, .builtin_addons = compiled_in }) else null;
+ const gui_mod: ?*std.Build.Module = if (gui_set) |s| s.root else null;
if (a.pdf.lib) |lib| tools.pdfBenches(b, target, optimize, core_module, lib, pdf_pointer_bench_step, pdf_scroll_bench_step);
const builtins_json_step = docs.builtinsJson(b, requested_platform, platform, target, optimize, core_module, doc_renders);
@@ -205,7 +209,8 @@ pub fn build(b: *std.Build) void {
var sketchbook: ?*std.Build.Dependency = null;
if (also_gui or platform == .gui) {
const window = gui.make(b, target, optimize, macos_sdk, prebuilt_shaders, a.freetype);
- for ([_]?*std.Build.Module{ gui_mod, if (platform == .gui) root_mod else null, if (platform == .gui) static_mod else null }) |m| if (m) |gm| window.wire(gm);
+ // ...into the core, whose gui/gui.zig names the window.
+ for ([_]?core.Modules{ gui_set, if (platform == .gui) root_set else null, if (platform == .gui) static_set else null }) |m| if (m) |s| window.wire(s.core);
sketchbook = window.sketchbook;
}
const snake_shader_lib = addons.gpu(b, target, optimize, a.addon_mod, sketchbook);
@@ -292,6 +297,7 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
.ghostty_vt = a.ghostty_vt,
.cloud9 = parts.cloud9,
+ .runtime = core_set.runtime,
.gui = platform == .gui,
});
@@ -321,6 +327,7 @@ pub fn build(b: *std.Build) void {
tests.add(b, .{
.addon_mod = a.addon_mod,
.core_lean = core_lean,
+ .root_set = root_set,
.core_module = core_module,
.core_cfg = core_cfg,
.exe = exe,
@@ -350,7 +357,7 @@ pub fn build(b: *std.Build) void {
for (test_build.dependencies.items) |dep| {
const t = dep.cast(std.Build.Step.Compile) orelse continue;
const name = switch (t.root_module.root_source_file orelse continue) {
- .src_path => |p| std.fs.path.stem(p.sub_path),
+ .src_path => |p| if (std.mem.eql(u8, std.fs.path.basename(p.sub_path), "root.zig")) std.fs.path.basename(std.fs.path.dirname(p.sub_path).?) else std.fs.path.stem(p.sub_path),
else => t.name,
};
test_install.dependOn(&b.addInstallArtifact(t, .{ .dest_dir = .{ .override = .{ .custom = "test" } }, .dest_sub_path = name }).step);