summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
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);