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.14.tar.gz" sha256 "b17e402578be85e58af7a3eac99b1f675953bea9f67af2e964cf8bdbd1bd3fdf" bottle do cellar :any sha256 "c83ee8dacc8bd8876ac0c236b9119b8ddda1b58e4a144403f64ea2e6f6257ccd" => :mojave sha256 "df7f46bcdb36f484dfdf6b2f853c65a3dea86e04fd2dd0618487f410de3289ef" => :high_sierra sha256 "2c61d13f11f969466e169e68556c08612c7ee39205c970c1e52f4fbd9dac4733" => :sierra 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 Label #{plist_name} KeepAlive ProgramArguments #{opt_bin}/haproxy -f #{etc}/haproxy.cfg StandardErrorPath #{var}/log/haproxy.log StandardOutPath #{var}/log/haproxy.log EOS end test do system bin/"haproxy", "-v" end end