require 'formula' class Varnish < Formula homepage 'http://www.varnish-cache.org/' url 'https://repo.varnish-cache.org/source/varnish-4.0.2.tar.gz' sha1 'af9a87a1e8536e895c1ebf0e09921a583dafe29a' bottle do sha1 "8a38f94d751785e3c3674dd2dc154e259bed7c6e" => :mavericks sha1 "e338318022d8bae009beb6b5883cef3cc175b945" => :mountain_lion sha1 "9e04a4d50ebacfd26ab6b82702bf38f1c912a2bc" => :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