homebrew-core/Formula/varnish.rb
2014-03-07 07:08:52 -08:00

54 lines
1.6 KiB
Ruby

require 'formula'
class Varnish < Formula
homepage 'http://www.varnish-cache.org/'
url 'http://repo.varnish-cache.org/source/varnish-3.0.5.tar.gz'
sha1 '2f3eae44cc44d263fe9513b856f49707a64cc840'
depends_on 'pkg-config' => :build
depends_on 'pcre'
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--localstatedir=#{var}"
system "make install"
(var+'varnish').mkpath
end
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/varnishd</string>
<string>-n</string>
<string>#{var}/varnish</string>
<string>-f</string>
<string>#{etc}/varnish/default.vcl</string>
<string>-s</string>
<string>malloc,1G</string>
<string>-T</string>
<string>127.0.0.1:2000</string>
<string>-a</string>
<string>0.0.0.0:80</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>StandardErrorPath</key>
<string>#{var}/varnish/varnish.log</string>
<key>StandardOutPath</key>
<string>#{var}/varnish/varnish.log</string>
</dict>
</plist>
EOS
end
end