parent
500f9eada8
commit
5c1f463ac0
@ -469,7 +469,7 @@ module Homebrew
|
|||||||
unless installed_gcc
|
unless installed_gcc
|
||||||
run_as_not_developer { test "brew", "install", "gcc" }
|
run_as_not_developer { test "brew", "install", "gcc" }
|
||||||
installed_gcc = true
|
installed_gcc = true
|
||||||
OS::Mac.clear_version_cache
|
DevelopmentTools.clear_version_cache
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
skip formula_name
|
skip formula_name
|
||||||
|
|||||||
@ -74,6 +74,21 @@ class DevelopmentTools
|
|||||||
`#{path} --version`[/clang-(\d{2,})/, 1].to_i
|
`#{path} --version`[/clang-(\d{2,})/, 1].to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def non_apple_gcc_version(cc)
|
||||||
|
(@non_apple_gcc_version ||= {}).fetch(cc) do
|
||||||
|
path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc)
|
||||||
|
path = locate(cc) unless path.exist?
|
||||||
|
version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1] if path
|
||||||
|
@non_apple_gcc_version[cc] = version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear_version_cache
|
||||||
|
@gcc_40_build_version = @gcc_42_build_version = @llvm_build_version = nil
|
||||||
|
@clang_version = @clang_build_version = nil
|
||||||
|
@non_apple_gcc_version = {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -109,21 +109,6 @@ module OS
|
|||||||
s.path unless s.nil?
|
s.path unless s.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def non_apple_gcc_version(cc)
|
|
||||||
(@non_apple_gcc_version ||= {}).fetch(cc) do
|
|
||||||
path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc)
|
|
||||||
path = DevelopmentTools.locate(cc) unless path.exist?
|
|
||||||
version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1] if path
|
|
||||||
@non_apple_gcc_version[cc] = version
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def clear_version_cache
|
|
||||||
@gcc_40_build_version = @gcc_42_build_version = @llvm_build_version = nil
|
|
||||||
@clang_version = @clang_build_version = nil
|
|
||||||
@non_apple_gcc_version = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
# See these issues for some history:
|
# See these issues for some history:
|
||||||
# https://github.com/Homebrew/legacy-homebrew/issues/13
|
# https://github.com/Homebrew/legacy-homebrew/issues/13
|
||||||
# https://github.com/Homebrew/legacy-homebrew/issues/41
|
# https://github.com/Homebrew/legacy-homebrew/issues/41
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user