| author | |
| committer | |
| log | c42439dff9bdfa1ff90e4243ec7eaad94f4241ca |
| tree | d7d4bf42c509fbc1d4e4a53b47646ae6a15e74c0 |
| parent | 42a351e099dd41fe96dab4f6dadd277884188f3f |
This is mainly because arm64 macOS doesn't support all
versions supported by x86_64 macOS. This is just a temporary
thing until both architectures support the same set of OSes.4 files changed, 20 insertions(+), 10 deletions(-)
lib/std/target.zig+17-7| ... | ... | @@ -81,10 +81,10 @@ pub const Target = struct { |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | pub fn defaultVersionRange(tag: Tag) Os { | |
| 84 | pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch) Os { | |
| 85 | 85 | return .{ |
| 86 | 86 | .tag = tag, |
| 87 | .version_range = VersionRange.default(tag), | |
| 87 | .version_range = VersionRange.default(tag, arch), | |
| 88 | 88 | }; |
| 89 | 89 | } |
| 90 | 90 | }; |
| ... | ... | @@ -226,7 +226,7 @@ pub const Target = struct { |
| 226 | 226 | |
| 227 | 227 | /// The default `VersionRange` represents the range that the Zig Standard Library |
| 228 | 228 | /// bases its abstractions on. |
| 229 | pub fn default(tag: Tag) VersionRange { | |
| 229 | pub fn default(tag: Tag, arch: Cpu.Arch) VersionRange { | |
| 230 | 230 | switch (tag) { |
| 231 | 231 | .freestanding, |
| 232 | 232 | .ananas, |
| ... | ... | @@ -266,12 +266,22 @@ pub const Target = struct { |
| 266 | 266 | .max = .{ .major = 13, .minor = 0 }, |
| 267 | 267 | }, |
| 268 | 268 | }, |
| 269 | .macos => return .{ | |
| 270 | .semver = .{ | |
| 271 | .min = .{ .major = 10, .minor = 13 }, | |
| 272 | .max = .{ .major = 12, .minor = 0 }, | |
| 269 | .macos => return switch (arch) { | |
| 270 | .aarch64 => VersionRange{ | |
| 271 | .semver = .{ | |
| 272 | .min = .{ .major = 11, .minor = 6 }, | |
| 273 | .max = .{ .major = 12, .minor = 0 }, | |
| 274 | }, | |
| 273 | 275 | }, |
| 276 | .x86_64 => VersionRange{ | |
| 277 | .semver = .{ | |
| 278 | .min = .{ .major = 10, .minor = 13 }, | |
| 279 | .max = .{ .major = 12, .minor = 0 }, | |
| 280 | }, | |
| 281 | }, | |
| 282 | else => unreachable, | |
| 274 | 283 | }, |
| 284 | ||
| 275 | 285 | .ios => return .{ |
| 276 | 286 | .semver = .{ |
| 277 | 287 | .min = .{ .major = 12, .minor = 0 }, |
lib/std/zig/cross_target.zig+1-1| ... | ... | @@ -375,7 +375,7 @@ pub const CrossTarget = struct { |
| 375 | 375 | // `builtin.os` works when doing `zig build` because Zig generates a build executable using |
| 376 | 376 | // native OS version range. However this will not be accurate otherwise, and |
| 377 | 377 | // will need to be integrated with `std.zig.system.NativeTargetInfo.detect`. |
| 378 | var adjusted_os = if (self.os_tag) |os_tag| os_tag.defaultVersionRange() else builtin.os; | |
| 378 | var adjusted_os = if (self.os_tag) |os_tag| os_tag.defaultVersionRange(self.getCpuArch()) else builtin.os; | |
| 379 | 379 | |
| 380 | 380 | if (self.os_version_min) |min| switch (min) { |
| 381 | 381 | .none => {}, |
lib/std/zig/system.zig+1-1| ... | ... | @@ -238,7 +238,7 @@ pub const NativeTargetInfo = struct { |
| 238 | 238 | /// deinitialization method. |
| 239 | 239 | /// TODO Remove the Allocator requirement from this function. |
| 240 | 240 | pub fn detect(allocator: *Allocator, cross_target: CrossTarget) DetectError!NativeTargetInfo { |
| 241 | var os = cross_target.getOsTag().defaultVersionRange(); | |
| 241 | var os = cross_target.getOsTag().defaultVersionRange(cross_target.getCpuArch()); | |
| 242 | 242 | if (cross_target.os_tag == null) { |
| 243 | 243 | switch (builtin.target.os.tag) { |
| 244 | 244 | .linux => { |
src/stage1/codegen.cpp+1-1| ... | ... | @@ -9305,7 +9305,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 9305 | 9305 | buf_appendf(contents, "pub const abi = std.Target.Abi.%s;\n", cur_abi); |
| 9306 | 9306 | buf_appendf(contents, "pub const cpu = std.Target.Cpu.baseline(.%s);\n", cur_arch); |
| 9307 | 9307 | buf_appendf(contents, "pub const stage2_arch: std.Target.Cpu.Arch = .%s;\n", cur_arch); |
| 9308 | buf_appendf(contents, "pub const os = std.Target.Os.Tag.defaultVersionRange(.%s);\n", cur_os); | |
| 9308 | buf_appendf(contents, "pub const os = std.Target.Os.Tag.defaultVersionRange(.%s, .%s);\n", cur_os, cur_arch); | |
| 9309 | 9309 | buf_appendf(contents, |
| 9310 | 9310 | "pub const target = std.Target{\n" |
| 9311 | 9311 | " .cpu = cpu,\n" |