build: respect config.emit_xcframework for building libghostty-vt.xcframework on Darwin (#12267)
This fixes a hardcoded build issue on macOS where Zig unconditionally forces xcodebuild -create-xcframework to run during compilation, even when the caller explicitly specifies that they only want the raw standard C objects/headers (-Demit-lib-vt).pull/12425/head
commit
d35f02d83c
|
|
@ -340,6 +340,9 @@ jobs:
|
|||
- name: Build XCFramework
|
||||
run: nix develop -c zig build -Demit-lib-vt
|
||||
|
||||
- name: Verify XCFramework artifact
|
||||
run: test -f zig-out/lib/ghostty-vt.xcframework/Info.plist
|
||||
|
||||
- name: Build and Run Example
|
||||
run: |
|
||||
cd example/${{ matrix.dir }}
|
||||
|
|
|
|||
11
build.zig
11
build.zig
|
|
@ -155,7 +155,11 @@ pub fn build(b: *std.Build) !void {
|
|||
// libghostty-vt xcframework (Apple only, universal binary).
|
||||
// Only when building on macOS (not cross-compiling) since
|
||||
// xcodebuild is required.
|
||||
if (builtin.os.tag.isDarwin() and config.target.result.os.tag.isDarwin()) {
|
||||
if (config.emit_lib_vt and
|
||||
config.emit_xcframework and
|
||||
builtin.os.tag.isDarwin() and
|
||||
config.target.result.os.tag.isDarwin())
|
||||
{
|
||||
const apple_libs = try buildpkg.GhosttyLibVt.initStaticAppleUniversal(
|
||||
b,
|
||||
&config,
|
||||
|
|
@ -200,8 +204,9 @@ pub fn build(b: *std.Build) !void {
|
|||
}
|
||||
|
||||
// macOS only artifacts. These will error if they're initialized for
|
||||
// other targets.
|
||||
if (config.target.result.os.tag.isDarwin() and
|
||||
// other targets. In lib-vt mode emit_xcframework controls the lib-vt
|
||||
// xcframework above, not this one.
|
||||
if (!config.emit_lib_vt and config.target.result.os.tag.isDarwin() and
|
||||
(config.emit_xcframework or config.emit_macos_app))
|
||||
{
|
||||
// Ghostty xcframework
|
||||
|
|
|
|||
|
|
@ -444,13 +444,22 @@ pub fn init(b: *std.Build, appVersion: []const u8, libVersion: []const u8) !Conf
|
|||
bool,
|
||||
"emit-xcframework",
|
||||
"Build and install the xcframework for the macOS library.",
|
||||
) orelse !config.emit_lib_vt and
|
||||
builtin.target.os.tag.isDarwin() and
|
||||
target.result.os.tag == .macos and
|
||||
config.app_runtime == .none and
|
||||
(!config.emit_bench and
|
||||
!config.emit_test_exe and
|
||||
!config.emit_helpgen);
|
||||
) orelse emit_xcfw: {
|
||||
if (!builtin.target.os.tag.isDarwin() or target.result.os.tag != .macos)
|
||||
break :emit_xcfw false;
|
||||
if (config.emit_lib_vt) {
|
||||
// In lib-vt mode default to whether xcodebuild is available,
|
||||
// since xcodebuild is required to produce the XCFramework.
|
||||
const path = expandPath(b.allocator, "xcodebuild") catch
|
||||
break :emit_xcfw false;
|
||||
defer if (path) |p| b.allocator.free(p);
|
||||
break :emit_xcfw path != null;
|
||||
}
|
||||
break :emit_xcfw config.app_runtime == .none and
|
||||
(!config.emit_bench and
|
||||
!config.emit_test_exe and
|
||||
!config.emit_helpgen);
|
||||
};
|
||||
|
||||
config.emit_macos_app = b.option(
|
||||
bool,
|
||||
|
|
|
|||
Loading…
Reference in New Issue