homebrew-core/Formula/polipo.rb

86 lines
2.7 KiB
Ruby

class Polipo < Formula
desc "Web caching proxy"
homepage "https://www.irif.univ-paris-diderot.fr/~jch/software/polipo/"
url "https://www.irif.univ-paris-diderot.fr/~jch/software/files/polipo/polipo-1.1.1.tar.gz"
sha256 "a259750793ab79c491d05fcee5a917faf7d9030fb5d15e05b3704e9c9e4ee015"
license "MIT"
head "https://github.com/jech/polipo.git"
bottle do
rebuild 2
sha256 arm64_big_sur: "9e881c585217cd8354877025690bf3f35c2e036ef6c3b46dd1005c505b4e3984"
sha256 big_sur: "3e847b380dc3c582beb070ff92b03182d4d50bc38bc74c210365111b8cec04fa"
sha256 catalina: "c1806514cf77c3b9738131299f04a2c051617a3a44cd1aa4440ecd16103c5bad"
sha256 mojave: "2653a1ffd719d82318a04fd94b8a2573714c03e974b43ae7b3df6ad4b9e410f3"
sha256 high_sierra: "6fe78288ca28698ac07fd96d99fbbf311a6b410eb7150dfac5388564b76d4195"
sha256 sierra: "7a943f9e9952d78c692d5ec155b407319181a6a66ee1367801f77da8f7bb8459"
end
# https://github.com/jech/polipo/commit/4d42ca1b5849518762d110f34b6ce2e03d6df9ec
deprecate! date: "2016-11-06", because: :unsupported
def install
cache_root = (var + "cache/polipo")
cache_root.mkpath
args = %W[
PREFIX=#{prefix}
LOCAL_ROOT=#{pkgshare}/www
DISK_CACHE_ROOT=#{cache_root}
MANDIR=#{man}
INFODIR=#{info}
PLATFORM_DEFINES=-DHAVE_IPv6
]
system "make", "all", *args
system "make", "install", *args
end
plist_options manual: "polipo"
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>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/polipo</string>
</array>
<!-- Set `ulimit -n 65536`. The default macOS limit is 256, that's
not enough for Polipo (displays 'too many files open' errors).
It seems like you have no reason to lower this limit
(and unlikely will want to raise it). -->
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>65536</integer>
</dict>
</dict>
</plist>
EOS
end
test do
pid = fork do
exec "#{bin}/polipo"
end
sleep 2
begin
output = shell_output("curl -s http://localhost:8123")
assert_match "<title>Welcome to Polipo</title>", output, "Polipo webserver did not start!"
ensure
Process.kill("SIGINT", pid)
Process.wait(pid)
end
end
end