Skip to content

Commit

Permalink
macos_version: add KERNEL_MAJOR_VERSIONS map
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
carlocab committed Oct 30, 2024
1 parent d9f1784 commit 5ae4f25
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Library/Homebrew/macos_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def initialize(version)

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

# Map of macOS version strings to kernel major versions.
# https://en.wikipedia.org/wiki/MacOS_version_history#Releases
KERNEL_MAJOR_VERSIONS = {
"15" => "24",
"14" => "23",
"13" => "22",
"12" => "21",
"11" => "20",
"10.15" => "19",
"10.14" => "18",
"10.13" => "17",
"10.12" => "16",
"10.11" => "15",
}.freeze

sig { params(version: Symbol).returns(T.attached_class) }
def self.from_symbol(version)
str = SYMBOLS.fetch(version) { raise MacOSVersion::Error, version }
Expand Down

0 comments on commit 5ae4f25

Please sign in to comment.