aboutsummaryrefslogtreecommitdiff
path: root/build.zig
blob: c4a149fe492d9568fb2d60046fe6f5cfbb7a388f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const std = @import("std");

pub fn build(b: *std.Build) void {
    const generate_html = b.addExecutable(.{
        .name = "generate_html",
        .root_module = b.createModule(.{
            .root_source_file = b.path("util/generate_html.zig"),
            .target = b.graph.host,
        }),
    });

    const run_generate_html = b.addRunArtifact(generate_html);
    run_generate_html.setCwd(b.path("")); // make sure we always run from buildroot
    b.getInstallStep().dependOn(&run_generate_html.step);

    const bundle_html = b.addSystemCommand(&[_][]const u8{ "tar", "--exclude=pages.tar.gz", "-czvf", "html-out/pages.tar.gz", "html-out" });
    const run_bundle_html = b.step("bundle", "Creates a tarball of the HTML output");
    bundle_html.step.dependOn(b.getInstallStep());
    run_bundle_html.dependOn(&bundle_html.step);

    const serve = b.addSystemCommand(&[_][]const u8{ "lighttpd", "-Df", "util/lighttpd.conf" });
    const run_server = b.step("serve", "Run a local test server");
    serve.step.dependOn(b.getInstallStep());
    run_server.dependOn(&serve.step);

    const publish_to_prod = b.step("publish", "Publish the website to production");
    _ = publish_to_prod;
}