diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index dfa70438c62a..3ba29563e388 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -30,6 +30,7 @@ def initialize name end end + # the base class variety of formula, you don't get a prefix, so it's not # useful. See the derived classes for fun and games. class AbstractFormula @@ -72,6 +73,13 @@ def include; prefix+'include' end # tell the user about any caveats regarding this package def caveats; nil end # patches are automatically applied after extracting the tarball + # return an array of strings, or if you need a patch level other than -p0 + # return a Hash eg. + # { + # :p0 => ['http://foo.com/patch1', 'http://foo.com/patch2'], + # :p1 => 'http://bar.com/patch2', + # :p2 => ['http://moo.com/patch5', 'http://moo.com/patch6'] + # } def patches; [] end # reimplement and specify dependencies def deps; end @@ -179,14 +187,33 @@ def verify_download_integrity fn end def patch - unless patches.empty? - ohai "Patching" + return if patches.empty? + ohai "Patching" + if patches.kind_of? Hash + patch_args=[] + curl_args=[] + n=0 + patches.each do |arg, urls| + urls.each do |url| + dst='%03d-homebrew.patch' % n+=1 + curl_args<