Skip to content

Commit 5ae4f25

Browse files
committed
macos_version: add KERNEL_MAJOR_VERSIONS map
This will be used by `llvm` (and, presumably, in the future, versioned LLVM formulae). The idea is that we will write a config file for each OS version pointing to the correct SDKROOT so that `llvm` does not require rebuilding/reinstalling when a user upgrades to a new major version of macOS. See Homebrew/homebrew-core#196094.
1 parent d9f1784 commit 5ae4f25

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Library/Homebrew/macos_version.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def initialize(version)
1818

1919
# NOTE: When removing symbols here, ensure that they are added
2020
# to `DEPRECATED_MACOS_VERSIONS` in `MacOSRequirement`.
21+
# When adding or removing symbols here, ensure that you
22+
# also update the KERNEL_MAJOR_VERSIONS map below.
2123
SYMBOLS = {
2224
sequoia: "15",
2325
sonoma: "14",
@@ -31,6 +33,21 @@ def initialize(version)
3133
el_capitan: "10.11",
3234
}.freeze
3335

36+
# Map of macOS version strings to kernel major versions.
37+
# https://en.wikipedia.org/wiki/MacOS_version_history#Releases
38+
KERNEL_MAJOR_VERSIONS = {
39+
"15" => "24",
40+
"14" => "23",
41+
"13" => "22",
42+
"12" => "21",
43+
"11" => "20",
44+
"10.15" => "19",
45+
"10.14" => "18",
46+
"10.13" => "17",
47+
"10.12" => "16",
48+
"10.11" => "15",
49+
}.freeze
50+
3451
sig { params(version: Symbol).returns(T.attached_class) }
3552
def self.from_symbol(version)
3653
str = SYMBOLS.fetch(version) { raise MacOSVersion::Error, version }

0 commit comments

Comments
 (0)