summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 04:37:18 -0300
committerGabriel Schneider <[email protected]>2026-11-20 04:38:20 -0300
commita3634ab3dbf2fabd997f137c47eafd7bc6c442b0 (patch)
tree202a888c08f7d2620805445653156e81ce813cde /build
parentfc9e2eaf5ad86719a3bc57d18ce4ad302461dfbd (diff)
downloadpardes-a3634ab3dbf2fabd997f137c47eafd7bc6c442b0.tar.gz
pardes-a3634ab3dbf2fabd997f137c47eafd7bc6c442b0.zip
build: build.zig reads like sketchbook's (pardes-build-2 item 4; the start design's 4.3 and 4.4): its head comment is a consumer's lines, both shapes (`pardes-syntax` with `.grammars = .minimal`, as computeranim's anim takes it; `pardes-editor` with `.grammars = .none, .editor = true` and a grammar of its own, as sketchbook's examples/live does) and what each option selects, and `build()` begins with what such a package may ask for, the mode and `grammars` (pardes's own build takes both too), then `if (!b.isRoot()) return library(...)` with the target and `editor`, which only a dependency declares: the root's target is not read there, since its default comes from -Dplatform (x86_64-linux-gnu.2.38, or the Mac's) and a package that passes none keeps the native one; build/library.zig is `library` at the foot of build.zig, the editor option read with the others and handed in (its body otherwise as it was); `-Deditor` stays a dependency's alone and the root's -Dgrammars help text is the head comment's words; lines: build.zig 361 -> 430 (26 of them the head comment), build/library.zig 49 -> 0, build.zig and build/ 2,971 -> 2,991; tui install, lib-test (the package still asks for `.grammars = .minimal, .editor = true`) and hxlib (538 cases, 0 mismatches) as before
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build')
-rw-r--r--build/library.zig49
1 files changed, 0 insertions, 49 deletions
diff --git a/build/library.zig b/build/library.zig
deleted file mode 100644
index 9a1bfb67..00000000
--- a/build/library.zig
+++ /dev/null
@@ -1,49 +0,0 @@
-const std = @import("std");
-const TreeSitterGrammars = @import("../build.zig").TreeSitterGrammars;
-const core = @import("core.zig");
-const patches = @import("patches.zig");
-
-/// pardes as a library, all a package that depends on it is given: the
-/// `pardes-syntax` module (core/lib_syntax.zig), the grammars, highlighting
-/// and themes for a program that draws source text itself. It takes
-/// tree-sitter and the grammars of its `grammars` option and no other
-/// dependency, so nothing else is fetched (build.zig.zon). test/lib is such
-/// a package, which `lib-test` builds.
-pub fn build(b: *std.Build) void {
- const target = b.standardTargetOptions(.{});
- const optimize = b.standardOptimizeOption(.{});
- const tree_sitter_grammars = b.option(TreeSitterGrammars, "grammars", "the tree-sitter grammars compiled in: none (the runtime alone), minimal (C, C++ and Zig) or full (all of them; the default)") orelse .full;
- var threaded: std.Io.Threaded = .init(b.allocator, .{});
- defer threaded.deinit();
- const io = threaded.io();
- const mod = b.addModule("pardes-syntax", .{
- .target = target,
- .optimize = optimize,
- .root_source_file = b.path("core/lib_syntax.zig"),
- .link_libc = true,
- });
- // A library's options: its grammars, nothing stamped, no window.
- const cfg: core.ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars };
- mod.addOptions("pardes_options", core.options(b, cfg, .{ .root = "core/lib_syntax.zig", .platform = .tui, .terminal = false }, false));
- const ts = core.treeSitter(b, io, target, if (optimize == .debug) .fast else optimize, tree_sitter_grammars);
- const themes = core.generatedThemes(b, io, target, optimize);
- mod.addImport("generated_themes", themes);
- ts.wire(mod);
- mod.addImport("c_heap", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("core/c_heap.zig") }));
- // The editor, `pardes-editor`, to a package that asks for it: uucode,
- // mvzr and vaxis (with what its build names) are fetched then and only
- // then. Of vaxis it takes the grapheme width, which uucode alone feeds.
- if (!(b.option(bool, "editor", "also export `pardes-editor`, the text pane as a library (fetches uucode, mvzr and vaxis)") orelse false)) return;
- const uucode = core.uucodeModule(b, target, optimize) orelse return;
- const mvzr = patches.mvzr(b, patches.tool(b), b.dependencyLazy("mvzr", .{ .target = target, .optimize = optimize }) catch return, target, optimize);
- const vaxis_dep = b.dependencyLazy("vaxis", .{ .target = target, .optimize = optimize, .external_uucode = true }) catch return;
- const width = b.addWriteFiles();
- _ = width.addCopyFile(vaxis_dep.path("src/gwidth.zig"), "gwidth.zig");
- const vaxis = b.createModule(.{
- .target = target,
- .optimize = optimize,
- .root_source_file = width.add("vaxis.zig", "pub const gwidth = @import(\"gwidth.zig\");\n"),
- .imports = &.{.{ .name = "uucode", .module = uucode }},
- });
- _ = core.editorModule(b, "pardes-editor", target, optimize, cfg, .{ .themes = themes, .ts = ts, .uucode = uucode, .mvzr = mvzr, .vaxis = vaxis });
-}