aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-03-18 13:10:03 -0500
committerJack Nagel2013-03-18 13:29:33 -0500
commit456386c9b1cbe599bcc42c96099321ea13afc544 (patch)
treebbc3150b5f631eaa965531ed97c8d08044547f66 /Library
parent581e766809c7c2064bfb81794e834be65aecb54a (diff)
downloadbrew-456386c9b1cbe599bcc42c96099321ea13afc544.tar.bz2
Reduce footprint of fails_with_llvm compat code
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/compat/compatibility.rb59
1 files changed, 5 insertions, 54 deletions
diff --git a/Library/Homebrew/compat/compatibility.rb b/Library/Homebrew/compat/compatibility.rb
index 28090dc2a..51969330f 100644
--- a/Library/Homebrew/compat/compatibility.rb
+++ b/Library/Homebrew/compat/compatibility.rb
@@ -76,18 +76,18 @@ class Formula
# up in the DSL section.
def fails_with_llvm msg=nil, data=nil
opoo "Calling fails_with_llvm in the install method is deprecated"
- puts "Use the fails_with DSL instead."
- FailsWithLLVM.new(msg, data).handle_failure
+ puts "Use the fails_with DSL instead"
end
def fails_with_llvm?
fails_with? :llvm
end
- def self.fails_with_llvm msg=nil, data=nil
- fails_with_llvm_reason = FailsWithLLVM.new(msg, data)
+ def self.fails_with_llvm msg=nil, data={}
+ case msg when Hash then data = msg end
+ failure = CompilerFailure.new(:llvm) { build(data.delete(:build).to_i) }
@cc_failures ||= Set.new
- @cc_failures << fails_with_llvm_reason
+ @cc_failures << failure
end
def std_cmake_parameters
@@ -133,55 +133,6 @@ module HomebrewEnvExtension extend self
end
end
-class FailsWithLLVM
- attr_reader :compiler, :build, :cause
-
- def initialize msg=nil, data=nil
- if msg.nil? or msg.kind_of? Hash
- @cause = "(No specific reason was given)"
- data = msg
- else
- @cause = msg
- end
- @build = (data.delete :build rescue nil).to_i
- @compiler = :llvm
- end
-
- def handle_failure
- return unless ENV.compiler == :llvm
-
- # version 2336 is the latest version as of Xcode 4.2, so it is the
- # latest version we have tested against so we will switch to GCC and
- # bump this integer when Xcode 4.3 is released. TODO do that!
- if build.to_i >= 2336
- if MacOS::Xcode.version < "4.2"
- opoo "Formula will not build with LLVM, using GCC"
- ENV.gcc
- else
- opoo "Formula will not build with LLVM, trying Clang"
- ENV.clang
- end
- return
- end
- opoo "Building with LLVM, but this formula is reported to not work with LLVM:"
- puts
- puts cause
- puts
- puts <<-EOS.undent
- We are continuing anyway so if the build succeeds, please open a ticket with
- the following information: #{MacOS.llvm_build_version}-#{MACOS_VERSION}. So
- that we can update the formula accordingly. Thanks!
- EOS
- puts
- if MacOS::Xcode.version < "4.2"
- puts "If it doesn't work you can: brew install --use-gcc"
- else
- puts "If it doesn't work you can try: brew install --use-clang"
- end
- puts
- end
-end
-
# TODO eventually some of these should print deprecation warnings
module MacOS extend self
def xcode_folder