homebrew-core/Formula/haproxy.rb

71 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.5.tar.gz"
sha256 "7924539530bbf555829c7f5886be0b7fcf8d9c8ffe0867b7010beb670abfbe4b"
livecheck do
url :homepage
regex(/href=.*?haproxy[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "d4b59da8c2557952c2742dcf571d5b18832b97d45644ca18a1de43a4dc9a39e3"
sha256 cellar: :any, big_sur: "de993b7d42126e8a742db201f46d3e23f7fcafa0232fb937529be6d03eee5de5"
sha256 cellar: :any, catalina: "4491c38810c4f7cd7449ca7a92d9693f25661e2a8844cd01c163a0f9b20a7e7c"
sha256 cellar: :any, mojave: "335883cef855ce243567940bcffffb67bb57e938e62c7f38c232661f67b8aeec"
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