102 lines
2.7 KiB
Ruby
102 lines
2.7 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.14.tar.xz"
|
|
sha256 "f1097daa6434897c159bc100978b51347c0339041610845d0afa128151729ffc"
|
|
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: "422162362d423a8cb0ab116731da03eedad5991cb36c64304a3462971d2f90bf"
|
|
sha256 big_sur: "8e0aaa487fd37fa2da664d23bfd1a199f3b774908f1b35ec9efc842ff4ac3574"
|
|
sha256 catalina: "858bb9791ae9e3a6d6bb7fadb46ac8fa6cfc16f946a1d6cbe6ecce4cdc8077b5"
|
|
sha256 mojave: "1c726f0f574c9b5a0d74afa54b4436d0f97486ad7bddb426fad5235fdda16396"
|
|
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
|