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.9.tar.xz" sha256 "1cb1838c6683b0568a3a4050f4ea2fc1eaa5cbba6bdf7d57f7258c7cd7b41fa1" bottle do sha256 "eb88a0963a5793de409259e8cb913b9e24bd3d3b536112142426ad1fcef7428f" => :catalina sha256 "ee3a1e05ca15a5505baef58f33ad86d109cf104edeec514de69310a2532eafeb" => :mojave sha256 "6e4b5b7033c57b70fb6f9de126bc5526c4bad7a153151bf80569ec31d77ffc24" => :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 KeepAlive Label #{plist_name} ProgramArguments #{opt_sbin}/squid -N -d 1 RunAtLoad WorkingDirectory #{var} 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