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.8.tar.xz" sha256 "78cdb324d93341d36d09d5f791060f6e8aaa5ff3179f7c949cd910d023a86210" bottle do sha256 "ac56304ff9094551025952da4883eb7ea48ec4be7eb6cd6baa1033ad5b464587" => :mojave sha256 "13c5b1b1ad8f2af56eadeeeed20054a9bf85357c00be6815cf38caab76f66ef7" => :high_sierra sha256 "c4cd78e4b38786fc7fa42ba2276e1bf9f09b01face3f4532042bec2d856c3b21" => :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" 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