From 75cc4b29fdfeead0e19416fcc1cc71b40f3e135d Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Wed, 19 Mar 2025 16:50:38 -0500 Subject: [PATCH] gtk: require blueprint-compiler 0.16 for building Changes: 1. Require `blueprint-compiler` 0.16.0 (or newer) for building from a git checkout. With #6822 distributions that can't meet that requirement can use generated source tarballs to build. 2. Remove all `.ui` files as they are unnecessary. 3. Simplify the `Builder` interface since raw `.ui` files are no longer used. 4. Removed build-time check of raw `.ui` files. --- src/apprt/gtk/Builder.zig | 107 +++-------- src/apprt/gtk/ClipboardConfirmationWindow.zig | 12 +- src/apprt/gtk/ConfigErrorsDialog.zig | 4 +- src/apprt/gtk/Surface.zig | 2 +- src/apprt/gtk/Window.zig | 2 +- src/apprt/gtk/blueprint_compiler.zig | 177 ++++++++++++++---- src/apprt/gtk/builder_check.zig | 32 ---- src/apprt/gtk/gresource.zig | 49 ++--- src/apprt/gtk/menu.zig | 2 +- src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui | 77 -------- src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui | 77 -------- src/apprt/gtk/ui/1.2/ccw-paste.ui | 77 -------- src/apprt/gtk/ui/1.2/config-errors-dialog.ui | 36 ---- src/apprt/gtk/ui/README.md | 28 ++- src/build/SharedDeps.zig | 28 --- 15 files changed, 200 insertions(+), 510 deletions(-) delete mode 100644 src/apprt/gtk/builder_check.zig delete mode 100644 src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui delete mode 100644 src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui delete mode 100644 src/apprt/gtk/ui/1.2/ccw-paste.ui delete mode 100644 src/apprt/gtk/ui/1.2/config-errors-dialog.ui diff --git a/src/apprt/gtk/Builder.zig b/src/apprt/gtk/Builder.zig index 028629200..dbd765ba3 100644 --- a/src/apprt/gtk/Builder.zig +++ b/src/apprt/gtk/Builder.zig @@ -18,88 +18,37 @@ pub fn init( /// The minor version of the minimum Adwaita version that is required to use /// this resource. comptime minor: u16, - /// `blp` signifies that the resource is a Blueprint that has been compiled - /// to GTK Builder XML at compile time. `ui` signifies that the resource is - /// a GTK Builder XML file that is included in the Ghostty source (perhaps - /// because the Blueprint compiler on some target platforms cannot compile a - /// Blueprint that generates the necessary resources). - comptime kind: enum { blp, ui }, ) Builder { const resource_path = comptime resource_path: { const gresource = @import("gresource.zig"); - switch (kind) { - .blp => { - // Check to make sure that our file is listed as a - // `blueprint_file` in `gresource.zig`. If it isn't Ghostty - // could crash at runtime when we try and load a nonexistent - // GResource. - for (gresource.blueprint_files) |file| { - if (major != file.major or minor != file.minor or !std.mem.eql(u8, file.name, name)) continue; - // Use @embedFile to make sure that the `.blp` file exists - // at compile time. Zig _should_ discard the data so that - // it doesn't end up in the final executable. At runtime we - // will load the data from a GResource. - const blp_filename = std.fmt.comptimePrint( - "ui/{d}.{d}/{s}.blp", - .{ - file.major, - file.minor, - file.name, - }, - ); - _ = @embedFile(blp_filename); - break :resource_path std.fmt.comptimePrint( - "/com/mitchellh/ghostty/ui/{d}.{d}/{s}.ui", - .{ - file.major, - file.minor, - file.name, - }, - ); - } else @compileError("missing blueprint file '" ++ name ++ "' in gresource.zig"); - }, - .ui => { - // Check to make sure that our file is listed as a `ui_file` in - // `gresource.zig`. If it isn't Ghostty could crash at runtime - // when we try and load a nonexistent GResource. - for (gresource.ui_files) |file| { - if (major != file.major or minor != file.minor or !std.mem.eql(u8, file.name, name)) continue; - // Use @embedFile to make sure that the `.ui` file exists - // at compile time. Zig _should_ discard the data so that - // it doesn't end up in the final executable. At runtime we - // will load the data from a GResource. - const ui_filename = std.fmt.comptimePrint( - "ui/{d}.{d}/{s}.ui", - .{ - file.major, - file.minor, - file.name, - }, - ); - _ = @embedFile(ui_filename); - // Also use @embedFile to make sure that a matching `.blp` - // file exists at compile time. Zig _should_ discard the - // data so that it doesn't end up in the final executable. - const blp_filename = std.fmt.comptimePrint( - "ui/{d}.{d}/{s}.blp", - .{ - file.major, - file.minor, - file.name, - }, - ); - _ = @embedFile(blp_filename); - break :resource_path std.fmt.comptimePrint( - "/com/mitchellh/ghostty/ui/{d}.{d}/{s}.ui", - .{ - file.major, - file.minor, - file.name, - }, - ); - } else @compileError("missing ui file '" ++ name ++ "' in gresource.zig"); - }, - } + // Check to make sure that our file is listed as a + // `blueprint_file` in `gresource.zig`. If it isn't Ghostty + // could crash at runtime when we try and load a nonexistent + // GResource. + for (gresource.blueprint_files) |file| { + if (major != file.major or minor != file.minor or !std.mem.eql(u8, file.name, name)) continue; + // Use @embedFile to make sure that the `.blp` file exists + // at compile time. Zig _should_ discard the data so that + // it doesn't end up in the final executable. At runtime we + // will load the data from a GResource. + const blp_filename = std.fmt.comptimePrint( + "ui/{d}.{d}/{s}.blp", + .{ + file.major, + file.minor, + file.name, + }, + ); + _ = @embedFile(blp_filename); + break :resource_path std.fmt.comptimePrint( + "/com/mitchellh/ghostty/ui/{d}.{d}/{s}.ui", + .{ + file.major, + file.minor, + file.name, + }, + ); + } else @compileError("missing blueprint file '" ++ name ++ "' in gresource.zig"); }; return .{ diff --git a/src/apprt/gtk/ClipboardConfirmationWindow.zig b/src/apprt/gtk/ClipboardConfirmationWindow.zig index a28b7ddd4..583a58a2c 100644 --- a/src/apprt/gtk/ClipboardConfirmationWindow.zig +++ b/src/apprt/gtk/ClipboardConfirmationWindow.zig @@ -71,14 +71,14 @@ fn init( ) !void { var builder = switch (DialogType) { adw.AlertDialog => switch (request) { - .osc_52_read => Builder.init("ccw-osc-52-read", 1, 5, .blp), - .osc_52_write => Builder.init("ccw-osc-52-write", 1, 5, .blp), - .paste => Builder.init("ccw-paste", 1, 5, .blp), + .osc_52_read => Builder.init("ccw-osc-52-read", 1, 5), + .osc_52_write => Builder.init("ccw-osc-52-write", 1, 5), + .paste => Builder.init("ccw-paste", 1, 5), }, adw.MessageDialog => switch (request) { - .osc_52_read => Builder.init("ccw-osc-52-read", 1, 2, .ui), - .osc_52_write => Builder.init("ccw-osc-52-write", 1, 2, .ui), - .paste => Builder.init("ccw-paste", 1, 2, .ui), + .osc_52_read => Builder.init("ccw-osc-52-read", 1, 2), + .osc_52_write => Builder.init("ccw-osc-52-write", 1, 2), + .paste => Builder.init("ccw-paste", 1, 2), }, else => unreachable, }; diff --git a/src/apprt/gtk/ConfigErrorsDialog.zig b/src/apprt/gtk/ConfigErrorsDialog.zig index c10f8e679..7a245a1a0 100644 --- a/src/apprt/gtk/ConfigErrorsDialog.zig +++ b/src/apprt/gtk/ConfigErrorsDialog.zig @@ -30,8 +30,8 @@ pub fn maybePresent(app: *App, window: ?*Window) void { if (app.config._diagnostics.empty()) return; var builder = switch (DialogType) { - adw.AlertDialog => Builder.init("config-errors-dialog", 1, 5, .blp), - adw.MessageDialog => Builder.init("config-errors-dialog", 1, 2, .ui), + adw.AlertDialog => Builder.init("config-errors-dialog", 1, 5), + adw.MessageDialog => Builder.init("config-errors-dialog", 1, 2), else => unreachable, }; defer builder.deinit(); diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index e99fe29ce..4ad2eeb13 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -1061,7 +1061,7 @@ pub fn promptTitle(self: *Surface) !void { if (!adw_version.atLeast(1, 5, 0)) return; const window = self.container.window() orelse return; - var builder = Builder.init("prompt-title-dialog", 1, 5, .blp); + var builder = Builder.init("prompt-title-dialog", 1, 5); defer builder.deinit(); const entry = builder.getObject(gtk.Entry, "title_entry").?; diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 20ac3d955..e130cd1be 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -248,7 +248,7 @@ pub fn init(self: *Window, app: *App) !void { btn.as(gtk.Widget).setTooltipText(i18n._("New Tab")); btn.setDropdownTooltip(i18n._("New Split")); - var builder = Builder.init("menu-headerbar-split_menu", 1, 0, .blp); + var builder = Builder.init("menu-headerbar-split_menu", 1, 0); defer builder.deinit(); btn.setMenuModel(builder.getObject(gio.MenuModel, "menu")); diff --git a/src/apprt/gtk/blueprint_compiler.zig b/src/apprt/gtk/blueprint_compiler.zig index 7a0442e92..9bc515655 100644 --- a/src/apprt/gtk/blueprint_compiler.zig +++ b/src/apprt/gtk/blueprint_compiler.zig @@ -4,62 +4,157 @@ pub const c = @cImport({ @cInclude("adwaita.h"); }); +const adwaita_version = std.SemanticVersion{ + .major = c.ADW_MAJOR_VERSION, + .minor = c.ADW_MINOR_VERSION, + .patch = c.ADW_MICRO_VERSION, +}; +const required_blueprint_version = std.SemanticVersion{ + .major = 0, + .minor = 16, + .patch = 0, +}; + pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - const alloc = gpa.allocator(); + var debug_allocator: std.heap.DebugAllocator(.{}) = .init; + defer _ = debug_allocator.deinit(); + const alloc = debug_allocator.allocator(); var it = try std.process.argsWithAllocator(alloc); defer it.deinit(); _ = it.next(); - const major = try std.fmt.parseUnsigned(u8, it.next() orelse return error.NoMajorVersion, 10); - const minor = try std.fmt.parseUnsigned(u8, it.next() orelse return error.NoMinorVersion, 10); + const required_adwaita_version = std.SemanticVersion{ + .major = try std.fmt.parseUnsigned(u8, it.next() orelse return error.NoMajorVersion, 10), + .minor = try std.fmt.parseUnsigned(u8, it.next() orelse return error.NoMinorVersion, 10), + .patch = 0, + }; const output = it.next() orelse return error.NoOutput; const input = it.next() orelse return error.NoInput; - if (c.ADW_MAJOR_VERSION < major or (c.ADW_MAJOR_VERSION == major and c.ADW_MINOR_VERSION < minor)) { - // If the Adwaita version is too old, generate an "empty" file. - const file = try std.fs.createFileAbsolute(output, .{ - .truncate = true, - }); - try file.writeAll( - \\ - \\ - ); - defer file.close(); - - return; + if (adwaita_version.order(required_adwaita_version) == .lt) { + std.debug.print( + \\`libadwaita` is too old. + \\ + \\Ghostty requires a version {} or newer of `libadwaita` to + \\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); } - var compiler = std.process.Child.init( - &.{ - "blueprint-compiler", - "compile", - "--output", - output, - input, - }, - alloc, - ); + { + var stdout: std.ArrayListUnmanaged(u8) = .empty; + defer stdout.deinit(alloc); + var stderr: std.ArrayListUnmanaged(u8) = .empty; + defer stderr.deinit(alloc); - const term = compiler.spawnAndWait() catch |err| switch (err) { - error.FileNotFound => { - std.log.err( - \\`blueprint-compiler` not found. + 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) { + error.FileNotFound => { + std.debug.print( + \\`blueprint-compiler` not found. + \\ + \\Ghostty requires version {} or newer of + \\`blueprint-compiler` as a build-time dependency starting + \\from version 1.2. Please install it, ensure that it is + \\available on your PATH, and then retry building Ghostty. + \\ + , .{required_blueprint_version}); + std.posix.exit(1); + }, + else => return err, + }; + switch (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, &std.ascii.whitespace)); + if (version.order(required_blueprint_version) == .lt) { + std.debug.print( + \\`blueprint-compiler` is the wrong version. \\ - \\Ghostty requires `blueprint-compiler` as a build-time dependency starting from version 1.2. - \\Please install it, ensure that it is available on your PATH, and then retry building Ghostty. - , .{}); + \\Ghostty requires version {} or newer of + \\`blueprint-compiler` as a build-time dependency starting + \\from version 1.2. Please install it, ensure that it is + \\available on your PATH, and then retry building Ghostty. + \\ + , .{required_blueprint_version}); std.posix.exit(1); - }, - else => return err, - }; + } + } - switch (term) { - .Exited => |rc| { - if (rc != 0) std.process.exit(1); - }, - else => std.process.exit(1), + { + 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", + "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) { + error.FileNotFound => { + std.debug.print( + \\`blueprint-compiler` not found. + \\ + \\Ghostty requires version {} or newer of + \\`blueprint-compiler` as a build-time dependency starting + \\from version 1.2. Please install it, ensure that it is + \\available on your PATH, and then retry building Ghostty. + \\ + , .{required_blueprint_version}); + std.posix.exit(1); + }, + else => return err, + }; + + switch (term) { + .Exited => |rc| { + if (rc != 0) { + std.debug.print("{s}", .{stderr.items}); + std.process.exit(1); + } + }, + else => { + std.debug.print("{s}", .{stderr.items}); + std.process.exit(1); + }, + } } } diff --git a/src/apprt/gtk/builder_check.zig b/src/apprt/gtk/builder_check.zig deleted file mode 100644 index 015c6310d..000000000 --- a/src/apprt/gtk/builder_check.zig +++ /dev/null @@ -1,32 +0,0 @@ -const std = @import("std"); -const build_options = @import("build_options"); - -const gtk = @import("gtk"); -const adw = @import("adw"); - -pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - const alloc = gpa.allocator(); - - const filename = filename: { - var it = try std.process.argsWithAllocator(alloc); - defer it.deinit(); - - _ = it.next() orelse return error.NoFilename; - break :filename try alloc.dupeZ(u8, it.next() orelse return error.NoFilename); - }; - defer alloc.free(filename); - - const data = try std.fs.cwd().readFileAllocOptions(alloc, filename, std.math.maxInt(u16), null, 1, 0); - defer alloc.free(data); - - if (gtk.initCheck() == 0) { - std.debug.print("{s}: skipping builder check because we can't connect to display!\n", .{filename}); - return; - } - - adw.init(); - - const builder = gtk.Builder.newFromString(data.ptr, @intCast(data.len)); - defer builder.unref(); -} diff --git a/src/apprt/gtk/gresource.zig b/src/apprt/gtk/gresource.zig index 7ced9fc45..a1db8ac62 100644 --- a/src/apprt/gtk/gresource.zig +++ b/src/apprt/gtk/gresource.zig @@ -53,19 +53,6 @@ const icons = [_]struct { }, }; -pub const VersionedBuilderXML = struct { - major: u16, - minor: u16, - name: []const u8, -}; - -pub const ui_files = [_]VersionedBuilderXML{ - .{ .major = 1, .minor = 2, .name = "config-errors-dialog" }, - .{ .major = 1, .minor = 2, .name = "ccw-osc-52-read" }, - .{ .major = 1, .minor = 2, .name = "ccw-osc-52-write" }, - .{ .major = 1, .minor = 2, .name = "ccw-paste" }, -}; - pub const VersionedBlueprint = struct { major: u16, minor: u16, @@ -81,16 +68,21 @@ pub const blueprint_files = [_]VersionedBlueprint{ .{ .major = 1, .minor = 5, .name = "ccw-osc-52-read" }, .{ .major = 1, .minor = 5, .name = "ccw-osc-52-write" }, .{ .major = 1, .minor = 5, .name = "ccw-paste" }, + .{ .major = 1, .minor = 2, .name = "config-errors-dialog" }, + .{ .major = 1, .minor = 2, .name = "ccw-osc-52-read" }, + .{ .major = 1, .minor = 2, .name = "ccw-osc-52-write" }, + .{ .major = 1, .minor = 2, .name = "ccw-paste" }, }; pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - const alloc = gpa.allocator(); + var debug_allocator: std.heap.DebugAllocator(.{}) = .init; + defer _ = debug_allocator.deinit(); + const alloc = debug_allocator.allocator(); - var extra_ui_files = std.ArrayList([]const u8).init(alloc); + var extra_ui_files: std.ArrayListUnmanaged([]const u8) = .empty; defer { for (extra_ui_files.items) |item| alloc.free(item); - extra_ui_files.deinit(); + extra_ui_files.deinit(alloc); } var it = try std.process.argsWithAllocator(alloc); @@ -98,7 +90,7 @@ pub fn main() !void { while (it.next()) |argument| { if (std.mem.eql(u8, std.fs.path.extension(argument), ".ui")) { - try extra_ui_files.append(try alloc.dupe(u8, argument)); + try extra_ui_files.append(alloc, try alloc.dupe(u8, argument)); } } @@ -132,16 +124,11 @@ pub fn main() !void { \\ \\ ); - for (ui_files) |ui_file| { - try writer.print( - " src/apprt/gtk/ui/{0d}.{1d}/{2s}.ui\n", - .{ ui_file.major, ui_file.minor, ui_file.name }, - ); - } for (extra_ui_files.items) |ui_file| { - const stem = std.fs.path.stem(ui_file); for (blueprint_files) |file| { - if (!std.mem.eql(u8, file.name, stem)) continue; + const expected = try std.fmt.allocPrint(alloc, "/{d}.{d}/{s}.ui", .{ file.major, file.minor, file.name }); + defer alloc.free(expected); + if (!std.mem.endsWith(u8, ui_file, expected)) continue; try writer.print( " {s}\n", .{ file.major, file.minor, file.name, ui_file }, @@ -157,7 +144,7 @@ pub fn main() !void { } pub const dependencies = deps: { - const total = css_files.len + icons.len + ui_files.len + blueprint_files.len; + const total = css_files.len + icons.len + blueprint_files.len; var deps: [total][]const u8 = undefined; var index: usize = 0; for (css_files) |css_file| { @@ -168,14 +155,6 @@ pub const dependencies = deps: { deps[index] = std.fmt.comptimePrint("images/icons/icon_{s}.png", .{icon.source}); index += 1; } - for (ui_files) |ui_file| { - deps[index] = std.fmt.comptimePrint("src/apprt/gtk/ui/{d}.{d}/{s}.ui", .{ - ui_file.major, - ui_file.minor, - ui_file.name, - }); - index += 1; - } for (blueprint_files) |blueprint_file| { deps[index] = std.fmt.comptimePrint("src/apprt/gtk/ui/{d}.{d}/{s}.blp", .{ blueprint_file.major, diff --git a/src/apprt/gtk/menu.zig b/src/apprt/gtk/menu.zig index d0a93b80d..f63a0eb5f 100644 --- a/src/apprt/gtk/menu.zig +++ b/src/apprt/gtk/menu.zig @@ -41,7 +41,7 @@ pub fn Menu( else => unreachable, }; - var builder = Builder.init("menu-" ++ object_type ++ "-" ++ menu_name, 1, 0, .blp); + var builder = Builder.init("menu-" ++ object_type ++ "-" ++ menu_name, 1, 0); defer builder.deinit(); const menu_model = builder.getObject(gio.MenuModel, "menu").?; diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui deleted file mode 100644 index 82512e3a2..000000000 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - Authorize Clipboard Access - An application is attempting to read from the clipboard. The current clipboard contents are shown below. - - Deny - Allow - - cancel - cancel - - - - - - 500 - 250 - - - false - false - true - 8 - 8 - 8 - 8 - - - - - - - - false - 2 - 1 - 12 - 12 - - - view-reveal-symbolic - - - - - - - false - 2 - 1 - 12 - 12 - - - - view-conceal-symbolic - - - - - - - - \ No newline at end of file diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui deleted file mode 100644 index 195fb1de1..000000000 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - Authorize Clipboard Access - An application is attempting to write to the clipboard. The current clipboard contents are shown below. - - Deny - Allow - - cancel - cancel - - - - - - 500 - 250 - - - false - false - true - 8 - 8 - 8 - 8 - - - - - - - - false - 2 - 1 - 12 - 12 - - - view-reveal-symbolic - - - - - - - false - 2 - 1 - 12 - 12 - - - - view-conceal-symbolic - - - - - - - - \ No newline at end of file diff --git a/src/apprt/gtk/ui/1.2/ccw-paste.ui b/src/apprt/gtk/ui/1.2/ccw-paste.ui deleted file mode 100644 index 342c767e6..000000000 --- a/src/apprt/gtk/ui/1.2/ccw-paste.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - Warning: Potentially Unsafe Paste - Pasting this text into the terminal may be dangerous as it looks like some commands may be executed. - - Cancel - Paste - - cancel - cancel - - - - - - 500 - 250 - - - false - false - true - 8 - 8 - 8 - 8 - - - - - - - - false - 2 - 1 - 12 - 12 - - - view-reveal-symbolic - - - - - - - false - 2 - 1 - 12 - 12 - - - - view-conceal-symbolic - - - - - - - - \ No newline at end of file diff --git a/src/apprt/gtk/ui/1.2/config-errors-dialog.ui b/src/apprt/gtk/ui/1.2/config-errors-dialog.ui deleted file mode 100644 index 1d7517f7a..000000000 --- a/src/apprt/gtk/ui/1.2/config-errors-dialog.ui +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Configuration Errors - One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors. - - Ignore - Reload Configuration - - - - 500 - 100 - - - false - false - 8 - 8 - 8 - 8 - - - - - - - - - diff --git a/src/apprt/gtk/ui/README.md b/src/apprt/gtk/ui/README.md index 08f3f367c..b9dc732b6 100644 --- a/src/apprt/gtk/ui/README.md +++ b/src/apprt/gtk/ui/README.md @@ -1,21 +1,15 @@ # GTK UI files -This directory is for storing GTK resource definitions. With one exception, the -files should be be in the Blueprint markup language. +This directory is for storing GTK blueprints. GTK blueprints are compiled into +GTK resource builder `.ui` files by `blueprint-compiler` at build time and then +converted into an embeddable resource by `glib-compile-resources`. -Resource files should be stored in directories that represent the minimum -Adwaita version needed to use that resource. Resource files should also be -formatted using `blueprint-compiler format` as well to ensure consistency. +Blueprint files should be stored in directories that represent the minimum +Adwaita version needed to use that resource. Blueprint files should also be +formatted using `blueprint-compiler format` as well to ensure consistency +(formatting will be checked in CI). -The one exception to files being in Blueprint markup language is when Adwaita -features are used that the `blueprint-compiler` on a supported platform does not -compile. For example, Debian 12 includes Adwaita 1.2 and `blueprint-compiler` -0.6.0. Adwaita 1.2 includes support for `MessageDialog` but `blueprint-compiler` -0.6.0 does not. In cases like that the Blueprint markup should be compiled on a -platform that provides a new enough `blueprint-compiler` and the resulting `.ui` -file should be committed to the Ghostty source code. Care should be taken that -the `.blp` file and the `.ui` file remain in sync. - -In all other cases only the `.blp` should be committed to the Ghostty source -code. The build process will use `blueprint-compiler` to generate the `.ui` -files necessary at runtime. +`blueprint-compiler` version 0.16.0 or newer is required to compile Blueprint +files. If your system does not have `blueprint-compiler` or does not have a +new enough version you can use the generated source tarballs, which contain +precompiled versions of the blueprints. diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index 4f9373adb..4b97298f7 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -662,34 +662,6 @@ fn addGTK( } { - // For our actual build, we validate our GTK builder files if we can. - { - const gtk_builder_check = b.addExecutable(.{ - .name = "gtk_builder_check", - .root_source_file = b.path("src/apprt/gtk/builder_check.zig"), - .target = b.graph.host, - }); - gtk_builder_check.root_module.addOptions("build_options", self.options); - if (gobject_) |gobject| { - gtk_builder_check.root_module.addImport( - "gtk", - gobject.module("gtk4"), - ); - gtk_builder_check.root_module.addImport( - "adw", - gobject.module("adw1"), - ); - } - - for (gresource.dependencies) |pathname| { - const extension = std.fs.path.extension(pathname); - if (!std.mem.eql(u8, extension, ".ui")) continue; - const check = b.addRunArtifact(gtk_builder_check); - check.addFileArg(b.path(pathname)); - step.step.dependOn(&check.step); - } - } - // Get our gresource c/h files and add them to our build. const dist = gtkDistResources(b); step.addCSourceFile(.{ .file = dist.resources_c.path(b), .flags = &.{} });