# Template file for 'haproxy'
pkgname=haproxy
# XXX: the version should be a LTS release
version=3.2.19
revision=1
build_style=gnu-makefile
make_build_args="TARGET=linux-${XBPS_TARGET_LIBC} cmd_LD=\${CC} EXTRA=admin/halog/halog
 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_ZLIB=1 USE_OPENSSL=1 USE_LIBCRYPT=1 USE_GETADDRINFO=1
 USE_LUA=1 USE_PROMEX=1 USE_NS=1"
make_install_args="EXTRA=admin/halog/halog SBINDIR=${DESTDIR}/usr/bin
 DOCDIR=${DESTDIR}/usr/share/doc/${pkgname}"
hostmakedepends="lua54-devel"
makedepends="openssl-devel lua54-devel pcre2-devel"
checkdepends="curl varnish"
short_desc="Reliable, high performance TCP/HTTP load balancer"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://www.haproxy.org"
changelog="https://www.haproxy.org/download/${version%.*}/src/CHANGELOG"
distfiles="https://www.haproxy.org/download/${version%.*}/src/haproxy-${version}.tar.gz"
checksum=b08ebbd57f575012e4a5eb5b772721531fbacf6913ffd334f0281736a1ad78b6

if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
	makedepends+=" libxcrypt-devel"
fi

haproxy_homedir="/var/lib/${pkgname}"
make_dirs="$haproxy_homedir 0750 ${pkgname} ${pkgname}"
conf_files="/etc/${pkgname}/${pkgname}.cfg"
system_accounts="haproxy"

do_check() {
	export VTEST_PROGRAM=/usr/bin/varnishtest
	make reg-tests || : 4 test failed on musl
}

post_install() {
	vinstall ${FILESDIR}/${pkgname}.cfg 644 etc/${pkgname}
	vsv ${pkgname}
}
