non_apple_gcc_version: Use preferred_gcc

Check HOMEBREW_PREFIX/"opt/#{CompilerSelector.preferred_gcc}/bin/
This commit is contained in:
Shaun Jackman 2021-02-10 09:12:11 -08:00
parent 3bcd919a70
commit e615dc4fe6
No known key found for this signature in database
GPG Key ID: D4ED5223F4E57996

View File

@ -76,7 +76,7 @@ class DevelopmentTools
def non_apple_gcc_version(cc)
(@non_apple_gcc_version ||= {}).fetch(cc) do
path = HOMEBREW_PREFIX/"opt/gcc/bin"/cc
path = HOMEBREW_PREFIX/"opt/#{CompilerSelector.preferred_gcc}/bin"/cc
path = locate(cc) unless path.exist?
version = if path &&
build_version = `#{path} --version`[/gcc(?:(?:-\d+(?:\.\d)?)? \(.+\))? (\d+\.\d\.\d)/, 1]