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'
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.
From https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/example-formula.rb
# Additional downloads can be defined as resources and accessed in the
# install method. Resources can also be defined inside a stable, devel, or
# head block. This mechanism replaces ad-hoc "subformula" classes.
resource "additional_files" do
url "https://example.com/additional-stuff.tar.gz"
sha1 "deadbeef7890123456789012345678901234567890"
end
# Additional downloads can be defined as resources (see above).
# The stage method will create a temporary directory and yield
# to a block.
resource("additional_files").stage { bin.install "my/extra/tool" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With