diff options
| author | Max Howell | 2011-08-31 17:50:39 +0100 |
|---|---|---|
| committer | Max Howell | 2011-09-02 12:12:20 +0100 |
| commit | 8e88b22fd1ec65a344ce6e4facd6dad4b415b2ad (patch) | |
| tree | 1a5bc922b0278c0170ca6eb67ece7b3db939266c /Library | |
| parent | 3f4ef7e2758ac702d0a27895f4c0d0fa7dd219ec (diff) | |
| download | homebrew-8e88b22fd1ec65a344ce6e4facd6dad4b415b2ad.tar.bz2 | |
Remove Xcode dependence from ENV.rb
Fixes #7329.
Fixes #7269.
Fixes #7236.
Also quite a lot of tidy. This should all work fine.
I think we only started referring into xcode_prefix because LLVM used to not
be linked into /usr/bin. But for sure this is no longer true. If someone out
there doesn't link cc etc. into /usr/bin then I guess we can revise this patch
but it's not something we officially supported before, it was just an
accident.
I added a test step in the init code so that a working compiler will always be
selected. This is mainly a fallback for old Xcodes. Though a comment in
another area of the code suggested Xcode 3 on 10.5 doesn't have LLVM so…
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/ENV.rb | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index b894c000d..5b9c13125 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -27,6 +27,10 @@ module HomebrewEnvExtension when :gcc then self.gcc end + # we must have a working compiler! + ENV['CC'] = '/usr/bin/cc' unless File.exist? ENV['CC'] + ENV['CXX'] = '/usr/bin/c++' unless File.exist? ENV['CXX'] + # In rare cases this may break your builds, as the tool for some reason wants # to use a specific linker. However doing this in general causes formula to # build more successfully because we are changing CC and many build systems @@ -111,50 +115,29 @@ module HomebrewEnvExtension end def gcc_4_0_1 - self['CC'] = self['LD'] = '/usr/bin/gcc-4.0' + self['CC'] = '/usr/bin/gcc-4.0' self['CXX'] = '/usr/bin/g++-4.0' - self.O3 + remove_from_cflags '-O4' remove_from_cflags '-march=core2' remove_from_cflags %r{-msse4(\.\d)?} end alias_method :gcc_4_0, :gcc_4_0_1 def gcc - if MacOS.xcode_version < '4' - self['CC'] = '/usr/bin/cc' - self['CXX'] = '/usr/bin/c++' - elsif MacOS.xcode_version >= '4.2' - # Apple stopped adding the -4.2 suffixes - self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/gcc" - self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/g++" - else - # With Xcode4 cc, c++, gcc and g++ are actually symlinks to llvm-gcc - self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/gcc-4.2" - self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/g++-4.2" - end + self['CC'] = "/usr/bin/gcc-4.2" + self['CXX'] = "/usr/bin/g++-4.2" remove_from_cflags '-O4' end alias_method :gcc_4_2, :gcc def llvm - if MacOS.xcode_version < '4' - self.gcc - elsif MacOS.xcode_version < '4.1' - self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-gcc" - self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-g++" - else - self['CC'] = '/usr/bin/cc' - self['CXX'] = '/usr/bin/c++' - end + self['CC'] = "/usr/bin/llvm-gcc" + self['CXX'] = "/usr/bin/llvm-g++" end def clang - if MacOS.xcode_version > '4' - self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/clang" - self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/clang++" - else - self.gcc - end + self['CC'] = "/usr/bin/clang" + self['CXX'] = "/usr/bin/clang++" end def fortran |
