diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
| commit | dcfe11a7588fcd42471159453810abc9b7720a57 (patch) | |
| tree | c32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/pkg/simdutf/build.zig | |
| parent | 2dfed860103c4e4505ac7f25def9fe37da1e1e6a (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/pkg/simdutf/build.zig')
| -rw-r--r-- | vendor/libghostty-vt/pkg/simdutf/build.zig | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/vendor/libghostty-vt/pkg/simdutf/build.zig b/vendor/libghostty-vt/pkg/simdutf/build.zig index e132507a..0859edc2 100644 --- a/vendor/libghostty-vt/pkg/simdutf/build.zig +++ b/vendor/libghostty-vt/pkg/simdutf/build.zig @@ -3,6 +3,7 @@ const std = @import("std"); pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); + const no_libcxx = b.option(bool, "no_libcxx", "Set SIMDUTF_NO_LIBCXX to avoid libc++ dependency") orelse false; const lib = b.addLibrary(.{ .name = "simdutf", @@ -12,16 +13,23 @@ pub fn build(b: *std.Build) !void { }), .linkage = .static, }); + lib.addIncludePath(b.path("vendor")); lib.linkLibC(); - // On MSVC, we must not use linkLibCpp because Zig unconditionally - // passes -nostdinc++ and then adds its bundled libc++/libc++abi - // include paths, which conflict with MSVC's own C++ runtime headers. - // The MSVC SDK include directories (added via linkLibC) contain - // both C and C++ headers, so linkLibCpp is not needed. - if (target.result.abi != .msvc) { + libcpp: { + if (target.result.abi == .msvc) { + // On MSVC, we must not use linkLibCpp because Zig unconditionally + // passes -nostdinc++ and then adds its bundled libc++/libc++abi + // include paths, which conflict with MSVC's own C++ runtime headers. + // The MSVC SDK include directories (added via linkLibC) contain + // both C and C++ headers, so linkLibCpp is not needed. + break :libcpp; + } + + // We link libcpp even with no_libcxx because simdutf requires + // libc++ headers at build time. But it doesn't require libc++ + // at runtime. For Ghostty itself, we have CI tests to verify this. lib.linkLibCpp(); } - lib.addIncludePath(b.path("vendor")); if (target.result.os.tag.isDarwin()) { const apple_sdk = @import("apple_sdk"); @@ -37,14 +45,31 @@ pub fn build(b: *std.Build) !void { defer flags.deinit(b.allocator); // Zig 0.13 bug: https://github.com/ziglang/zig/issues/20414 // (See root Ghostty build.zig on why we do this) - try flags.appendSlice(b.allocator, &.{ - "-DSIMDUTF_IMPLEMENTATION_ICELAKE=0", + try flags.append(b.allocator, "-DSIMDUTF_IMPLEMENTATION_ICELAKE=0"); - // Fixes linker issues for release builds missing ubsanitizer symbols + // Fixes linker issues for release builds missing ubsanitizer symbols + try flags.appendSlice(b.allocator, &.{ "-fno-sanitize=undefined", "-fno-sanitize-trap=undefined", }); + if (no_libcxx) { + try flags.append(b.allocator, "-DSIMDUTF_NO_LIBCXX"); + if (target.result.abi != .msvc) { + // Clang/GCC-only flags; MSVC doesn't accept these. + try flags.append(b.allocator, "-fno-exceptions"); + try flags.append(b.allocator, "-fno-rtti"); + } + + lib.root_module.addCMacro("SIMDUTF_NO_LIBCXX", "1"); + } + + if (target.result.abi == .msvc) { + // On MSVC we skip linkLibCpp (see above), so the C++ standard is + // not set implicitly. simdutf requires C++17, so set it explicitly. + try flags.append(b.allocator, "-std=c++17"); + } + if (target.result.os.tag == .freebsd or target.result.abi == .musl) { try flags.append(b.allocator, "-fPIC"); } |
