diff options
| author | Rosa <rosaontheweb@proton.me> | 2026-05-27 19:47:23 -0400 |
|---|---|---|
| committer | Rosa <rosaontheweb@proton.me> | 2026-05-27 19:47:23 -0400 |
| commit | 600e21fa5c4e232f135b7728b111f6268f95a71f (patch) | |
| tree | 7cc2ab46b8039b4b5fb0a07a798e1a90d9b7784e /build.zig | |
| parent | 13b2ec0cd728ea55e393806c0032e24bc11ed9f5 (diff) | |
write a crappy little cgi program for form processing
Diffstat (limited to '')
| -rw-r--r-- | build.zig | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -2,13 +2,29 @@ const std = @import("std"); const webgen = @import("webgen"); pub fn build(b: *std.Build) void { + const optimize = b.standardOptimizeOption(.{}); + const target = b.standardTargetOptions(.{}); + const run_webgen = webgen.installHtmlStep(b); run_webgen.addDirectoryArg(b.path("src")); - const bundle_html = b.addSystemCommand(&[_][]const u8{ "tar", "--exclude=pages.tar.gz", "-czvf", "html-out/pages.tar.gz", "html-out" }); + const cgi_app = b.addExecutable(.{ + .name = "submit.cgi", + .root_module = b.createModule(.{ + .optimize = optimize, + .root_source_file = b.path("src/cgi/submit.zig"), + .target = target, + }), + }); + b.installArtifact(cgi_app); + const run_cgi = b.step("run_cgi", "Run the CGI application"); + run_cgi.dependOn(&b.addRunArtifact(cgi_app).step); + + const bundle_html = b.addSystemCommand(&.{ "tar", "--exclude=pages.tar.gz", "-czvf", "html-out/pages.tar.gz", "html-out", "zig-out" }); bundle_html.step.dependOn(&run_webgen.step); b.getInstallStep().dependOn(&bundle_html.step); - const serve = b.addSystemCommand(&[_][]const u8{ "lighttpd", "-Df", "util/lighttpd.conf" }); + const serve = b.addSystemCommand(&.{ "lighttpd", "-Df" }); + serve.addFileArg(b.path("util/lighttpd.conf")); const run_server = b.step("serve", "Run a local test server"); serve.step.dependOn(b.getInstallStep()); run_server.dependOn(&serve.step); @@ -19,11 +35,12 @@ pub fn build(b: *std.Build) void { copy_bundle.addFileArg(b.path("html-out/pages.tar.gz")); copy_bundle.addArg("debian@www.eviltransgenders.club:pages.tar.gz"); - const unpack_bundle = b.addSystemCommand(&.{ - "ssh", - "debian@www.eviltransgenders.club", - "cp pages.tar.gz /var/www/www.eviltransgenders.club && cd /var/www/www.eviltransgenders.club && tar -xvf /var/www/www.eviltransgenders.club/pages.tar.gz" - }); + const unpack_bundle = b.addSystemCommand(&.{ "ssh", "debian@www.eviltransgenders.club", "cp pages.tar.gz /var/www/www.eviltransgenders.club && cd /var/www/www.eviltransgenders.club && tar -xvf /var/www/www.eviltransgenders.club/pages.tar.gz" }); unpack_bundle.step.dependOn(©_bundle.step); publish_to_prod.dependOn(&unpack_bundle.step); + + const clean_html = b.addSystemCommand(&.{"rm", "-r"}); + clean_html.addFileArg(b.path("html-out")); + clean_html.addFileArg(b.path("zig-out")); + b.getUninstallStep().dependOn(&clean_html.step); } |
