aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2013-06-04 10:18:14 -0500
committerMisty De Meo2013-09-01 13:19:12 -0700
commit11f8b2f49c57bd09b79d0aac2ecd11869d9289d2 (patch)
tree158852878b4c46887e442c21f88105764ca7ae1b /Library
parentf870d605fac5ac2f1b68f3bfea274242cccedcea (diff)
downloadbrew-11f8b2f49c57bd09b79d0aac2ecd11869d9289d2.tar.bz2
Experimental support for non-Apple GCCs
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc6
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb26
-rw-r--r--Library/Homebrew/extend/ENV/std.rb4
-rw-r--r--Library/Homebrew/extend/ENV/super.rb4
4 files changed, 35 insertions, 5 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 835079617..8075017d8 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -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
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 12fc7446a..7e8b4e095 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -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
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 97c1bf615..67ab85952 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -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
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index e82f5508e..49a59017c 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -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