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/v3/3.5/squid-3.5.16.tar.xz" sha256 "e73d821180eed8bed230f357c680c0b19f1efa51a24725e810f2b48a2079d385" bottle do sha256 "225d224c1311ed6c2ef2e045c7cb2a6e372ac3303470baac3308bdee35fdeaa1" => :el_capitan sha256 "d9a43039f5524ea5cabd9c6873b9d5ea528e75def324d303d59cd5f3093ea228" => :yosemite sha256 "7bd77cb6b91182c23fa18b0a259eabb4b1534c865c13a3ed477193b24440747e" => :mavericks 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://squid-web-proxy-cache.1019090.n4.nabble.com/ERROR-ARP-MAC-EUI-operations-not-supported-on-this-operating-system-td4659335.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 ] if build.head? system "./bootstrap.sh" end system "./configure", *args system "make", "install" end plist_options :manual => "squid" def plist; <<-EOS.undent KeepAlive Label #{plist_name} ProgramArguments #{opt_sbin}/squid -N -d 1 RunAtLoad WorkingDirectory #{var} EOS end test do # This test should start squid and then check it runs correctly. # However currently dies under the sandbox and "Current Directory" # seems to be set hard on HOMEBREW_PREFIX/var/cache/squid. # https://github.com/Homebrew/homebrew/pull/44348#issuecomment-143477353 # If you can fix this, please submit a PR. Thank you! assert_match version.to_s, shell_output("#{sbin}/squid -v") end end