aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/pkg/libintl/build.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/pkg/libintl/build.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/pkg/libintl/build.zig')
-rw-r--r--vendor/libghostty-vt/pkg/libintl/build.zig104
1 files changed, 104 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/libintl/build.zig b/vendor/libghostty-vt/pkg/libintl/build.zig
new file mode 100644
index 00000000..32221e5a
--- /dev/null
+++ b/vendor/libghostty-vt/pkg/libintl/build.zig
@@ -0,0 +1,104 @@
+//! Provides libintl for macOS.
+//!
+//! IMPORTANT: This is only for macOS. We could support other platforms
+//! if/when we need to but generally Linux provides libintl in libc.
+//! Windows we'll have to figure out when we get there.
+//!
+//! Since this is only for macOS, there's a lot of hardcoded stuff
+//! here that assumes macOS. For example, I generated the config.h
+//! on my own machine (a Mac) and then copied it here. This isn't
+//! ideal since we should do the same detection that gettext's configure
+//! script does, but its quite a bit of work to do that.
+//!
+//! UPGRADING: If you need to upgrade gettext, then the only thing to
+//! really watch out for is the xlocale.h include we added manually
+//! at the end of config.h. The comment there notes why. When we upgrade
+//! we should audit our config.h and make sure we add that back (if we
+//! have to).
+
+const std = @import("std");
+
+pub fn build(b: *std.Build) !void {
+ const target = b.standardTargetOptions(.{});
+ const optimize = b.standardOptimizeOption(.{});
+
+ var flags: std.ArrayList([]const u8) = .empty;
+ defer flags.deinit(b.allocator);
+ try flags.appendSlice(b.allocator, &.{
+ "-DHAVE_CONFIG_H",
+ "-DLOCALEDIR=\"\"",
+ });
+
+ {
+ const lib = b.addLibrary(.{
+ .name = "intl",
+ .root_module = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ }),
+ .linkage = .static,
+ });
+ lib.linkLibC();
+ lib.addIncludePath(b.path(""));
+
+ if (target.result.os.tag.isDarwin()) {
+ const apple_sdk = @import("apple_sdk");
+ try apple_sdk.addPaths(b, lib);
+ }
+
+ if (b.lazyDependency("gettext", .{})) |upstream| {
+ lib.addIncludePath(upstream.path("gettext-runtime/intl"));
+ lib.addIncludePath(upstream.path("gettext-runtime/intl/gnulib-lib"));
+ lib.addCSourceFiles(.{
+ .root = upstream.path("gettext-runtime/intl"),
+ .files = srcs,
+ .flags = flags.items,
+ });
+ }
+
+ lib.installHeader(b.path("libintl.h"), "libintl.h");
+ b.installArtifact(lib);
+ }
+}
+
+const srcs: []const []const u8 = &.{
+ "bindtextdom.c",
+ "dcgettext.c",
+ "dcigettext.c",
+ "dcngettext.c",
+ "dgettext.c",
+ "dngettext.c",
+ "explodename.c",
+ "finddomain.c",
+ "gettext.c",
+ "hash-string.c",
+ "intl-compat.c",
+ "l10nflist.c",
+ "langprefs.c",
+ "loadmsgcat.c",
+ "localealias.c",
+ "log.c",
+ "ngettext.c",
+ "plural-exp.c",
+ "plural.c",
+ "setlocale.c",
+ "textdomain.c",
+ "version.c",
+ "compat.c",
+
+ // There's probably a better way to detect that we need these, but
+ // these are hardcoded for now for macOS.
+ "gnulib-lib/getlocalename_l-unsafe.c",
+ "gnulib-lib/localename.c",
+ "gnulib-lib/localename-environ.c",
+ "gnulib-lib/localename-unsafe.c",
+ "gnulib-lib/setlocale-lock.c",
+ "gnulib-lib/setlocale_null.c",
+ "gnulib-lib/setlocale_null-unlocked.c",
+
+ // Not needed for macOS, but we might need them for other platforms.
+ // If we expand this to support other platforms, we should uncomment
+ // these.
+ // "osdep.c",
+ // "printf.c",
+};