Skip to content

Commit

Permalink
extend/os/linux/development_tools: consider keg-only glibc & binutils
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Sep 19, 2022
1 parent 7ff1af6 commit 0633af0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Library/Homebrew/extend/os/linux/development_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ class << self
sig { params(tool: String).returns(T.nilable(Pathname)) }
def locate(tool)
(@locate ||= {}).fetch(tool) do |key|
@locate[key] = if (path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
path
elsif File.executable?(path = "/usr/bin/#{tool}")
Pathname.new path
@locate[key] = if build_system_too_old? &&
(binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
binutils_path
elsif build_system_too_old? && (glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
glibc_path
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
homebrew_path
elsif File.executable?(system_path = "/usr/bin/#{tool}")
Pathname.new system_path
end
end
end
Expand All @@ -30,7 +35,7 @@ def build_system_too_old?

sig { returns(T::Boolean) }
def system_gcc_too_old?
gcc_version("gcc") < OS::LINUX_GCC_CI_VERSION
gcc_version("/usr/bin/gcc") < OS::LINUX_GCC_CI_VERSION
end

sig { returns(T::Hash[String, T.nilable(String)]) }
Expand Down

0 comments on commit 0633af0

Please sign in to comment.