From 00ec15a4b0834a1c14237124fbda32e80a7d5926 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 27 Feb 2022 14:39:21 -0700 Subject: [PATCH] gpu-dawn: correct macOS binary availability check Signed-off-by: Stephen Gutekanst --- gpu-dawn/build.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gpu-dawn/build.zig b/gpu-dawn/build.zig index e816d671..6d9b1b06 100644 --- a/gpu-dawn/build.zig +++ b/gpu-dawn/build.zig @@ -195,7 +195,16 @@ pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Opti const binaries_available = switch (target.os.tag) { .windows => false, // TODO(build-system): add Windows binaries .linux => target.cpu.arch.isX86() and target.abi.isGnu(), - .macos => (target.cpu.arch.isX86() or target.cpu.arch.isAARCH64()) and target.abi == .macabi, + .macos => blk: { + if (!target.cpu.arch.isX86() and !target.cpu.arch.isAARCH64()) break :blk false; + if (target.abi != .gnu) break :blk false; + + // If min. target macOS version is lesser than the min version we have available, then + // our binary is incompatible with the target. + const min_available = std.builtin.Version{ .major = 12, .minor = 1 }; + if (target.os.version_range.semver.min.order(min_available) == .lt) break :blk false; + break :blk true; + }, else => false, }; if (!binaries_available) {