diff options
| author | Jack Nagel | 2013-03-11 22:54:15 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-03-12 13:55:15 -0500 |
| commit | 5ddd40b8449efc82b831ff62151d5012f6e05ac0 (patch) | |
| tree | 8d782dc9569c8fc25b8f5da6f97c9fddd12a444e | |
| parent | 18fd4f122d41aca306ea17d86feacbbbf44ad05f (diff) | |
| download | homebrew-5ddd40b8449efc82b831ff62151d5012f6e05ac0.tar.bz2 | |
Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:
When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.
When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.
As a bonus, this makes the logic much easier to reason about.
Closes #18175.
| -rw-r--r-- | Library/Formula/cyassl.rb | 4 | ||||
| -rw-r--r-- | Library/Formula/devil.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/dpkg.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/ghc.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/go.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/grass.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/icu4c.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/inkscape.rb | 5 | ||||
| -rw-r--r-- | Library/Formula/irrlicht.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/libagg.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/libmonome.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/lilypond.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/ncmpcpp.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/notmuch.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/simgrid.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/tbb.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/yap.rb | 1 | ||||
| -rwxr-xr-x | Library/Homebrew/build.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/compilers.rb | 37 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_compilers.rb | 8 |
21 files changed, 11 insertions, 70 deletions
diff --git a/Library/Formula/cyassl.rb b/Library/Formula/cyassl.rb index 59947104f..d376be650 100644 --- a/Library/Formula/cyassl.rb +++ b/Library/Formula/cyassl.rb @@ -16,9 +16,7 @@ class Cyassl < Formula "https://github.com/cyassl/cyassl/commit/543d81ba97430844c04c82ea274a99122c9cd1b9.patch" end - fails_with :clang do - build 425 - end + fails_with :clang def install args = %W[--infodir=#{info} diff --git a/Library/Formula/devil.rb b/Library/Formula/devil.rb index ff6b3546d..6a50e44bc 100644 --- a/Library/Formula/devil.rb +++ b/Library/Formula/devil.rb @@ -12,7 +12,6 @@ class Devil < Formula # also, even with -std=gnu99 removed from the configure script, # devil fails to build with clang++ while compiling il_exr.cpp fails_with :clang do - build 425 cause "invalid -std=gnu99 flag while building C++" end diff --git a/Library/Formula/dpkg.rb b/Library/Formula/dpkg.rb index e2200e56a..b2cba27f9 100644 --- a/Library/Formula/dpkg.rb +++ b/Library/Formula/dpkg.rb @@ -9,7 +9,6 @@ class Dpkg < Formula depends_on 'gnu-tar' fails_with :clang do - build 425 cause 'cstdlib:142:3: error: declaration conflicts with target of using declaration already in scope' end diff --git a/Library/Formula/ghc.rb b/Library/Formula/ghc.rb index 6e8c5beae..436df0973 100644 --- a/Library/Formula/ghc.rb +++ b/Library/Formula/ghc.rb @@ -47,7 +47,6 @@ class Ghc < Formula end fails_with :clang do - build 425 cause <<-EOS.undent Building with Clang configures GHC to use Clang as its preprocessor, which causes subsequent GHC-based builds to fail. diff --git a/Library/Formula/go.rb b/Library/Formula/go.rb index 2c52e7ffe..5be0a9f5f 100644 --- a/Library/Formula/go.rb +++ b/Library/Formula/go.rb @@ -14,7 +14,6 @@ class Go < Formula if build.head? fails_with :clang do - build 425 cause "clang: error: no such file or directory: 'libgcc.a'" end end diff --git a/Library/Formula/grass.rb b/Library/Formula/grass.rb index 366b3dbe7..e4aad13c3 100644 --- a/Library/Formula/grass.rb +++ b/Library/Formula/grass.rb @@ -31,7 +31,6 @@ class Grass < Formula def patches; DATA; end fails_with :clang do - build 425 cause "Multiple build failures while compiling GRASS tools." end diff --git a/Library/Formula/icu4c.rb b/Library/Formula/icu4c.rb index 02a68983f..bbc11349c 100644 --- a/Library/Formula/icu4c.rb +++ b/Library/Formula/icu4c.rb @@ -18,7 +18,6 @@ class Icu4c < Formula option :universal fails_with :clang do - build 425 cause "Icu will turn on C++11 mode when built with clang, which causes incompatibilities." end diff --git a/Library/Formula/inkscape.rb b/Library/Formula/inkscape.rb index 4bcf8d8f3..5fbf5e2cb 100644 --- a/Library/Formula/inkscape.rb +++ b/Library/Formula/inkscape.rb @@ -20,10 +20,7 @@ class Inkscape < Formula depends_on 'pango' depends_on :x11 - fails_with :clang do - build 425 - cause "Requires gcc" - end + fails_with :clang def install system "./configure", "--disable-dependency-tracking", diff --git a/Library/Formula/irrlicht.rb b/Library/Formula/irrlicht.rb index 1b6079b71..d6431d178 100644 --- a/Library/Formula/irrlicht.rb +++ b/Library/Formula/irrlicht.rb @@ -10,7 +10,6 @@ class Irrlicht < Formula depends_on :xcode fails_with :clang do - build 425 cause <<-EOS.undent COpenGLExtensionHandler.h:2390:31: error: expected ')' glProgramParameteriEXT((long GLuint)program, pname, value); diff --git a/Library/Formula/libagg.rb b/Library/Formula/libagg.rb index 3a026b1b1..3eb5e771a 100644 --- a/Library/Formula/libagg.rb +++ b/Library/Formula/libagg.rb @@ -12,7 +12,6 @@ class Libagg < Formula depends_on :freetype => :optional fails_with :clang do - build 425 cause <<-EOS.undent AGG tries to return a const reference as a non-const reference, which is rejected by clang 3.1 but accepted by gcc diff --git a/Library/Formula/libmonome.rb b/Library/Formula/libmonome.rb index de6a03011..390b5ea9d 100644 --- a/Library/Formula/libmonome.rb +++ b/Library/Formula/libmonome.rb @@ -10,7 +10,6 @@ class Libmonome < Formula depends_on 'liblo' fails_with :clang do - build 425 cause 'waf fails to find g++ when compiling with clang' end diff --git a/Library/Formula/lilypond.rb b/Library/Formula/lilypond.rb index 799580e2a..7d102ec4d 100644 --- a/Library/Formula/lilypond.rb +++ b/Library/Formula/lilypond.rb @@ -40,7 +40,6 @@ class Lilypond < Formula end fails_with :clang do - build 425 cause 'Strict C99 compliance error in a pointer conversion.' end diff --git a/Library/Formula/ncmpcpp.rb b/Library/Formula/ncmpcpp.rb index df6004d5e..5249b68d0 100644 --- a/Library/Formula/ncmpcpp.rb +++ b/Library/Formula/ncmpcpp.rb @@ -11,7 +11,6 @@ class Ncmpcpp < Formula depends_on 'fftw' if build.include? "visualizer" fails_with :clang do - build 425 cause "'itsTempString' is a private member of 'NCurses::basic_buffer<char>'" end diff --git a/Library/Formula/notmuch.rb b/Library/Formula/notmuch.rb index 5ab24c312..a667ff84a 100644 --- a/Library/Formula/notmuch.rb +++ b/Library/Formula/notmuch.rb @@ -28,7 +28,6 @@ class Notmuch < Formula depends_on 'gmime' fails_with :clang do - build 425 cause "./lib/notmuch-private.h:478:8: error: visibility does not match previous declaration" end diff --git a/Library/Formula/simgrid.rb b/Library/Formula/simgrid.rb index 0e86470a6..8d3dd2298 100644 --- a/Library/Formula/simgrid.rb +++ b/Library/Formula/simgrid.rb @@ -10,7 +10,6 @@ class Simgrid < Formula depends_on 'graphviz' fails_with :clang do - build 425 cause "Undefined symbols for architecture x86_64" end diff --git a/Library/Formula/tbb.rb b/Library/Formula/tbb.rb index 089052b58..254fefab8 100644 --- a/Library/Formula/tbb.rb +++ b/Library/Formula/tbb.rb @@ -7,7 +7,6 @@ class Tbb < Formula version '4.1u2' fails_with :clang do - build 425 cause "Undefined symbols for architecture x86_64: vtable for tbb::tbb_exception" end diff --git a/Library/Formula/yap.rb b/Library/Formula/yap.rb index da127ff4f..3a722c0d3 100644 --- a/Library/Formula/yap.rb +++ b/Library/Formula/yap.rb @@ -14,7 +14,6 @@ class Yap < Formula depends_on 'readline' fails_with :clang do - build 425 cause "Undefined symbols linking for architecture x86_64" end diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 6d22c8f1f..8d7d553ec 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -114,11 +114,7 @@ def install f end end - if f.fails_with? ENV.compiler - cs = CompilerSelector.new f - cs.select_compiler - cs.advise - end + CompilerSelector.new(f).select_compiler if f.fails_with? ENV.compiler f.brew do if ARGV.flag? '--git' diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index ae3d7590e..f9ed8bcde 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -68,6 +68,7 @@ class CompilerFailure def initialize compiler, &block @compiler = compiler instance_eval(&block) if block_given? + @build ||= 9999 end def build val=nil @@ -100,8 +101,7 @@ class CompilerSelector # the failing build is >= the currently installed version of foo. @compilers = @compilers.reject do |cc| failure = @f.fails_with? cc - next unless failure - failure.build >= cc.build or not ARGV.homebrew_developer? + failure && failure.build >= cc.build end return if @compilers.empty? or @compilers.include? ENV.compiler @@ -126,37 +126,4 @@ class CompilerSelector end end end - - def advise - failure = @f.fails_with? @old_compiler - return unless failure - - # If we're still using the original ENV.compiler, then the formula did not - # declare a specific failing build, so we continue and print some advice. - # Otherwise, tell the user that we're switching compilers. - if @old_compiler == ENV.compiler - cc = Compiler.new(ENV.compiler) - subject = "#{@f.name}-#{@f.version}: builds with #{NAMES[cc.name]}-#{cc.build}-#{MACOS_VERSION}" - warning = "Using #{NAMES[cc.name]}, but this formula is reported to fail with #{NAMES[cc.name]}." - warning += "\n\n#{failure.cause.strip}\n" unless failure.cause.nil? - warning += <<-EOS.undent - - We are continuing anyway so if the build succeeds, please open a ticket with - the subject - - #{subject} - - so that we can update the formula accordingly. Thanks! - EOS - - viable = @compilers.reject { |c| @f.fails_with? c } - unless viable.empty? - warning += "\nIf it fails you can use " - options = viable.map { |c| "--use-#{c.name}" } - warning += "#{options*' or '} to try a different compiler." - end - - opoo warning - end - end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 2186b4a74..9234b45df 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -200,10 +200,8 @@ class Formula def fails_with? cc return false if self.class.cc_failures.nil? cc = Compiler.new(cc) unless cc.is_a? Compiler - return self.class.cc_failures.find do |failure| - next unless failure.compiler == cc.name - failure.build.zero? or \ - (failure.build >= cc.build or not ARGV.homebrew_developer?) + self.class.cc_failures.find do |failure| + failure.compiler == cc.name && failure.build >= cc.build end end diff --git a/Library/Homebrew/test/test_compilers.rb b/Library/Homebrew/test/test_compilers.rb index 19eb69434..a30311611 100644 --- a/Library/Homebrew/test/test_compilers.rb +++ b/Library/Homebrew/test/test_compilers.rb @@ -94,9 +94,9 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler - assert_equal case MacOS.clang_build_version - when 0..210 then :gcc - else :clang + assert_equal case MacOS.gcc_42_build_version + when nil then :llvm + else :gcc end, ENV.compiler end @@ -110,6 +110,6 @@ class CompilerTests < Test::Unit::TestCase cs.select_compiler - assert_equal MacOS.default_compiler, ENV.compiler + assert_not_equal :clang, ENV.compiler end end |
