Move 'fails_with_llvm' into formula DSL.
Existing method moved to compatibility layer.
This commit is contained in:
parent
007b9e72d5
commit
145bafbc4e
@ -70,4 +70,11 @@ class Formula
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
# This used to be called in "def install", but should now be used
|
||||
# up in the DSL section.
|
||||
def fails_with_llvm msg=nil, data=nil
|
||||
handle_llvm_failure FailsWithLLVM.new(msg, data)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ end
|
||||
|
||||
|
||||
# Used to annotate formulae that duplicate OS X provided software
|
||||
# :provided_by_osx
|
||||
# or cause conflicts when linked in.
|
||||
class KegOnlyReason
|
||||
attr_reader :reason, :explanation
|
||||
|
||||
@ -71,6 +71,25 @@ EOS
|
||||
end
|
||||
|
||||
|
||||
# Used to annotate formulae that won't build correctly with LLVM.
|
||||
class FailsWithLLVM
|
||||
attr_reader :msg, :data, :build
|
||||
|
||||
def initialize msg=nil, data=nil
|
||||
@msg = msg || "(No specific reason was given)"
|
||||
@data = data
|
||||
@build = data.delete :build rescue nil
|
||||
end
|
||||
|
||||
def reason
|
||||
s = @msg
|
||||
s += "Tested with LLVM build #{@build}" unless @build == nil
|
||||
s += "\n"
|
||||
return s
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Derive and define at least @url, see Library/Formula for examples
|
||||
class Formula
|
||||
include FileUtils
|
||||
@ -198,6 +217,10 @@ class Formula
|
||||
self.class.keg_only_reason || false
|
||||
end
|
||||
|
||||
def fails_with_llvm?
|
||||
self.class.fails_with_llvm_reason || false
|
||||
end
|
||||
|
||||
# sometimes the clean process breaks things
|
||||
# skip cleaning paths in a formula with a class method like this:
|
||||
# skip_clean [bin+"foo", lib+"bar"]
|
||||
@ -213,6 +236,8 @@ class Formula
|
||||
validate_variable :name
|
||||
validate_variable :version
|
||||
|
||||
handle_llvm_failure(fails_with_llvm?) if fails_with_llvm?
|
||||
|
||||
stage do
|
||||
begin
|
||||
patch
|
||||
@ -264,28 +289,24 @@ class Formula
|
||||
"-DCMAKE_INSTALL_PREFIX='#{prefix}' -DCMAKE_BUILD_TYPE=None -Wno-dev"
|
||||
end
|
||||
|
||||
def fails_with_llvm msg="", data=nil
|
||||
def handle_llvm_failure llvm
|
||||
unless (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
|
||||
ENV.gcc_4_2 if default_cc =~ /llvm/
|
||||
return
|
||||
end
|
||||
|
||||
build = data.delete :build rescue nil
|
||||
msg = "(No specific reason was given)" if msg.empty?
|
||||
|
||||
opoo "LLVM was requested, but this formula is reported as not working with LLVM:"
|
||||
puts msg
|
||||
puts "Tested with LLVM build #{build}" unless build == nil
|
||||
puts
|
||||
puts llvm.reason
|
||||
|
||||
if ARGV.force?
|
||||
puts "Continuing anyway. If this works, let us know so we can update the\n"+
|
||||
"formula to remove the warning."
|
||||
puts "Continuing anyway.\n" +
|
||||
"If this works, let us know so we can update the formula to remove the warning."
|
||||
else
|
||||
puts "Continuing with GCC 4.2 instead.\n"+
|
||||
"(Use `brew install --force #{name}` to force use of LLVM.)"
|
||||
ENV.gcc_4_2
|
||||
end
|
||||
puts
|
||||
end
|
||||
|
||||
def self.class_s name
|
||||
@ -604,7 +625,7 @@ EOF
|
||||
end
|
||||
|
||||
attr_rw :version, :homepage, :specs, :deps, :external_deps
|
||||
attr_rw :keg_only_reason, :skip_clean_all
|
||||
attr_rw :keg_only_reason, :fails_with_llvm_reason, :skip_clean_all
|
||||
attr_rw(*CHECKSUM_TYPES)
|
||||
|
||||
def head val=nil, specs=nil
|
||||
@ -679,6 +700,10 @@ EOF
|
||||
def keg_only reason, explanation=nil
|
||||
@keg_only_reason = KegOnlyReason.new(reason, explanation.to_s.chomp)
|
||||
end
|
||||
|
||||
def fails_with_llvm msg=nil, data=nil
|
||||
@fails_with_llvm_reason = FailsWithLLVM.new(msg, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user