diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/pkg/simdutf | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/pkg/simdutf')
| -rw-r--r-- | vendor/libghostty-vt/pkg/simdutf/build.zig | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/vendor/libghostty-vt/pkg/simdutf/build.zig b/vendor/libghostty-vt/pkg/simdutf/build.zig index 0859edc2..3efc0826 100644 --- a/vendor/libghostty-vt/pkg/simdutf/build.zig +++ b/vendor/libghostty-vt/pkg/simdutf/build.zig @@ -10,26 +10,21 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .target = target, .optimize = optimize, + .link_libc = true, + // 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. + // + // 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. + .link_libcpp = target.result.abi != .msvc, }), .linkage = .static, }); - lib.addIncludePath(b.path("vendor")); - lib.linkLibC(); - 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.root_module.addIncludePath(b.path("vendor")); if (target.result.os.tag.isDarwin()) { const apple_sdk = @import("apple_sdk"); @@ -55,10 +50,16 @@ pub fn build(b: *std.Build) !void { 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"); + try flags.append(b.allocator, "-fno-exceptions"); + try flags.append(b.allocator, "-fno-rtti"); + if (target.result.abi == .msvc) { + try flags.appendSlice(b.allocator, &.{ + "-D_USE_STD_VECTOR_ALGORITHMS=0", + // -fno-autolink also drops UCRT's /alternatename fallback. + "-D_Avx2WmemEnabledWeakValue=_Avx2WmemEnabled", + "-fno-autolink", + "-fno-stack-protector", + }); } lib.root_module.addCMacro("SIMDUTF_NO_LIBCXX", "1"); @@ -70,11 +71,15 @@ pub fn build(b: *std.Build) !void { try flags.append(b.allocator, "-std=c++17"); } - if (target.result.os.tag == .freebsd or target.result.abi == .musl) { + if (target.result.os.tag == .freebsd or + target.result.abi == .musl or + target.result.abi == .android or + target.result.abi == .androideabi) + { try flags.append(b.allocator, "-fPIC"); } - lib.addCSourceFiles(.{ + lib.root_module.addCSourceFiles(.{ .flags = flags.items, .files = &.{ "vendor/simdutf.cpp", |
