Move llvm method to FailsWithLLVM

This commit is contained in:
Adam Vandenberg 2012-03-05 21:08:08 -08:00
parent fca0a66649
commit 962f4fa9ef
2 changed files with 35 additions and 35 deletions

View File

@ -189,7 +189,7 @@ class Formula
validate_variable :name
validate_variable :version
handle_llvm_failure(fails_with_llvm?) if fails_with_llvm?
fails_with_llvm?.handle_failure if fails_with_llvm?
stage do
begin
@ -254,40 +254,6 @@ class Formula
"-DCMAKE_INSTALL_PREFIX='#{prefix}' -DCMAKE_BUILD_TYPE=None -Wno-dev"
end
def handle_llvm_failure llvm
if 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 llvm.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 llvm.reason
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
def self.class_s name
#remove invalid characters and then camelcase it
name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase } \

View File

@ -92,4 +92,38 @@ class FailsWithLLVM
s += "\n"
return s
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 reason
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