mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
utils/gems: set SDKROOT for macOS system Ruby
This commit is contained in:
parent
c6b7836368
commit
200cdc69df
@ -132,6 +132,7 @@ module Homebrew
|
|||||||
old_bundle_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
|
old_bundle_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
|
||||||
old_bundle_with = ENV.fetch("BUNDLE_WITH", nil)
|
old_bundle_with = ENV.fetch("BUNDLE_WITH", nil)
|
||||||
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
|
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
|
||||||
|
old_sdkroot = ENV.fetch("SDKROOT", nil)
|
||||||
|
|
||||||
install_bundler!
|
install_bundler!
|
||||||
|
|
||||||
@ -145,6 +146,13 @@ module Homebrew
|
|||||||
ENV["BUNDLE_WITH"] = groups.join(" ")
|
ENV["BUNDLE_WITH"] = groups.join(" ")
|
||||||
ENV["BUNDLE_FROZEN"] = "true"
|
ENV["BUNDLE_FROZEN"] = "true"
|
||||||
|
|
||||||
|
# System Ruby does not pick up the correct SDK by default.
|
||||||
|
if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]
|
||||||
|
macos_major = ENV.fetch("HOMEBREW_MACOS_VERSION").partition(".").first
|
||||||
|
sdkroot = "/Library/Developer/CommandLineTools/SDKs/MacOSX#{macos_major}.sdk"
|
||||||
|
ENV["SDKROOT"] = sdkroot if Dir.exist?(sdkroot)
|
||||||
|
end
|
||||||
|
|
||||||
if @bundle_installed_groups != groups
|
if @bundle_installed_groups != groups
|
||||||
bundle = File.join(find_in_path("bundle"), "bundle")
|
bundle = File.join(find_in_path("bundle"), "bundle")
|
||||||
bundle_check_output = `#{bundle} check 2>&1`
|
bundle_check_output = `#{bundle} check 2>&1`
|
||||||
@ -186,5 +194,6 @@ module Homebrew
|
|||||||
ENV["BUNDLE_WITH"] = old_bundle_with
|
ENV["BUNDLE_WITH"] = old_bundle_with
|
||||||
ENV["BUNDLE_FROZEN"] = old_bundle_frozen
|
ENV["BUNDLE_FROZEN"] = old_bundle_frozen
|
||||||
end
|
end
|
||||||
|
ENV["SDKROOT"] = old_sdkroot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user