require 'formula' class Varnish < Formula homepage 'http://www.varnish-cache.org/' url 'https://repo.varnish-cache.org/source/varnish-4.0.0.tar.gz' sha1 '6ad4fcf42a505a748ae993cb6ed579159e023633' bottle do sha1 "190bba2cf0e521b489cbd64cc698ba769b18cccd" => :mavericks sha1 "fd12d468c2328179bd402f1592b65ef69d6f1baa" => :mountain_lion sha1 "0e9717e705541a34906947eb7e49ab800204e2ff" => :lion end depends_on 'pkg-config' => :build depends_on 'pcre' resource "docutils" do url "https://pypi.python.org/packages/source/d/docutils/docutils-0.11.tar.gz" sha1 "3894ebcbcbf8aa54ce7c3d2c8f05460544912d67" end def install ENV.prepend_create_path "PYTHONPATH", buildpath+"lib/python2.7/site-packages" resource("docutils").stage do system "python", "setup.py", "install", "--prefix=#{buildpath}" end system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--localstatedir=#{var}", "--with-rst2man=#{buildpath}/bin/rst2man.py", "--with-rst2html=#{buildpath}/bin/rst2html.py" system "make install" (var+'varnish').mkpath end test do system "#{opt_sbin}/varnishd", "-V" end def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_sbin}/varnishd -n #{var}/varnish -f #{etc}/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:80 KeepAlive RunAtLoad WorkingDirectory #{HOMEBREW_PREFIX} StandardErrorPath #{var}/varnish/varnish.log StandardOutPath #{var}/varnish/varnish.log EOS end end