summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 620eb19b..73d86937 100644
--- a/build.zig
+++ b/build.zig
@@ -131,6 +131,17 @@ pub fn build(b: *std.Build) void {
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);
+ // The website: one Typst bundle run writes every page, the stylesheet,
+ // the fonts and the media (docs/site/site.typ). It reads all of docs/typ,
+ // docs/site and the tutor, so it always runs rather than track them.
+ const site_step = b.step("site", "render the docs website to <prefix>/share/doc/pardes/site (needs typst)");
+ if (b.findProgram(&.{"typst"}, &.{})) |typst| {
+ const render = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", b.pathFromRoot(".") });
+ render.addFileArg(b.path("docs/site/site.typ"));
+ const site = render.addOutputDirectoryArg("site");
+ render.has_side_effects = true;
+ site_step.dependOn(&b.addInstallDirectory(.{ .source_dir = site, .install_dir = .prefix, .install_subdir = "share/doc/pardes/site" }).step);
+ } else |_| site_step.dependOn(&b.addFail("zig build site 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}));