74 lines
2.2 KiB
Ruby
74 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/1.8/src/haproxy-1.8.13.tar.gz"
|
|
sha256 "2bf5dafbb5f1530c0e67ab63666565de948591f8e0ee2a1d3c84c45e738220f1"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "b5c9facf99db1ad41c9cfb2f4450d21993cc665fa5ec47492b6c6a28cd55f1a4" => :mojave
|
|
sha256 "de452f76eedcd1b352fe0093999d935f0f455769eb34db2804c68f40a3361c9a" => :high_sierra
|
|
sha256 "36f30a9e68f0cab58cc90d04534c60f218266244f6537c1393d15bb12c28426d" => :sierra
|
|
sha256 "e11e3a148e59529f0fe5c77d992ecfdedbaf9342aee5fae302ada9fa95231443" => :el_capitan
|
|
end
|
|
|
|
depends_on "openssl"
|
|
depends_on "pcre"
|
|
depends_on "lua" => :optional
|
|
|
|
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
|
|
]
|
|
|
|
if build.with?("lua")
|
|
lua = Formula["lua"]
|
|
args << "USE_LUA=1"
|
|
args << "LUA_LIB=#{lua.opt_lib}"
|
|
args << "LUA_INC=#{lua.opt_include}/lua"
|
|
args << "LUA_LD_FLAGS=-L#{lua.opt_lib}"
|
|
end
|
|
|
|
# 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
|