diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -114,6 +114,17 @@ pub fn build(b: *std.Build) void { else requested_optimize; const test_build = b.step("test-build", "compile unit-test programs without running them"); + const doc_typ_opts = b.addOptions(); + doc_typ_opts.addOption([]const u8, "dir", b.pathFromRoot("docs/typ")); + const cheatsheet_step = b.step("cheatsheet", "render docs/typ/cheatsheet-a4.typ to <prefix>/share/doc/pardes/cheatsheet.pdf (needs typst)"); + if (b.findProgram(&.{"typst"}, &.{})) |typst| { + const render = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts" }); + render.addFileArg(b.path("docs/typ/cheatsheet-a4.typ")); + const pdf = render.addOutputFileArg("cheatsheet.pdf"); + render.addFileInput(b.path("docs/typ/cheatsheet.typ")); + render.addFileInput(b.path("docs/typ/style.typ")); + cheatsheet_step.dependOn(&b.addInstallFile(pdf, "share/doc/pardes/cheatsheet.pdf").step); + } else |_| cheatsheet_step.dependOn(&b.addFail("zig build cheatsheet needs typst on PATH").step); const test_nonce: ?*std.Build.Module = if (b.option(bool, "test-rebuild", "force fresh Zig test compilation while retaining cached C dependencies") orelse false) blk: { const files = b.addTempFiles(); const source = files.add("test_nonce.zig", b.fmt("pub const nonce = {d};\n", .{std.Io.Clock.awake.now(b.graph.io).nanoseconds})); @@ -931,6 +942,8 @@ pub fn build(b: *std.Build) void { iso_on.addOption(bool, "isolated", true); for (core_mods, core_shells) |mod, shell| { + // config.zig's test checks the words and keys docs/typ names exist. + mod.addOptions("doc_typ", doc_typ_opts); mod.addOptions("pardes_config", if (also_gui and shell == .gui) gui_opts.? else opts); mod.addOptions("pardes_isolation", if (isolated_mod == mod) iso_on else iso_off); if (shell == .gui) for (gui_shaders) |name| mod.addAnonymousImport( |
