From 85345c31cf10fa6ff237afafede5190810d1fa93 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 23 Sep 2025 15:01:48 -0700 Subject: [PATCH] build: don't add deps when cross compiling to darwin --- src/build/GhosttyExe.zig | 1 + src/build/SharedDeps.zig | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/build/GhosttyExe.zig b/src/build/GhosttyExe.zig index 083aecdb5..1dfc4b4b7 100644 --- a/src/build/GhosttyExe.zig +++ b/src/build/GhosttyExe.zig @@ -1,6 +1,7 @@ const Ghostty = @This(); const std = @import("std"); +const builtin = @import("builtin"); const Config = @import("Config.zig"); const SharedDeps = @import("SharedDeps.zig"); diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index 20b5df862..b3fe860d1 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -1,6 +1,8 @@ const SharedDeps = @This(); const std = @import("std"); +const builtin = @import("builtin"); + const Config = @import("Config.zig"); const HelpStrings = @import("HelpStrings.zig"); const MetallibStep = @import("MetallibStep.zig"); @@ -104,6 +106,19 @@ pub fn add( var static_libs = LazyPathList.init(b.allocator); errdefer static_libs.deinit(); + // WARNING: This is a hack! + // If we're cross-compiling to Darwin then we don't add any deps. + // We don't support cross-compiling to Darwin but due to the way + // lazy dependencies work with Zig, we call this function. So we just + // bail. The build will fail but the build would've failed anyways. + // And this lets other non-platform-specific targets like `lib-vt` + // cross-compile properly. + if (!builtin.target.os.tag.isDarwin() and + self.config.target.result.os.tag.isDarwin()) + { + return static_libs; + } + // Every exe gets build options populated step.root_module.addOptions("build_options", self.options);