build: default dependencies to lib-vt mode

Related to #10651

Default Ghostty dependency builds to libghostty-vt-only mode and
avoid initializing anything that would trigger broader dependency
requirements.

The impact of this is that Zig consumers can import ghostty-vt without
requiring Xcode on macOS.
This commit is contained in:
Mitchell Hashimoto
2026-08-05 21:55:57 -07:00
parent 8eecb8fdbf
commit 49fd1ae654
3 changed files with 42 additions and 7 deletions

View File

@@ -73,11 +73,15 @@ pub fn init(b: *std.Build, appVersion: []const u8, libVersion: []const u8) !Conf
// Setup our standard Zig target and optimize options, i.e.
// `-Doptimize` and `-Dtarget`.
const optimize = b.standardOptimizeOption(.{});
// Default dependency builds to libghostty-vt-only mode. Consumers can
// still explicitly disable this to request the full Ghostty build.
const is_dep = b.dep_prefix.len > 0;
const emit_lib_vt = b.option(
bool,
"emit-lib-vt",
"Set defaults for a libghostty-vt-only build (disables xcframework, macOS app, and docs).",
) orelse false;
) orelse is_dep;
const target = target: {
var result = b.standardTargetOptions(.{});
@@ -114,10 +118,6 @@ pub fn init(b: *std.Build, appVersion: []const u8, libVersion: []const u8) !Conf
break :target result;
};
// Detect if Ghostty is a dependency of another project.
// dep_prefix is non-empty when this build is running as a dependency.
const is_dep = b.dep_prefix.len > 0;
// This is set to true when we're building a system package. For now
// this is trivially detected using the "system_package_mode" bool
// but we may want to make this more sophisticated in the future.