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.
This commit is contained in:
Mitchell Hashimoto
2025-03-18 12:11:05 -07:00
parent 0f2f0ab69f
commit bab8c28c8b
6 changed files with 162 additions and 17 deletions

View File

@@ -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.