103 lines
2.8 KiB
Ruby
103 lines
2.8 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.16.tar.xz"
|
|
sha256 "7e00e891757c1c02dae546c9898f440c6031b684d8c243d6edab529076e3ba63"
|
|
license "GPL-2.0"
|
|
|
|
livecheck do
|
|
url "http://www.squid-cache.org/Versions/v4/"
|
|
regex(/href=.*?squid[._-]v?(\d+(?:\.\d+)+)-RELEASENOTES\.html/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "39b8e09ec1ac83ebd6e34df5fcdada2fb355e56b45db9fa0797d0653520d44e5"
|
|
sha256 big_sur: "0247642889ffc549fc3e6a5476497c3cff9d7a6e4a847b818e877f5cd5cf61b3"
|
|
sha256 catalina: "21b441ecf9b2bc62f5f12e30d5da8aff30a85745467a2642698d668263ef5716"
|
|
sha256 mojave: "e36f6a5faa012cda8c7917e7943c5e53764915b1d9c277d920205cc3a5261b4e"
|
|
sha256 x86_64_linux: "d6e537e7e2ab13d00b8b5f16d3c0a88dbefb254cf5d9487cc52fe03d9e9fba3d"
|
|
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
|