build: don't add deps when cross compiling to darwin

pull/8895/head
Mitchell Hashimoto 2025-09-23 15:01:48 -07:00
parent b006101ddd
commit 85345c31cf
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 16 additions and 0 deletions

View File

@ -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");

View File

@ -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);