brew/Library/Homebrew/extend/rbconfig_extension.rb
2020-12-07 10:33:56 -08:00

18 lines
497 B
Ruby

# typed: false
# frozen_string_literal: true
macos_version = ENV["HOMEBREW_MACOS_VERSION"][0..4]
macos_sdk = "MacOSX#{macos_version}.sdk"
# Ruby hardcodes what might end up being an incorrect SDK path in some of the
# variables that get used in mkmf.rb.
# This patches them up to use the correct SDK.
RbConfig::CONFIG.each do |k, v|
next unless v.include?("MacOSX.sdk")
new_value = v.gsub("MacOSX.sdk", macos_sdk)
next unless File.exist?(new_value)
RbConfig::CONFIG[k] = new_value
end