build: add -Demit-themes option to emit/omit theme resources (#9288)

We'll backport this to 1.2.x for distros that would prefer this.
1.2.x
Mitchell Hashimoto 2025-10-20 13:14:42 -07:00
parent bbbb52ed75
commit d2a459b7c2
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 17 additions and 8 deletions

View File

@ -60,6 +60,7 @@ emit_macos_app: bool = false,
emit_terminfo: bool = false, emit_terminfo: bool = false,
emit_termcap: bool = false, emit_termcap: bool = false,
emit_test_exe: bool = false, emit_test_exe: bool = false,
emit_themes: bool = false,
emit_xcframework: bool = false, emit_xcframework: bool = false,
emit_webdata: bool = false, emit_webdata: bool = false,
emit_unicode_table_gen: bool = false, emit_unicode_table_gen: bool = false,
@ -366,6 +367,12 @@ pub fn init(b: *std.Build) !Config {
.ReleaseSafe, .ReleaseFast, .ReleaseSmall => false, .ReleaseSafe, .ReleaseFast, .ReleaseSmall => false,
}; };
config.emit_themes = b.option(
bool,
"emit-themes",
"Install bundled iTerm2-Color-Schemes Ghostty themes",
) orelse true;
config.emit_webdata = b.option( config.emit_webdata = b.option(
bool, bool,
"emit-webdata", "emit-webdata",

View File

@ -118,14 +118,16 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyResources {
} }
// Themes // Themes
if (b.lazyDependency("iterm2_themes", .{})) |upstream| { if (cfg.emit_themes) {
const install_step = b.addInstallDirectory(.{ if (b.lazyDependency("iterm2_themes", .{})) |upstream| {
.source_dir = upstream.path(""), const install_step = b.addInstallDirectory(.{
.install_dir = .{ .custom = "share" }, .source_dir = upstream.path(""),
.install_subdir = b.pathJoin(&.{ "ghostty", "themes" }), .install_dir = .{ .custom = "share" },
.exclude_extensions = &.{".md"}, .install_subdir = b.pathJoin(&.{ "ghostty", "themes" }),
}); .exclude_extensions = &.{".md"},
try steps.append(&install_step.step); });
try steps.append(&install_step.step);
}
} }
// Fish shell completions // Fish shell completions