summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-15 22:11:53 -0600
committert <t@tjp.lol>2026-06-16 11:17:14 -0600
commitf8c6d45755acb5abf9ac68931268b7945da0fae0 (patch)
treea88ed7edd4aa3e5acced9ff99ac61b7f36b267a6 /build.zig
parent8206642d3a1736aaf928a5b9a732e747f5294228 (diff)
display fixes: markdown rendering, tool-specific components
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 87901c6..ceebee1 100644
--- a/build.zig
+++ b/build.zig
@@ -34,6 +34,10 @@ pub fn build(b: *std.Build) void {
.@"thread-pool" = false,
});
+ // Markdown parser for TUI rendering. MD4C is a small, permissively
+ // licensed C CommonMark parser; Zig owns only terminal rendering.
+ const md4c_dep = b.dependency("md4c", .{});
+
// Fetch upstream Lua source (used both for our static library and
// staged at runtime as the `include/` headers under $PANTO_HOME).
// Reproducibility comes from the content-addressed hash in
@@ -102,6 +106,7 @@ pub fn build(b: *std.Build) void {
// table for `dlopen`'d rocks to resolve.
addLuaSources(exe_mod, lua_src, lua_anchor_path);
exe_mod.addIncludePath(lua_src.path("src"));
+ addMd4c(exe_mod, md4c_dep);
// Compile lua.c (the upstream standalone interpreter, ~600 lines)
// as a separate static library so we can route the `panto lua`
@@ -156,6 +161,7 @@ pub fn build(b: *std.Build) void {
}));
addLuaSources(test_mod, lua_src, lua_anchor_path);
test_mod.addIncludePath(lua_src.path("src"));
+ addMd4c(test_mod, md4c_dep);
test_mod.linkLibrary(lua_repl);
const unit_tests = b.addTest(.{
@@ -172,6 +178,20 @@ pub fn build(b: *std.Build) void {
test_step.dependOn(&lib_test_step.step);
}
+fn addMd4c(mod: *std.Build.Module, md4c_dep: *std.Build.Dependency) void {
+ const cflags = [_][]const u8{
+ "-std=c99",
+ "-Wall",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ };
+ mod.addCSourceFile(.{
+ .file = md4c_dep.path("src/md4c.c"),
+ .flags = &cflags,
+ });
+ mod.addIncludePath(md4c_dep.path("src"));
+}
+
/// Compile a thin wrapper around the upstream `lua.c` standalone
/// interpreter that exposes `pmain` for panto's `lua` subcommand to
/// invoke against a pre-configured `lua_State`.