# HAProxy - The Reliable, High Performance TCP/HTTP Load Balancer
# http://haproxy.1wt.eu/

[buildout]
extends =
  ../lua/buildout.cfg
  ../openssl/buildout.cfg
  ../pcre/buildout.cfg
  ../zlib/buildout.cfg

parts = haproxy

[haproxy]
recipe = slapos.recipe.cmmi
shared = true
url = https://www.haproxy.org/download/2.6/src/haproxy-2.6.16.tar.gz
md5sum = b01e605cdaf2742fcedf214a61e187b4
configure-command = true
# for Linux kernel 2.6.28 and above, we use "linux-glibc" as the TARGET,
# otherwise use "generic".
# For ARCH value, x86_64 and i[3456]86 are supported.
# CPU is generic, and not native, as in SlapOS software released are
# distributed in binary form, which may lead to incompatibility of such
# compilation optimisation across various CPUs
TARGET="$(uname -sr 2>/dev/null|grep -Eq '^Linux (2\.6\.2[89]|2\.6\.[3-9]|[3-9])' && echo linux-glibc || echo generic)"
CPU=generic
ARCH="$(uname -m 2>/dev/null|grep -E '^(x86_64|i[3456]86)$')"

# By default haproxy is build w/o QUIC support
SSL_INC=${openssl:location}/include
SSL_LIB=${openssl:location}/lib
SSL_ADDLIB=-Wl,-rpath=${openssl:location}/lib
QUIC=

make-options =
  TARGET=${:TARGET}
  CPU=${:CPU}
  ARCH=${:ARCH}
  PREFIX=@@LOCATION@@
  USE_DL=1
  USE_LUA=1
  LUA_INC=${lua:location}/include
  LUA_LIB=${lua:location}/lib
  USE_OPENSSL=1
  SSL_INC=${:SSL_INC}
  SSL_LIB=${:SSL_LIB}
  ${:QUIC}
  USE_PCRE=1
  USE_ZLIB=1
  USE_PROMEX=1
  ZLIB_INC=${zlib:location}/include
  ZLIB_LIB=${zlib:location}/lib
  ADDLIB="${:SSL_ADDLIB} -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${zlib:location}/lib"
environment =
  PATH=${pcre:location}/bin:%(PATH)s

[haproxy-quic]
<= haproxy

SSL_INC=${openssl-quictls:location}/include
SSL_LIB=${openssl-quictls:location}/lib
SSL_ADDLIB=-Wl,-rpath=${openssl-quictls:location}/lib
QUIC=USE_QUIC=1


