From f8c6d45755acb5abf9ac68931268b7945da0fae0 Mon Sep 17 00:00:00 2001 From: t Date: Mon, 15 Jun 2026 22:11:53 -0600 Subject: display fixes: markdown rendering, tool-specific components --- build.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'build.zig') 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`. -- cgit v1.3