| ... | @@ -1379,13 +1379,21 @@ pub fn populateMissingMetadata(self: *MachO) !void { | ... | @@ -1379,13 +1379,21 @@ pub fn populateMissingMetadata(self: *MachO) !void { |
| 1379 | } | 1379 | } |
| 1380 | if (self.version_min_cmd_index == null) { | 1380 | if (self.version_min_cmd_index == null) { |
| 1381 | self.version_min_cmd_index = @intCast(u16, self.load_commands.items.len); | 1381 | self.version_min_cmd_index = @intCast(u16, self.load_commands.items.len); |
| | 1382 | const cmd: u32 = switch (self.base.options.target.os.tag) { |
| | 1383 | .macos => macho.LC_VERSION_MIN_MACOSX, |
| | 1384 | .ios => macho.LC_VERSION_MIN_IPHONEOS, |
| | 1385 | .tvos => macho.LC_VERSION_MIN_TVOS, |
| | 1386 | .watchos => macho.LC_VERSION_MIN_WATCHOS, |
| | 1387 | else => unreachable, // wrong OS |
| | 1388 | }; |
| | 1389 | const ver = self.base.options.target.os.version_range.semver.min; |
| | 1390 | const version = ver.major << 16 | ver.minor << 8 | ver.patch; |
| 1382 | try self.load_commands.append(self.base.allocator, .{ | 1391 | try self.load_commands.append(self.base.allocator, .{ |
| 1383 | // TODO allow for different targets and different versions | | |
| 1384 | .MinVersion = .{ | 1392 | .MinVersion = .{ |
| 1385 | .cmd = macho.LC_VERSION_MIN_MACOSX, | 1393 | .cmd = cmd, |
| 1386 | .cmdsize = @sizeOf(macho.version_min_command), | 1394 | .cmdsize = @sizeOf(macho.version_min_command), |
| 1387 | .version = 0xB0001, // 11.0.1 BigSur | 1395 | .version = version, |
| 1388 | .sdk = 0xB0001, // 11.0.1 BigSur | 1396 | .sdk = version, |
| 1389 | }, | 1397 | }, |
| 1390 | }); | 1398 | }); |
| 1391 | } | 1399 | } |