libghostty: enable cross-compiling macOS from Linux/Windows

This allows libghostty-vt to be cross-compiled for macOS from non-macOS
platforms. I've updated pkg/apple-sdk to fallback to Zig's embedded
macOS headers if the macOS SDK is not found.

Additionally, CombineArchivesStep has been updated to use Linux
tooling on Linux.
This commit is contained in:
Mitchell Hashimoto
2026-04-24 10:40:32 -07:00
parent 48ccec182a
commit 6b69ea0517
4 changed files with 116 additions and 66 deletions

View File

@@ -2,6 +2,7 @@
//! Uses libtool on Darwin and a cross-platform MRI-script build tool
//! on all other platforms (including Windows).
const std = @import("std");
const builtin = @import("builtin");
const LibtoolStep = @import("LibtoolStep.zig");
/// Combine multiple static archives into a single fat archive.
@@ -15,7 +16,9 @@ pub fn create(
name: []const u8,
sources: []const std.Build.LazyPath,
) struct { step: *std.Build.Step, output: std.Build.LazyPath } {
if (target.result.os.tag.isDarwin()) {
if (target.result.os.tag.isDarwin() and
comptime builtin.os.tag.isDarwin())
{
const libtool = LibtoolStep.create(b, .{
.name = name,
.out_name = b.fmt("lib{s}-fat.a", .{name}),