homebrew-core/Formula/haproxy.rb
2017-12-05 05:56:25 -08:00

63 lines
1.8 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.1.tar.gz"
sha256 "02ded32524353da2f3e29e952e656cc2f6b5f0189400831401f9de70a6560b30"
bottle do
cellar :any
sha256 "9fe6a37388a765d1a7b03c0a907cacdc4d9462d2911c297537ca716bdb325ef8" => :high_sierra
sha256 "b8e5e7df183d99e952459ce71f6fea7109b9dc3907e72f1f07629c25e7e3fb96" => :sierra
sha256 "63a701b27e48e684f1dfe6e240acefc586c10a338bf99e6987234fb8e899b016" => :el_capitan
end
depends_on "openssl"
depends_on "pcre"
def install
args = %w[
TARGET=generic
USE_KQUEUE=1
USE_POLL=1
USE_PCRE=1
USE_OPENSSL=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