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