Pass full match to warn_about_non_apple_gcc
This commit is contained in:
parent
2d8c307a3c
commit
1bba5fd88a
@ -98,10 +98,10 @@ module SharedEnvExtension
|
|||||||
|
|
||||||
def compiler
|
def compiler
|
||||||
@compiler ||= if (cc = ARGV.cc)
|
@compiler ||= if (cc = ARGV.cc)
|
||||||
warn_about_non_apple_gcc($1) if cc =~ GNU_GCC_REGEXP
|
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
|
||||||
fetch_compiler(cc, "--cc")
|
fetch_compiler(cc, "--cc")
|
||||||
elsif (cc = homebrew_cc)
|
elsif (cc = homebrew_cc)
|
||||||
warn_about_non_apple_gcc($1) if cc =~ GNU_GCC_REGEXP
|
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
|
||||||
compiler = fetch_compiler(cc, "HOMEBREW_CC")
|
compiler = fetch_compiler(cc, "HOMEBREW_CC")
|
||||||
|
|
||||||
if @formula
|
if @formula
|
||||||
@ -188,14 +188,13 @@ module SharedEnvExtension
|
|||||||
append "LDFLAGS", "-B#{ld64.bin}/"
|
append "LDFLAGS", "-B#{ld64.bin}/"
|
||||||
end
|
end
|
||||||
|
|
||||||
def gcc_version_formula(version)
|
def gcc_version_formula(name)
|
||||||
gcc_name = "gcc-#{version}"
|
version = name[GNU_GCC_REGEXP, 1]
|
||||||
gcc_version_name = "gcc#{version.delete('.')}"
|
gcc_version_name = "gcc#{version.delete('.')}"
|
||||||
|
|
||||||
gcc_path = HOMEBREW_PREFIX.join "opt/gcc/bin/#{gcc_name}"
|
gcc_path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", name)
|
||||||
gcc_formula = Formulary.factory "gcc"
|
gcc_formula = Formulary.factory "gcc"
|
||||||
gcc_versions_path = \
|
gcc_versions_path = HOMEBREW_PREFIX.join("opt", gcc_version_name, "bin", name)
|
||||||
HOMEBREW_PREFIX.join "opt/#{gcc_version_name}/bin/#{gcc_name}"
|
|
||||||
|
|
||||||
if gcc_path.exist?
|
if gcc_path.exist?
|
||||||
gcc_formula
|
gcc_formula
|
||||||
@ -210,11 +209,11 @@ module SharedEnvExtension
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def warn_about_non_apple_gcc(gcc)
|
def warn_about_non_apple_gcc(name)
|
||||||
gcc_name = 'gcc' + gcc.delete('.')
|
gcc_version_name = name.delete(".-")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gcc_formula = gcc_version_formula(gcc)
|
gcc_formula = gcc_version_formula(name)
|
||||||
if gcc_formula.name == "gcc"
|
if gcc_formula.name == "gcc"
|
||||||
return if gcc_formula.opt_prefix.exist?
|
return if gcc_formula.opt_prefix.exist?
|
||||||
raise <<-EOS.undent
|
raise <<-EOS.undent
|
||||||
@ -226,15 +225,15 @@ module SharedEnvExtension
|
|||||||
|
|
||||||
if !gcc_formula.opt_prefix.exist?
|
if !gcc_formula.opt_prefix.exist?
|
||||||
raise <<-EOS.undent
|
raise <<-EOS.undent
|
||||||
The requested Homebrew GCC, #{gcc_name}, was not installed.
|
The requested Homebrew GCC, #{gcc_version_name}, was not installed.
|
||||||
You must:
|
You must:
|
||||||
brew tap homebrew/versions
|
brew tap homebrew/versions
|
||||||
brew install #{gcc_name}
|
brew install #{gcc_version_name}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
raise <<-EOS.undent
|
raise <<-EOS.undent
|
||||||
Homebrew GCC requested, but formula #{gcc_name} not found!
|
Homebrew GCC requested, but formula #{gcc_version_name} not found!
|
||||||
You may need to: brew tap homebrew/versions
|
You may need to: brew tap homebrew/versions
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
@ -56,7 +56,7 @@ module Stdenv
|
|||||||
send(compiler)
|
send(compiler)
|
||||||
|
|
||||||
if cc =~ GNU_GCC_REGEXP
|
if cc =~ GNU_GCC_REGEXP
|
||||||
gcc_formula = gcc_version_formula($1)
|
gcc_formula = gcc_version_formula($&)
|
||||||
append_path "PATH", gcc_formula.opt_bin.to_s
|
append_path "PATH", gcc_formula.opt_bin.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ module Superenv
|
|||||||
end
|
end
|
||||||
paths << apple_gcc42.opt_bin.to_s if apple_gcc42
|
paths << apple_gcc42.opt_bin.to_s if apple_gcc42
|
||||||
when GNU_GCC_REGEXP
|
when GNU_GCC_REGEXP
|
||||||
gcc_formula = gcc_version_formula($1)
|
gcc_formula = gcc_version_formula($&)
|
||||||
paths << gcc_formula.opt_bin.to_s
|
paths << gcc_formula.opt_bin.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user