Merge pull request #3085 from Platin21/fix/macos-versions

Adds new MacOS Versions and Fixes Kernel Matching
This commit is contained in:
Jeroen van Rijn
2024-01-10 18:31:17 +01:00
committed by GitHub
2 changed files with 422 additions and 318 deletions
+50
View File
@@ -455,6 +455,17 @@ macos_release_map: map[string]Darwin_To_Release = {
"20G624" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}}, "20G624" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}},
"20G630" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}}, "20G630" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}},
"20G730" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}}, "20G730" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}},
"20G817" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 0}}},
"20G918" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 1}}},
"20G1020" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 2}}},
"20G1116" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 3}}},
"20G1120" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 4}}},
"20G1225" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 5}}},
"20G1231" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 6}}},
"20G1345" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 7}}},
"20G1351" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 8}}},
"20G1426" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 9}}},
"20G1427" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 10}}},
// MacOS Monterey // MacOS Monterey
"21A344" = {{21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}}, "21A344" = {{21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}},
@@ -470,6 +481,45 @@ macos_release_map: map[string]Darwin_To_Release = {
"21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}}, "21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
"21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}}, "21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
"21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}}, "21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
"21G217" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 1}}},
"21G320" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 2}}},
"21G419" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 3}}},
"21G526" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 4}}},
"21G531" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 5}}},
"21G646" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 6}}},
"21G651" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 7}}},
"21G725" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 8}}},
"21G726" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 9}}},
"21G816" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}},
"21G920" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}},
"21G1974" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}},
// MacOS Ventura
"22A380" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 0}}},
"22A400" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 1}}},
"22C65" = {{22, 2, 0}, "macOS", {"Ventura", {13, 1, 0}}},
"22D49" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 0}}},
"22D68" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 1}}},
"22E252" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 0}}},
"22E261" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 1}}},
"22F66" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 0}}},
"22F82" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22E772610a" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22F770820d" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22G74" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 0}}},
"22G90" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 1}}},
"22G91" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 2}}},
"22G120" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 0}}},
"22G313" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 1}}},
"22G320" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 2}}},
// MacOS Sonoma
"23A344" = {{23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}},
"23B74" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}},
"23B81" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
"23B92" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
"23C64" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 0}}},
"23C71" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 1}}},
} }
@(private) @(private)
+62 -8
View File
@@ -824,6 +824,17 @@ gb_internal void report_os_info() {
{"20G624", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}}, {"20G624", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}},
{"20G630", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}}, {"20G630", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}},
{"20G730", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}}, {"20G730", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}},
{"20G817", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 0}}},
{"20G918", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 1}}},
{"20G1020", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 2}}},
{"20G1116", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 3}}},
{"20G1120", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 4}}},
{"20G1225", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 5}}},
{"20G1231", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 6}}},
{"20G1345", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 7}}},
{"20G1351", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 8}}},
{"20G1426", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 9}}},
{"20G1427", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 10}}},
{"21A344", {21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}}, {"21A344", {21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}},
{"21A559", {21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}}, {"21A559", {21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}},
{"21C52", {21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}}, {"21C52", {21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}},
@@ -836,6 +847,42 @@ gb_internal void report_os_info() {
{"21F2092", {21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}}, {"21F2092", {21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
{"21G72", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}}, {"21G72", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
{"21G83", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}}, {"21G83", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
{"21G115", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
{"21G217", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 1}}},
{"21G320", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 2}}},
{"21G419", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 3}}},
{"21G526", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 4}}},
{"21G531", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 5}}},
{"21G646", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 6}}},
{"21G651", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 7}}},
{"21G725", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 8}}},
{"21G726", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 9}}},
{"21G816", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}},
{"21G920", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}},
{"21G1974", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}},
{"22A380", {13, 0, 0}, "macOS", {"Ventura", {22, 1, 0}}},
{"22A400", {13, 0, 1}, "macOS", {"Ventura", {22, 1, 0}}},
{"22C65", {13, 1, 0}, "macOS", {"Ventura", {22, 2, 0}}},
{"22D49", {13, 2, 0}, "macOS", {"Ventura", {22, 3, 0}}},
{"22D68", {13, 2, 1}, "macOS", {"Ventura", {22, 3, 0}}},
{"22E252", {13, 3, 0}, "macOS", {"Ventura", {22, 4, 0}}},
{"22E261", {13, 3, 1}, "macOS", {"Ventura", {22, 4, 0}}},
{"22F66", {13, 4, 0}, "macOS", {"Ventura", {22, 5, 0}}},
{"22F82", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22E772610a", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22F770820d", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22G74", {13, 5, 0}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G90", {13, 5, 1}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G91", {13, 5, 2}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G120", {13, 6, 0}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G313", {13, 6, 1}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G320", {13, 6, 2}, "macOS", {"Ventura", {22, 6, 0}}},
{"23A344", {23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}},
{"23B74", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}},
{"23B81", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
{"23B92", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
{"23C64", {23, 2, 0}, "macOS", {"Sonoma", {14, 2, 0}}},
{"23C71", {23, 2, 0}, "macOS", {"Sonoma", {14, 2, 1}}},
}; };
@@ -867,38 +914,45 @@ gb_internal void report_os_info() {
// Scan table for match on BUILD // Scan table for match on BUILD
int macos_release_count = sizeof(macos_release_map) / sizeof(macos_release_map[0]); int macos_release_count = sizeof(macos_release_map) / sizeof(macos_release_map[0]);
Darwin_To_Release match = {}; Darwin_To_Release build_match = {};
Darwin_To_Release kernel_match = {};
for (int build = 0; build < macos_release_count; build++) { for (int build = 0; build < macos_release_count; build++) {
Darwin_To_Release rel = macos_release_map[build]; Darwin_To_Release rel = macos_release_map[build];
// Do we have an exact match on the BUILD? // Do we have an exact match on the BUILD?
if (gb_strcmp(rel.build, (const char *)build_buffer) == 0) { if (gb_strcmp(rel.build, (const char *)build_buffer) == 0) {
match = rel; build_match = rel;
break; break;
} }
// Do we have an exact Darwin match? // Do we have an exact Darwin match?
if (rel.darwin[0] == major && rel.darwin[1] == minor && rel.darwin[2] == patch) { if (rel.darwin[0] == major && rel.darwin[1] == minor && rel.darwin[2] == patch) {
match = rel; kernel_match = rel;
break;
} }
// Major kernel version needs to match exactly, // Major kernel version needs to match exactly,
if (rel.darwin[0] == major) { if (rel.darwin[0] == major) {
// No major version match yet. // No major version match yet.
if (!match.os_name) { if (!kernel_match.os_name) {
match = rel; kernel_match = rel;
} }
if (minor >= rel.darwin[1]) { if (minor >= rel.darwin[1]) {
match = rel; kernel_match = rel;
if (patch >= rel.darwin[2]) { if (patch >= rel.darwin[2]) {
match = rel; kernel_match = rel;
} }
} }
} }
} }
Darwin_To_Release match = {};
if(!build_match.build) {
match = kernel_match;
} else {
match = build_match;
}
if (match.os_name) { if (match.os_name) {
gb_printf("%s %s %d", match.os_name, match.release.name, match.release.version[0]); gb_printf("%s %s %d", match.os_name, match.release.name, match.release.version[0]);
if (match.release.version[1] > 0 || match.release.version[2] > 0) { if (match.release.version[1] > 0 || match.release.version[2] > 0) {