From c1990b3e6e196ad41379aa432bf3ccca8a65d9f0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 20 Sep 2026 00:36:50 -0300 Subject: Flatten the 9P control tree and move it out of fs.zig The served tree loses the self/ level: /index /ctl /new /log /screen /listeners /pane//... /os, with /src only in -Dembed-sources=true builds (default off, on for esp32p4). ctl speaks the editor's own language with two lowercase verbs, look TEXT and exec TEXT, plus acme's addr verbs; the new/ factory directory becomes one clone file; cons is gone (exec Msg); name and sel are files; stats report real lengths, modes and mtimes; /log streams pane new/del/rename/save events. The tree code lives in src/ninep/ (tree, pane, ctl, addr, pty, events, screen, sources); fs.zig keeps host access, mounts, resolution and find/grep. Same engine and transports. README (fs-help.txt) and docs rewritten; tests updated and extended. Co-Authored-By: Claude Fable 5.1 --- build.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index aeae7443..6734d9b0 100644 --- a/build.zig +++ b/build.zig @@ -104,6 +104,7 @@ pub fn build(b: *std.Build) void { ninep_options.addOption(bool, "quic", enable_quic); const enable_mupdf = b.option(bool, "mupdf", "native PDF rendering with MuPDF (AGPL/commercial; native default on, web/esp32p4 off; -Dmupdf=false disables)") orelse !freestanding_core; const enable_jpx = b.option(bool, "jpx", "JPEG 2000 in PDFs, for scanned documents (default on; -Djpx=false drops openjpeg)") orelse true; + const embed_sources = b.option(bool, "embed-sources", "serve the editor's own sources under /src of its 9P tree (default off; on for -Dplatform=esp32p4, whose only source is the device)") orelse is_esp32p4; const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding; const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding; const optimize = if (is_web) @@ -309,6 +310,7 @@ pub fn build(b: *std.Build) void { .esp32p4_rows = esp32p4_rows, .theme_animation = theme_animation, .prebuilt_shaders = prebuilt_shaders, + .embed_sources = embed_sources, .zig_lib_dir = b.graph.zig_lib_directory.path orelse "", .commit = gitCommit(b), }; @@ -600,8 +602,6 @@ pub fn build(b: *std.Build) void { if (shell == .macos) mod.addAnonymousImport("effect-source-crt.ci.metal", .{ .root_source_file = b.path("shaders/crt.ci.metal"), }); - mod.addAnonymousImport("root-build.zig", .{ .root_source_file = b.path("build.zig") }); - mod.addAnonymousImport("root-build.zig.zon", .{ .root_source_file = b.path("build.zig.zon") }); } const gui_shell_mod: ?*std.Build.Module = gui_mod orelse @@ -1435,6 +1435,7 @@ const ShellConfig = struct { /// the default is off for the board and on everywhere else. theme_animation: ?bool, prebuilt_shaders: bool, + embed_sources: bool, zig_lib_dir: []const u8, commit: ?[]const u8, }; @@ -1456,6 +1457,7 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build. // prevents Config/EffectCode from describing tty/macOS/web as "prebuilt". o.addOption(bool, "gui_shader_sources_prebuilt", platform == .gui and cfg.prebuilt_shaders); o.addOption([]const u8, "zls_version", if (cfg.zls_backend) zls_version else "none"); + o.addOption(bool, "embed_sources", cfg.embed_sources); o.addOption([]const u8, "version", zon.version); // ...and the commit it was built from, when there is one. See `gitCommit` // for why this is optional and why it is read at configure time. -- cgit v1.3