From 9b4a7856ac92e025e9df73ed5d18e4412fa55b5c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 8 Dec 2020 17:14:00 +0000 Subject: [PATCH 1/2] Revert "RbConfig: fix broken MacOS SDK paths" This reverts commit 11445e0f3edf29ee64081c5a05b5257d9b5ccdd9. --- Library/Homebrew/extend/rbconfig_extension.rb | 17 ----------------- Library/Homebrew/utils/gems.rb | 11 ----------- 2 files changed, 28 deletions(-) delete mode 100644 Library/Homebrew/extend/rbconfig_extension.rb diff --git a/Library/Homebrew/extend/rbconfig_extension.rb b/Library/Homebrew/extend/rbconfig_extension.rb deleted file mode 100644 index e26042eb66e08..0000000000000 --- a/Library/Homebrew/extend/rbconfig_extension.rb +++ /dev/null @@ -1,17 +0,0 @@ -# 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 diff --git a/Library/Homebrew/utils/gems.rb b/Library/Homebrew/utils/gems.rb index 3e5c9105500d1..a75f0b8561e06 100644 --- a/Library/Homebrew/utils/gems.rb +++ b/Library/Homebrew/utils/gems.rb @@ -109,15 +109,6 @@ def install_bundler_gems! install_bundler! ENV["BUNDLE_GEMFILE"] = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") - - # We can't use OS.mac? because not enough has - # been required yet this early in the boot process - if ENV["HOMEBREW_SYSTEM"] == "Macintosh" - # This patches up some paths used by mkmf.rb - extend_path = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "extend") - ENV["RUBYOPT"] = "-r#{extend_path}/rbconfig_extension" - end - @bundle_installed ||= begin bundle = File.join(find_in_path("bundle"), "bundle") bundle_check_output = `#{bundle} check 2>&1` @@ -135,8 +126,6 @@ def install_bundler_gems! end end - ENV["RUBYOPT"] = "" - setup_gem_environment! end end From f7d72ae77cb01b25b77cca9cfb700d3b12d9dbab Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 8 Dec 2020 17:23:06 +0000 Subject: [PATCH 2/2] ruby.sh: don't test ruby on macOS. Instead defer to the `HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH` variable. --- Library/Homebrew/utils/ruby.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh index bcd18112018b7..a8ad247e15b50 100644 --- a/Library/Homebrew/utils/ruby.sh +++ b/Library/Homebrew/utils/ruby.sh @@ -32,7 +32,8 @@ unusable_ruby() { if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]] then return 1 - elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] && test_ruby "$HOMEBREW_RUBY_PATH" + elif [[ -z "$HOMEBREW_MACOS" && -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] && + test_ruby "$HOMEBREW_RUBY_PATH" then return 1 else