aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/build/GhosttyZig.zig
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
commitdcfe11a7588fcd42471159453810abc9b7720a57 (patch)
treec32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/src/build/GhosttyZig.zig
parent2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff)
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround. expose the new selection formatter and hyperlink uri apis for follow-up rendering work. add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/src/build/GhosttyZig.zig')
-rw-r--r--vendor/libghostty-vt/src/build/GhosttyZig.zig62
1 files changed, 53 insertions, 9 deletions
diff --git a/vendor/libghostty-vt/src/build/GhosttyZig.zig b/vendor/libghostty-vt/src/build/GhosttyZig.zig
index 4901180d..44c300e1 100644
--- a/vendor/libghostty-vt/src/build/GhosttyZig.zig
+++ b/vendor/libghostty-vt/src/build/GhosttyZig.zig
@@ -11,6 +11,9 @@ const TerminalBuildOptions = @import("../terminal/build_options.zig").Options;
vt: *std.Build.Module,
vt_c: *std.Build.Module,
+/// The libghostty-vt version
+version: std.SemanticVersion,
+
/// Static library paths for vendored SIMD dependencies. Populated
/// only when the dependencies are built from source (not provided
/// by the system via -Dsystem-integration). Used to produce a
@@ -22,8 +25,46 @@ pub fn init(
cfg: *const Config,
deps: *const SharedDeps,
) !GhosttyZig {
+ return initInner(b, cfg, deps, "ghostty-vt", "ghostty-vt-c");
+}
+
+/// Create a new GhosttyZig with modules retargeted to a different
+/// architecture. Used to produce universal (fat) binaries on macOS.
+pub fn retarget(
+ self: *const GhosttyZig,
+ b: *std.Build,
+ cfg: *const Config,
+ deps: *const SharedDeps,
+ target: std.Build.ResolvedTarget,
+) !GhosttyZig {
+ _ = self;
+ const retargeted_config = try b.allocator.create(Config);
+ retargeted_config.* = cfg.*;
+ retargeted_config.target = target;
+
+ const retargeted_deps = try b.allocator.create(SharedDeps);
+ retargeted_deps.* = try deps.retarget(b, target);
+
+ // Use unique module names to avoid collisions with the original target.
+ const arch_name = @tagName(target.result.cpu.arch);
+ return initInner(
+ b,
+ retargeted_config,
+ retargeted_deps,
+ b.fmt("ghostty-vt-{s}", .{arch_name}),
+ b.fmt("ghostty-vt-c-{s}", .{arch_name}),
+ );
+}
+
+fn initInner(
+ b: *std.Build,
+ cfg: *const Config,
+ deps: *const SharedDeps,
+ vt_name: []const u8,
+ vt_c_name: []const u8,
+) !GhosttyZig {
// Terminal module build options
- var vt_options = cfg.terminalOptions();
+ var vt_options = cfg.terminalOptions(.lib);
vt_options.artifact = .lib;
// We presently don't allow Oniguruma in our Zig module at all.
// We should expose this as a build option in the future so we can
@@ -34,7 +75,7 @@ pub fn init(
return .{
.vt = try initVt(
- "ghostty-vt",
+ vt_name,
b,
cfg,
deps,
@@ -43,7 +84,7 @@ pub fn init(
),
.vt_c = try initVt(
- "ghostty-vt-c",
+ vt_c_name,
b,
cfg,
deps,
@@ -55,6 +96,8 @@ pub fn init(
&simd_libs,
),
+ .version = cfg.lib_version,
+
.simd_libs = simd_libs,
};
}
@@ -76,13 +119,14 @@ fn initVt(
.target = cfg.target,
.optimize = cfg.optimize,
- // SIMD require libc/libcpp (both) but otherwise we don't care.
- // On MSVC, we must not use linkLibCpp because Zig passes
- // -nostdinc++ and adds its bundled libc++/libc++abi headers
- // which conflict with MSVC's C++ runtime. The MSVC SDK dirs
- // added via link_libc contain both C and C++ headers.
+ // SIMD requires libc. Vendored C++ dependencies are built with
+ // no-libcxx mode (HWY_NO_LIBCXX / SIMDUTF_NO_LIBCXX) so we
+ // don't need libcpp. System-provided simdutf headers still
+ // use C++ stdlib headers, so we need libcpp in that case.
.link_libc = if (cfg.simd) true else null,
- .link_libcpp = if (cfg.simd and cfg.target.result.abi != .msvc) true else null,
+ .link_libcpp = if (cfg.simd and
+ b.systemIntegrationOption("simdutf", .{}) and
+ cfg.target.result.abi != .msvc) true else null,
});
vt.addOptions("build_options", general_options);
vt_options.add(b, vt);