HomeBrew Formula : Download two URL packages

homebrew

Solution

You can use a "subformula". You would stick this class definition in the Nginx formula file:

class NginxUploadModule < Formula
  url 'http://www.grid.net.ru/nginx/download/nginx_upload_module-2.2.0.tar.gz'
  md5 '2681a6167551830a23336fa41bc539a1'
end

and then in the `install` method of the Nginx formula, you would do something like

NginxUploadModule.new.brew do
  (buildpath/'where/you/want/the/files').install Dir['*']
end

adjusting the path accordingly.

There are a number of examples of this in the core Homebrew repository; grepping for "new.brew" should give you quite a few.

Problem

I need to get nginx compiled with the file upload package. The module doesn't come as part of the default nginx brew formula. It appears brew formulas are based off one download pkg, see below ``` class Nginx < Formula homepage 'http://nginx.org/' url 'http://nginx.org/download/nginx-1.2.0.tar.gz' md5 'a02ef93d65a7031a1ea3256ad5eba626' devel do url 'http://nginx.org/download/nginx-1.3.0.tar.gz' md5 'b02e171c4a088aa9a5ab387943ce08eb' end ``` How can I download the bellow in a subfolder, say nginx/contrib ? ``` url 'http://www.grid.net.ru/nginx/download/nginx_upload_module-2.2.0.tar.gz' md5 '2681a6167551830a23336fa41bc539a1' ```

Original source