2010-02-05 00:45:58 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Varnish < Formula
|
2010-12-06 14:54:57 +00:00
|
|
|
homepage 'http://www.varnish-cache.org/'
|
2012-08-31 17:17:31 +00:00
|
|
|
url 'http://repo.varnish-cache.org/source/varnish-3.0.3.tar.gz'
|
|
|
|
sha1 '6e1535caa30c3f61af00160c59d318e470cd6f57'
|
2010-02-05 00:45:58 +00:00
|
|
|
|
2010-09-19 17:21:57 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2010-05-18 22:15:00 +00:00
|
|
|
depends_on 'pcre'
|
2010-05-11 18:33:50 +00:00
|
|
|
|
2010-02-05 00:45:58 +00:00
|
|
|
def install
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--localstatedir=#{var}"
|
|
|
|
system "make install"
|
|
|
|
(var+'varnish').mkpath
|
|
|
|
end
|
2012-09-18 21:57:03 +00:00
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
To launch on startup (port > 1024):
|
|
|
|
* if this is your first install:
|
|
|
|
mkdir -p ~/Library/LaunchAgents
|
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
|
|
|
|
* if this is an upgrade and you already have the #{plist_path.basename} loaded:
|
|
|
|
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
|
|
|
|
To launch on startup (port < 1024):
|
|
|
|
* if this is your first install:
|
|
|
|
sudo cp #{plist_path} /Library/LaunchAgents/
|
|
|
|
sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
|
|
|
|
* if this is an upgrade and you already have the #{plist_path.basename} loaded:
|
|
|
|
sudo launchctl unload -w /Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
sudo cp #{plist_path} /Library/LaunchAgents/
|
|
|
|
sudo launchctl load -w /Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def startup_plist; <<-EOPLIST.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>#{HOMEBREW_PREFIX}/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>
|
|
|
|
EOPLIST
|
|
|
|
end
|
2010-08-12 14:30:13 +00:00
|
|
|
end
|