Merge remote-tracking branch 'upstream/main' into grapheme-width-changes

This commit is contained in:
Jacob Sandlund
2026-02-19 08:52:53 -05:00
97 changed files with 5564 additions and 2324 deletions

View File

@@ -65,16 +65,14 @@ fn createUpdateStep(b: *std.Build) !*std.Build.Step {
"xgettext",
"--language=C", // Silence the "unknown extension" errors
"--from-code=UTF-8",
"--add-comments=Translators",
"--keyword=_",
"--keyword=C_:1c,2",
"--package-name=" ++ domain,
"--msgid-bugs-address=m@mitchellh.com",
"--copyright-holder=\"Mitchell Hashimoto, Ghostty contributors\"",
"-o",
"-",
});
// Collect to intermediate .pot file
xgettext.addArg("-o");
const gtk_pot = xgettext.addOutputFileArg("gtk.pot");
// Not cacheable due to the gresource files
xgettext.has_side_effects = true;
@@ -149,16 +147,45 @@ fn createUpdateStep(b: *std.Build) !*std.Build.Step {
}
}
// Add support for localizing our `nautilus` integration
const xgettext_py = b.addSystemCommand(&.{
"xgettext",
"--language=Python",
"--from-code=UTF-8",
});
// Collect to intermediate .pot file
xgettext_py.addArg("-o");
const py_pot = xgettext_py.addOutputFileArg("py.pot");
const nautilus_script_path = "dist/linux/ghostty_nautilus.py";
xgettext_py.addArg(nautilus_script_path);
xgettext_py.addFileInput(b.path(nautilus_script_path));
// Merge pot files
const xgettext_merge = b.addSystemCommand(&.{
"xgettext",
"--add-comments=Translators",
"--package-name=" ++ domain,
"--msgid-bugs-address=m@mitchellh.com",
"--copyright-holder=\"Mitchell Hashimoto, Ghostty contributors\"",
"-o",
"-",
});
// py_pot needs to be first on merge order because of `xgettext` behavior around
// charset when merging the two `.pot` files
xgettext_merge.addFileArg(py_pot);
xgettext_merge.addFileArg(gtk_pot);
const usf = b.addUpdateSourceFiles();
usf.addCopyFileToSource(
xgettext.captureStdOut(),
xgettext_merge.captureStdOut(),
"po/" ++ domain ++ ".pot",
);
inline for (locales) |locale| {
const msgmerge = b.addSystemCommand(&.{ "msgmerge", "--quiet", "--no-fuzzy-matching" });
msgmerge.addFileArg(b.path("po/" ++ locale ++ ".po"));
msgmerge.addFileArg(xgettext.captureStdOut());
msgmerge.addFileArg(xgettext_merge.captureStdOut());
usf.addCopyFileToSource(msgmerge.captureStdOut(), "po/" ++ locale ++ ".po");
}

View File

@@ -1,6 +1,7 @@
const GhosttyLibVt = @This();
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const RunStep = std.Build.Step.Run;
const GhosttyZig = @import("GhosttyZig.zig");
@@ -61,6 +62,19 @@ pub fn initShared(
.{ .include_extensions = &.{".h"} },
);
if (lib.rootModuleTarget().os.tag.isDarwin()) {
// Self-hosted x86_64 doesn't work for darwin. It may not work
// for other platforms too but definitely darwin.
lib.use_llvm = true;
// This is required for codesign and dynamic linking to work.
lib.headerpad_max_install_names = true;
// If we're not cross compiling then we try to find the Apple
// SDK using standard Apple tooling.
if (builtin.os.tag.isDarwin()) try @import("apple_sdk").addPaths(b, lib);
}
// Get our debug symbols
const dsymutil: ?std.Build.LazyPath = dsymutil: {
if (!target.result.os.tag.isDarwin()) {