From 96c414521a95e9c236e4ef5725fdf7f0bf7e1fe9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 26 Mar 2026 07:03:00 -0700 Subject: [PATCH] build: add cmake build verification to lib-vt distcheck Run cmake configure and build on the extracted lib-vt tarball as part of distcheck to ensure the CMake wrapper works from the stripped archive. Keep dist/cmake/ and dist/libghostty-vt/ in the archive since the CMake build needs them. --- src/build/GhosttyDist.zig | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/build/GhosttyDist.zig b/src/build/GhosttyDist.zig index 3c09c9490..448047f4b 100644 --- a/src/build/GhosttyDist.zig +++ b/src/build/GhosttyDist.zig @@ -72,7 +72,7 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyDist { // --add-file uses the most recent --prefix to determine the path // in the archive to copy the file (the directory only). git_archive.addArg(b.fmt("--prefix={s}-{f}/{s}/", .{ - name, cfg.version, + name, cfg.version, std.fs.path.dirname(resource.dist).?, })); git_archive.addPrefixedFileArg("--add-file=", copied); @@ -153,6 +153,23 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyDist { check_test.step.dependOn(&check_path.step); } + // For lib-vt, also verify the CMake build works from the tarball. + if (cfg.emit_lib_vt) { + const cmake_build_dir = extract_dir.path(b, "cmake-build"); + const cmake_configure = b.addSystemCommand(&.{ "cmake", "-B" }); + cmake_configure.addDirectoryArg(cmake_build_dir); + cmake_configure.setCwd(extract_dir); + cmake_configure.expectExitCode(0); + cmake_configure.step.dependOn(&check.step); + + const cmake_build = b.addSystemCommand(&.{ "cmake", "--build" }); + cmake_build.addDirectoryArg(cmake_build_dir); + cmake_build.expectExitCode(0); + cmake_build.step.dependOn(&cmake_configure.step); + + check_test.step.dependOn(&cmake_build.step); + } + return .{ .archive = output, .install_step = &install.step, @@ -168,7 +185,10 @@ const lib_vt_excludes = &[_][]const u8{ // App and platform resources "images", "macos", - "dist", + "dist/doxygen", + "dist/linux", + "dist/macos", + "dist/windows", "flatpak", "snap", "po",