72 lines
2.1 KiB
Ruby
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/1.8/src/haproxy-1.8.4.tar.gz"
|
|
sha256 "e305b0a4e7dec08072841eef6ac6dcd1b5586b1eff09c2d51e152a912e8884a6"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "890c93949fc751be1e81cb392bf87bbfb602f161ac275206a0053748e2b6a598" => :high_sierra
|
|
sha256 "d6d4d19f2364b5f9958a7e13edfd0c445ce97797b10d759948bba07feb5afbd6" => :sierra
|
|
sha256 "35cb705f125cd7c177b7ff8355526abcc53c918e0d69dcad9daabb5697278287" => :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_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}"
|
|
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
|