From de013148d3c2c6b59c5dd035a3a72dd6132445c0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 24 Sep 2025 09:59:57 -0700 Subject: [PATCH] build: install the ghostty-vt artifact --- build.zig | 4 ++-- src/build/GhosttyLibVt.zig | 32 +++++++++----------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/build.zig b/build.zig index 5cef2df02..c6c461b4c 100644 --- a/build.zig +++ b/build.zig @@ -102,8 +102,8 @@ pub fn build(b: *std.Build) !void { b, &mod, ); - libghostty_vt_shared.install(libvt_step, "libghostty-vt"); - libghostty_vt_shared.installHeader(libvt_step); + libghostty_vt_shared.install(libvt_step); + libghostty_vt_shared.install(b.getInstallStep()); // Helpgen if (config.emit_helpgen) deps.help_strings.install(); diff --git a/src/build/GhosttyLibVt.zig b/src/build/GhosttyLibVt.zig index 85d71ae0f..eda49a38d 100644 --- a/src/build/GhosttyLibVt.zig +++ b/src/build/GhosttyLibVt.zig @@ -11,13 +11,13 @@ const LipoStep = @import("LipoStep.zig"); /// The step that generates the file. step: *std.Build.Step, +/// The artifact result +artifact: *std.Build.Step.InstallArtifact, + /// The final library file output: std.Build.LazyPath, dsym: ?std.Build.LazyPath, -/// Library extension, e.g. "dylib", "so", "dll" -ext: []const u8, - pub fn initShared( b: *std.Build, zig: *const GhosttyZig, @@ -27,6 +27,10 @@ pub fn initShared( .name = "ghostty-vt", .root_module = zig.vt, }); + lib.installHeader( + b.path("include/ghostty-vt.h"), + "ghostty-vt.h", + ); // Get our debug symbols const dsymutil: ?std.Build.LazyPath = dsymutil: { @@ -44,33 +48,15 @@ pub fn initShared( return .{ .step = &lib.step, + .artifact = b.addInstallArtifact(lib, .{}), .output = lib.getEmittedBin(), .dsym = dsymutil, - .ext = Config.sharedLibExt(target), }; } pub fn install( self: *const GhosttyLibVt, step: *std.Build.Step, - name: []const u8, ) void { - const b = self.step.owner; - const lib_install = b.addInstallLibFile( - self.output, - b.fmt("{s}.{s}", .{ name, self.ext }), - ); - step.dependOn(&lib_install.step); -} - -pub fn installHeader( - self: *const GhosttyLibVt, - step: *std.Build.Step, -) void { - const b = self.step.owner; - const header_install = b.addInstallHeaderFile( - b.path("include/ghostty-vt.h"), - "ghostty-vt.h", - ); - step.dependOn(&header_install.step); + step.dependOn(&self.artifact.step); }