94 lines
2.4 KiB
Ruby
94 lines
2.4 KiB
Ruby
class Squid < Formula
|
|
desc "Advanced proxy caching server for HTTP, HTTPS, FTP, and Gopher"
|
|
homepage "http://www.squid-cache.org/"
|
|
url "http://www.squid-cache.org/Versions/v4/squid-4.10.tar.xz"
|
|
sha256 "98f0100afd8a42ea5f6b81eb98b0e4b36d7a54beab1c73d2f1705ab49b025f1f"
|
|
|
|
bottle do
|
|
sha256 "b317cad793854ed6b0c3933ebec75194383d5c2b47e5f868027aaa9e9decb8f9" => :catalina
|
|
sha256 "116495c487377979f407c4c77a3b904cf06539deaf4fc86d02843d16e224a1d1" => :mojave
|
|
sha256 "a920686eea11ddb1d3f7fa2ac6a3cd12900e1f5eb181a3f920673e4076f60370" => :high_sierra
|
|
end
|
|
|
|
head do
|
|
url "lp:squid", :using => :bzr
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "openssl@1.1"
|
|
|
|
def install
|
|
# https://stackoverflow.com/questions/20910109/building-squid-cache-on-os-x-mavericks
|
|
ENV.append "LDFLAGS", "-lresolv"
|
|
|
|
# For --disable-eui, see:
|
|
# http://www.squid-cache.org/mail-archive/squid-users/201304/0040.html
|
|
args = %W[
|
|
--disable-debug
|
|
--disable-dependency-tracking
|
|
--prefix=#{prefix}
|
|
--localstatedir=#{var}
|
|
--sysconfdir=#{etc}
|
|
--enable-ssl
|
|
--enable-ssl-crtd
|
|
--disable-eui
|
|
--enable-pf-transparent
|
|
--with-included-ltdl
|
|
--with-openssl
|
|
--enable-delay-pools
|
|
--enable-disk-io=yes
|
|
--enable-removal-policies=yes
|
|
--enable-storeio=yes
|
|
]
|
|
|
|
system "./bootstrap.sh" if build.head?
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
plist_options :manual => "squid"
|
|
|
|
def plist; <<~EOS
|
|
<?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>KeepAlive</key>
|
|
<true/>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_sbin}/squid</string>
|
|
<string>-N</string>
|
|
<string>-d 1</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{var}</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{sbin}/squid -v")
|
|
|
|
pid = fork do
|
|
exec "#{sbin}/squid"
|
|
end
|
|
sleep 2
|
|
|
|
begin
|
|
system "#{sbin}/squid", "-k", "check"
|
|
ensure
|
|
exec "#{sbin}/squid -k interrupt"
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|