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 a653be8 commit fcdc376
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Library/Homebrew/extend/os/linux/development_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ 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?
@locate[key] = if (build_system_too_old? &&
((path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable? ||
(path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?)) ||
(path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
path
elsif File.executable?(path = "/usr/bin/#{tool}")
Pathname.new path
Expand All @@ -30,7 +33,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 fcdc376

Please sign in to comment.