Experimental support for non-Apple GCCs
This commit is contained in:
parent
f870d605fa
commit
11f8b2f49c
@ -68,10 +68,8 @@ class Cmd
|
||||
'clang++'
|
||||
when /llvm-gcc/
|
||||
'llvm-g++-4.2'
|
||||
when /gcc(-4.2)?$/
|
||||
'g++-4.2'
|
||||
when /gcc-4.0/
|
||||
'g++-4.0'
|
||||
when /gcc(-\d\.\d)?$/
|
||||
'g++' + $1.to_s
|
||||
end
|
||||
else
|
||||
@arg0
|
||||
|
||||
@ -2,7 +2,7 @@ module SharedEnvExtension
|
||||
CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}
|
||||
FC_FLAG_VARS = %w{FCFLAGS FFLAGS}
|
||||
|
||||
COMPILERS = ['clang', 'gcc-4.0', 'gcc-4.2', 'llvm-gcc']
|
||||
COMPILERS = ['clang', 'gcc-4.0', 'gcc-4.2', 'llvm-gcc', /(gcc-\d\.\d)/]
|
||||
COMPLER_ALIASES = {'gcc' => 'gcc-4.2', 'llvm' => 'llvm-gcc'}
|
||||
COMPILER_SYMBOL_MAP = { 'gcc-4.0' => :gcc_4_0,
|
||||
'gcc-4.2' => :gcc,
|
||||
@ -150,4 +150,28 @@ module SharedEnvExtension
|
||||
flags.each { |key| self[key] = cflags }
|
||||
set_cpu_flags(flags)
|
||||
end
|
||||
|
||||
def warn_about_non_apple_gcc(gcc)
|
||||
opoo "Experimental support for non-Apple GCC enabled. Some builds may fail!"
|
||||
|
||||
begin
|
||||
gcc_name = 'gcc' + gcc.delete('.')
|
||||
gcc = Formula.factory(gcc_name)
|
||||
if !gcc.installed?
|
||||
raise <<-EOS.undent
|
||||
The requested Homebrew GCC, #{gcc_name}, was not installed.
|
||||
You must:
|
||||
brew tap homebrew/versions
|
||||
brew install #{gcc_name}
|
||||
EOS
|
||||
end
|
||||
|
||||
ENV.append('PATH', gcc.opt_prefix/'bin', ':')
|
||||
rescue FormulaUnavailableError
|
||||
raise <<-EOS.undent
|
||||
Homebrew GCC requested, but formula #{gcc_name} not found!
|
||||
You may need to: brew tap homebrew/versions
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -68,6 +68,10 @@ module Stdenv
|
||||
self.cxx = MacOS.locate("c++")
|
||||
end
|
||||
|
||||
if self['CC'] =~ GNU_GCC_REGEXP
|
||||
warn_about_non_apple_gcc($1)
|
||||
end
|
||||
|
||||
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
||||
macosxsdk MacOS.version
|
||||
|
||||
|
||||
@ -109,6 +109,10 @@ module Superenv
|
||||
end
|
||||
append_path('PATH', apple_gcc42.opt_prefix/'bin') if apple_gcc42
|
||||
end
|
||||
|
||||
if ENV['HOMEBREW_CC'] =~ /gcc-(\d\.\d)/ && $1 != '4.2'
|
||||
warn_about_non_apple_gcc($1)
|
||||
end
|
||||
end
|
||||
|
||||
def universal_binary
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user