homebrew-core/Formula/haproxy.rb

72 lines
2.2 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.6.tar.gz"
sha256 "6d4620e5da1d93ed75f229011216db81d5097b68bf175e309f2fab2890bba036"
license "GPL-2.0-or-later" => { with: "openvpn-openssl-exception" }
livecheck do
url :homepage
regex(/href=.*?haproxy[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "f3bbf68e687adab98d27ecd56e298572a9021d668345bdbf2b18b3638d9e4b13"
sha256 cellar: :any, big_sur: "e89b2c929d0b77f246918755f03a0cee50c82909656ba35bcfaa1cd01cef64ef"
sha256 cellar: :any, catalina: "8eb8dc549439bdad51fea54e9c4610a0904f0674a0561c3c7f51302aebc0a638"
sha256 cellar: :any, mojave: "9228c83e3799d8b683728e8a7e10b4048af1be1febbbb4c1e3431c2c08338f8f"
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