summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-03-18 12:11:05 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-03-18 12:41:55 -0700
commitbab8c28c8b4df612a05902cea1eef950ae4a840b (patch)
tree6dcd2c5e438f1f0725cf7eef00115a68dc383511 /build.zig
parent0f2f0ab69f65941ab85c0563abdc5583d1983527 (diff)
`zig build dist` and `distcheck` for source tarballs
This moves the source tarball creation process into the Zig build system and follows the autotools-standard naming conventions of `dist` and `distcheck`. The `dist` target creates a source tarball in the `PREFIX/dist` directory. The tarball is named `ghostty-VERSION.tar.gz` as expected by standard source tarball conventions. The `distcheck` target does the same as `dist`, but also takes the resulting tarball, extracts it, and runs tests on the extracted source to verify the source tarball works as expected. This commit also updates CI: 1. Tagged releases now use the new `zig build distcheck` command. 2. Tip releases now use the new `zig build dist` command. 3. A new test build tests that source tarball generation works on every commit.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig30
1 files changed, 18 insertions, 12 deletions
diff --git a/build.zig b/build.zig
index 280f15de9..0751bab51 100644
--- a/build.zig
+++ b/build.zig
@@ -15,25 +15,31 @@ pub fn build(b: *std.Build) !void {
// Ghostty dependencies used by many artifacts.
const deps = try buildpkg.SharedDeps.init(b, &config);
- const exe = try buildpkg.GhosttyExe.init(b, &config, &deps);
if (config.emit_helpgen) deps.help_strings.install();
+ // Ghostty executable, the actual runnable Ghostty program.
+ const exe = try buildpkg.GhosttyExe.init(b, &config, &deps);
+
// Ghostty docs
- if (config.emit_docs) {
- const docs = try buildpkg.GhosttyDocs.init(b, &deps);
- docs.install();
- }
+ const docs = try buildpkg.GhosttyDocs.init(b, &deps);
+ if (config.emit_docs) docs.install();
// Ghostty webdata
- if (config.emit_webdata) {
- const webdata = try buildpkg.GhosttyWebdata.init(b, &deps);
- webdata.install();
- }
+ const webdata = try buildpkg.GhosttyWebdata.init(b, &deps);
+ if (config.emit_webdata) webdata.install();
// Ghostty bench tools
- if (config.emit_bench) {
- const bench = try buildpkg.GhosttyBench.init(b, &deps);
- bench.install();
+ const bench = try buildpkg.GhosttyBench.init(b, &deps);
+ if (config.emit_bench) bench.install();
+
+ // Ghostty dist tarball
+ const dist = try buildpkg.GhosttyDist.init(b, &config);
+ {
+ const step = b.step("dist", "Build the dist tarball");
+ step.dependOn(dist.install_step);
+ const check_step = b.step("distcheck", "Install and validate the dist tarball");
+ check_step.dependOn(dist.check_step);
+ check_step.dependOn(dist.install_step);
}
// If we're not building libghostty, then install the exe and resources.