homebrew-core/Formula/haproxy.rb

72 lines
2.1 KiB
Ruby

class Haproxy < Formula
desc "Reliable, high performance TCP/HTTP load balancer"
homepage "https://www.haproxy.org/"
url "https://www.haproxy.org/download/2.3/src/haproxy-2.3.1.tar.gz"
sha256 "8d3bf1252a5b60b21e9885c8d0d6d89e932d320c2977a6522aed6df81eefca4b"
livecheck do
url :homepage
regex(/href=.*?haproxy[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "0a47d416180f5b5f4608ded6a65dabbcd798f392789a013eb6a16c61ac4c4033" => :big_sur
sha256 "9ac2bae9179b01b4f12451193c18d562653cd744d61f73b3aea1abb7831e3ee7" => :catalina
sha256 "a6b52098b82ab2d657750302b24f7e46b07f52b73b775a7c0be0e85dab4a94fc" => :mojave
sha256 "193149c3068b485f00006c562fa0a0305d77e328f59f94a50c28a56562652119" => :high_sierra
end
depends_on "openssl@1.1"
depends_on "pcre"
def install
args = %w[
TARGET=generic
USE_KQUEUE=1
USE_POLL=1
USE_PCRE=1
USE_OPENSSL=1
USE_THREAD=1
USE_ZLIB=1
ADDLIB=-lcrypto
]
# We build generic since the Makefile.osx doesn't appear to work
system "make", "CC=#{ENV.cc}", "CFLAGS=#{ENV.cflags}", "LDFLAGS=#{ENV.ldflags}", *args
man1.install "doc/haproxy.1"
bin.install "haproxy"
end
plist_options manual: "haproxy -f #{HOMEBREW_PREFIX}/etc/haproxy.cfg"
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>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/haproxy</string>
<string>-f</string>
<string>#{etc}/haproxy.cfg</string>
</array>
<key>StandardErrorPath</key>
<string>#{var}/log/haproxy.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/haproxy.log</string>
</dict>
</plist>
EOS
end
test do
system bin/"haproxy", "-v"
end
end