aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/apprt/gtk/build
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/apprt/gtk/build
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/apprt/gtk/build')
-rw-r--r--vendor/libghostty-vt/src/apprt/gtk/build/blueprint.zig94
-rw-r--r--vendor/libghostty-vt/src/apprt/gtk/build/gresource.zig33
2 files changed, 49 insertions, 78 deletions
diff --git a/vendor/libghostty-vt/src/apprt/gtk/build/blueprint.zig b/vendor/libghostty-vt/src/apprt/gtk/build/blueprint.zig
index 4920ce6f..fb3f6ae2 100644
--- a/vendor/libghostty-vt/src/apprt/gtk/build/blueprint.zig
+++ b/vendor/libghostty-vt/src/apprt/gtk/build/blueprint.zig
@@ -6,10 +6,7 @@
//! Example: blueprint.zig 1 5 output.ui input.blp
const std = @import("std");
-
-pub const c = @cImport({
- @cInclude("adwaita.h");
-});
+const adw_c = @import("adw_c");
pub const blueprint_compiler_help =
\\
@@ -26,23 +23,24 @@ pub const blueprint_compiler_help =
;
const adwaita_version = std.SemanticVersion{
- .major = c.ADW_MAJOR_VERSION,
- .minor = c.ADW_MINOR_VERSION,
- .patch = c.ADW_MICRO_VERSION,
+ .major = adw_c.ADW_MAJOR_VERSION,
+ .minor = adw_c.ADW_MINOR_VERSION,
+ .patch = adw_c.ADW_MICRO_VERSION,
};
+
const required_blueprint_version = std.SemanticVersion{
.major = 0,
.minor = 16,
.patch = 0,
};
-pub fn main() !void {
+pub fn main(init: std.process.Init) !void {
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
defer _ = debug_allocator.deinit();
const alloc = debug_allocator.allocator();
// Get our args
- var it = try std.process.argsWithAllocator(alloc);
+ var it = try init.minimal.args.iterateAllocator(alloc);
defer it.deinit();
_ = it.next(); // Skip argv0
const arg_major = it.next() orelse return error.NoMajorVersion;
@@ -63,51 +61,37 @@ pub fn main() !void {
\\compile this blueprint. Please install it, ensure that it is
\\available on your PATH, and then retry building Ghostty.
, .{required_adwaita_version});
- std.posix.exit(1);
+ std.process.exit(1);
}
// Version checks
{
- var stdout: std.ArrayListUnmanaged(u8) = .empty;
- defer stdout.deinit(alloc);
- var stderr: std.ArrayListUnmanaged(u8) = .empty;
- defer stderr.deinit(alloc);
-
- var blueprint_compiler = std.process.Child.init(
- &.{
- "blueprint-compiler",
- "--version",
- },
- alloc,
- );
- blueprint_compiler.stdout_behavior = .Pipe;
- blueprint_compiler.stderr_behavior = .Pipe;
- try blueprint_compiler.spawn();
- try blueprint_compiler.collectOutput(
- alloc,
- &stdout,
- &stderr,
- std.math.maxInt(u16),
- );
- const term = blueprint_compiler.wait() catch |err| switch (err) {
+ const blueprint_compiler = std.process.run(alloc, init.io, .{
+ .argv = &.{ "blueprint-compiler", "--version" },
+ }) catch |err| switch (err) {
error.FileNotFound => {
std.debug.print(
\\`blueprint-compiler` not found.
++ blueprint_compiler_help,
.{required_blueprint_version},
);
- std.posix.exit(1);
+ std.process.exit(1);
},
else => return err,
};
- switch (term) {
- .Exited => |rc| if (rc != 0) std.process.exit(1),
+ defer {
+ alloc.free(blueprint_compiler.stdout);
+ alloc.free(blueprint_compiler.stderr);
+ }
+
+ switch (blueprint_compiler.term) {
+ .exited => |rc| if (rc != 0) std.process.exit(1),
else => std.process.exit(1),
}
const version = try std.SemanticVersion.parse(std.mem.trim(
u8,
- stdout.items,
+ blueprint_compiler.stdout,
&std.ascii.whitespace,
));
if (version.order(required_blueprint_version) == .lt) {
@@ -116,57 +100,45 @@ pub fn main() !void {
++ blueprint_compiler_help,
.{required_blueprint_version},
);
- std.posix.exit(1);
+ std.process.exit(1);
}
}
// Compilation
{
- var stdout: std.ArrayListUnmanaged(u8) = .empty;
- defer stdout.deinit(alloc);
- var stderr: std.ArrayListUnmanaged(u8) = .empty;
- defer stderr.deinit(alloc);
-
- var blueprint_compiler = std.process.Child.init(
- &.{
+ const blueprint_compiler = std.process.run(alloc, init.io, .{
+ .argv = &.{
"blueprint-compiler",
"compile",
"--output",
output,
input,
},
- alloc,
- );
- blueprint_compiler.stdout_behavior = .Pipe;
- blueprint_compiler.stderr_behavior = .Pipe;
- try blueprint_compiler.spawn();
- try blueprint_compiler.collectOutput(
- alloc,
- &stdout,
- &stderr,
- std.math.maxInt(u16),
- );
- const term = blueprint_compiler.wait() catch |err| switch (err) {
+ }) catch |err| switch (err) {
error.FileNotFound => {
std.debug.print(
\\`blueprint-compiler` not found.
++ blueprint_compiler_help,
.{required_blueprint_version},
);
- std.posix.exit(1);
+ std.process.exit(1);
},
else => return err,
};
+ defer {
+ alloc.free(blueprint_compiler.stdout);
+ alloc.free(blueprint_compiler.stderr);
+ }
- switch (term) {
- .Exited => |rc| {
+ switch (blueprint_compiler.term) {
+ .exited => |rc| {
if (rc != 0) {
- std.debug.print("{s}", .{stderr.items});
+ std.debug.print("{s}", .{blueprint_compiler.stderr});
std.process.exit(1);
}
},
else => {
- std.debug.print("{s}", .{stderr.items});
+ std.debug.print("{s}", .{blueprint_compiler.stderr});
std.process.exit(1);
},
}
diff --git a/vendor/libghostty-vt/src/apprt/gtk/build/gresource.zig b/vendor/libghostty-vt/src/apprt/gtk/build/gresource.zig
index c50ea8cd..57c32a35 100644
--- a/vendor/libghostty-vt/src/apprt/gtk/build/gresource.zig
+++ b/vendor/libghostty-vt/src/apprt/gtk/build/gresource.zig
@@ -122,18 +122,17 @@ pub fn blueprint(comptime bp: Blueprint) [:0]const u8 {
}
}
-pub fn main() !void {
- var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
- defer _ = debug_allocator.deinit();
- const alloc = debug_allocator.allocator();
+pub fn main(init: std.process.Init) !void {
+ const alloc = init.arena.allocator();
// Collect the UI files that are passed in as arguments.
- var ui_files: std.ArrayListUnmanaged([]const u8) = .empty;
+ var ui_files: std.ArrayList([]const u8) = .empty;
defer {
for (ui_files.items) |item| alloc.free(item);
ui_files.deinit(alloc);
}
- var it = try std.process.argsWithAllocator(alloc);
+
+ var it = try init.minimal.args.iterateAllocator(alloc);
defer it.deinit();
while (it.next()) |arg| {
if (!std.mem.endsWith(u8, arg, ".ui")) continue;
@@ -144,7 +143,7 @@ pub fn main() !void {
}
var buf: [4096]u8 = undefined;
- var stdout = std.fs.File.stdout().writer(&buf);
+ var stdout = std.Io.File.stdout().writer(init.io, &buf);
const writer = &stdout.interface;
try writer.writeAll(
\\<?xml version="1.0" encoding="UTF-8"?>
@@ -152,8 +151,8 @@ pub fn main() !void {
\\
);
- try genRoot(writer);
- try genIcons(writer);
+ try genRoot(init.io, writer);
+ try genIcons(init.io, writer);
try genUi(alloc, writer, &ui_files);
try writer.writeAll(
@@ -167,19 +166,19 @@ pub fn main() !void {
/// Generate the icon resources. This works by looking up all the icons
/// specified by `icon_sizes` in `images/icons/`. They are asserted to exist
/// by trying to access the file.
-fn genIcons(writer: *std.Io.Writer) !void {
+fn genIcons(io: std.Io, writer: *std.Io.Writer) !void {
try writer.print(
\\ <gresource prefix="{s}/icons">
\\
, .{build_info.resource_path});
- const cwd = std.fs.cwd();
+ const cwd: std.Io.Dir = .cwd();
inline for (icon_sizes) |size| {
// 1x
{
const alias = std.fmt.comptimePrint("{d}x{d}", .{ size, size });
const source = std.fmt.comptimePrint("images/gnome/{d}.png", .{size});
- try cwd.access(source, .{});
+ try cwd.access(io, source, .{});
try writer.print(
\\ <file alias="{s}/apps/{s}.png">{s}</file>
\\
@@ -192,7 +191,7 @@ fn genIcons(writer: *std.Io.Writer) !void {
{
const alias = std.fmt.comptimePrint("{d}x{d}@2", .{ size, size });
const source = std.fmt.comptimePrint("images/gnome/{d}.png", .{size * 2});
- try cwd.access(source, .{});
+ try cwd.access(io, source, .{});
try writer.print(
\\ <file alias="{s}/apps/{s}.png">{s}</file>
\\
@@ -209,19 +208,19 @@ fn genIcons(writer: *std.Io.Writer) !void {
}
/// Generate the resources at the root prefix.
-fn genRoot(writer: *std.Io.Writer) !void {
+fn genRoot(io: std.Io, writer: *std.Io.Writer) !void {
try writer.print(
\\ <gresource prefix="{s}">
\\
, .{build_info.resource_path});
- const cwd = std.fs.cwd();
+ const cwd: std.Io.Dir = .cwd();
inline for (css) |name| {
const source = std.fmt.comptimePrint(
"{s}/{s}",
.{ css_path, name },
);
- try cwd.access(source, .{});
+ try cwd.access(io, source, .{});
try writer.print(
\\ <file compressed="true" alias="{s}">{s}</file>
\\
@@ -242,7 +241,7 @@ fn genRoot(writer: *std.Io.Writer) !void {
fn genUi(
alloc: Allocator,
writer: *std.Io.Writer,
- files: *const std.ArrayListUnmanaged([]const u8),
+ files: *const std.ArrayList([]const u8),
) !void {
try writer.print(
\\ <gresource prefix="{s}/ui">