summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2022-01-12 09:16:32 +0100
committerChristian Ruppert <idl0r@gentoo.org>2022-01-12 09:16:44 +0100
commit41fe21ef421d91ec44073aedd8bd83c8941763dd (patch)
tree480002b9fb435f447782e247bd31b28d01c8d3f2 /net-proxy/haproxy
parentx11-terms/kitty: sync live ebuild keywords (diff)
downloadgentoo-41fe21ef421d91ec44073aedd8bd83c8941763dd.tar.gz
gentoo-41fe21ef421d91ec44073aedd8bd83c8941763dd.tar.bz2
gentoo-41fe21ef421d91ec44073aedd8bd83c8941763dd.zip
net-proxy/haproxy: Bumps
Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
Diffstat (limited to 'net-proxy/haproxy')
-rw-r--r--net-proxy/haproxy/Manifest3
-rw-r--r--net-proxy/haproxy/haproxy-2.2.20.ebuild186
-rw-r--r--net-proxy/haproxy/haproxy-2.4.12.ebuild182
-rw-r--r--net-proxy/haproxy/haproxy-2.5.1.ebuild182
4 files changed, 553 insertions, 0 deletions
diff --git a/net-proxy/haproxy/Manifest b/net-proxy/haproxy/Manifest
index 75c74f7e4ab0..64d739eaa571 100644
--- a/net-proxy/haproxy/Manifest
+++ b/net-proxy/haproxy/Manifest
@@ -3,6 +3,9 @@ DIST haproxy-2.0.26.tar.gz 2713209 BLAKE2B 9d33cc57d9b1761844fda05981ccddc4de682
DIST haproxy-2.2.17.tar.gz 2933836 BLAKE2B 750d2c5048f994442d13c05ce6624731d296462951ee2e86110467d517a6708b498e98260a3f0770e110dc5c2cb2bdd746fb76f23ba7cebc1642b0b9c8124a67 SHA512 174197e1e0915a6ae6062b9a070f16102ac7f3429f991f36cdb2e2cce587bd26059bd1dc71a368f904bcdecd292ab5926715160400ae96d498d902aac356864f
DIST haproxy-2.2.18.tar.gz 2940789 BLAKE2B e932c53b67052a2696a00cc9e0ee79ca2c7bdc5ba51bbb6c5bf3e7d5ef8bcf3c4e0f6524d40bcbc3342f86c3ddec6e27a0a2ad329ee5ad510260dc2f24b3913b SHA512 255b5d5984578a8d018b80e213ff2bca583de30d835aa3de345fabb05c229277d18007251b441dfdbf863e0297a2fa6e08e41b7b57dd76eba7f2e50879ae2cfa
DIST haproxy-2.2.19.tar.gz 2941835 BLAKE2B 9bb7d75b598b075de56c4647d954c1aa8e277de49f9938eb7e759b65ac59b6802561a29a206caaf6076d2d6111b1b0b39b7c60584e4389273d22525be28895e8 SHA512 bd27f6fa3555a8d1c0f9ea91132ea474e54a176847e090f3e2296dbc8e9e98ef3dbcc4440abccf5d65c8b8afae33e8e5e5472002a9abaa63de3eed4056e519f8
+DIST haproxy-2.2.20.tar.gz 2945047 BLAKE2B d2462b3c43e75f86752bcc0edf3af173fba10f9d8191e715b15c926bffb6018b495a54e3f9883dfe6cc80f33cd5f362ac1e2db88f9d0e8b85be74c1fd28dc21a SHA512 53b8466b3717dd5e4d167d48ae449da6e97b3a6d9a06951f040aec34685b961a7014137a5e4d285bd2b8b6eaacc3028f1939c66f450775a01802df085d70a098
DIST haproxy-2.4.10.tar.gz 3605085 BLAKE2B c42bd0241b9bb6d5fd5d566871f9ade943530175cdaa399d1a9583d25efafb0e7fb067143d5bc99d0705b0264691efc57021adecbd5bfe5dbe42d1eebdae60c8 SHA512 116739dbef44164e9e7bf56855bebcb09a7678df688a607539aebde330844d4ae110b9e9e2f75b70ed7147d51154566968972d19ee6d45936bb3d0ed79c7d348
+DIST haproxy-2.4.12.tar.gz 3607497 BLAKE2B 8e66c09ff29dddee61603f1b877ee427f20f3ae1d1fcb5a2659c86bd6a91f48745c17147ebc995231e398daf307e5757e940cb34b6f337ac4afe81965fd110d7 SHA512 bb5cf9894cab051f96c067203842e7d6277bc02c825061e483b7678ca6e70d01fc3f6d57e9cc9243b57feac97967b09467e463c7dd7ab44700a7af2087a559b6
DIST haproxy-2.4.4.tar.gz 3587306 BLAKE2B 983f5919b738419d616b35c1cad6aa2400b0b857160ecfac3bcdfcc14c15280283ae3f33036652a3a9b5bfff0fbb6a54912807ea7c83c828d2b5ba72274fe1a8 SHA512 a8987e8342fdbec7e48de09a4391a67e77e05493260e0e561e8c185b6457b8e1086cc45ce04ebf3365699c008dff81667490e2fe99c33c0ac3c7513df8ae025c
DIST haproxy-2.5.0.tar.gz 3803196 BLAKE2B 271661f685f4aa885e3cab75c4a0abeb9751a7cb4ceec3a71f475e75b635f8452857dcaa7b010c8d0621becb3ff7f5d49af8d7d758b30829ae99e153ebc85b56 SHA512 70068962a434e9ba4b2d7595b929aec618ee62d51935c9836f2617e639416e50077495bbf08dabbe7dd49f2d4e3942e55a96a5de33a7846377972fbc3eedc1d0
+DIST haproxy-2.5.1.tar.gz 3811260 BLAKE2B af36d05856b87a9f784275112e66b26708d0c5d0cdc3e28bb1b837d3a2996f3361664e4d38267526684e6f93daf09685f61084ba82892fe9e53415751b52f011 SHA512 d0ef80e68b99c3dd2f286a18a4061f1fc6dda5aa501c80d42a0fe97f6bb88d7f7999da6f7ff97b2c318c9ec5fccffd9cf5b2eb4cdf1cf1101b4f002da27f4e5c
diff --git a/net-proxy/haproxy/haproxy-2.2.20.ebuild b/net-proxy/haproxy/haproxy-2.2.20.ebuild
new file mode 100644
index 000000000000..3f411c90b78f
--- /dev/null
+++ b/net-proxy/haproxy/haproxy-2.2.20.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+LUA_COMPAT=( lua5-3 )
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit toolchain-funcs flag-o-matic lua-single systemd linux-info ${SCM}
+
+MY_P="${PN}-${PV/_beta/-dev}"
+
+DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
+HOMEPAGE="http://www.haproxy.org"
+if [[ ${PV} != *9999 ]]; then
+ SRC_URI="http://haproxy.1wt.eu/download/$(ver_cut 1-2)/src/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~ppc ~x86"
+else
+ EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(ver_cut 1-2).git/"
+ EGIT_BRANCH=master
+fi
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="+crypt doc examples slz +net_ns +pcre pcre-jit pcre2 pcre2-jit prometheus-exporter
+ssl systemd +threads tools vim-syntax +zlib lua device-atlas 51degrees wurfl"
+REQUIRED_USE="pcre-jit? ( pcre )
+ pcre2-jit? ( pcre2 )
+ pcre? ( !pcre2 )
+ lua? ( ${LUA_REQUIRED_USE} )
+ device-atlas? ( pcre )
+ ?? ( slz zlib )"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND="
+ crypt? ( virtual/libcrypt:= )
+ pcre? (
+ dev-libs/libpcre
+ pcre-jit? ( dev-libs/libpcre[jit] )
+ )
+ pcre2? (
+ dev-libs/libpcre2:=
+ pcre2-jit? ( dev-libs/libpcre2:=[jit] )
+ )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+ slz? ( dev-libs/libslz:= )
+ systemd? ( sys-apps/systemd )
+ zlib? ( sys-libs/zlib )
+ lua? ( ${LUA_DEPS} )
+ device-atlas? ( dev-libs/device-atlas-api-c )"
+RDEPEND="${DEPEND}
+ acct-group/haproxy
+ acct-user/haproxy"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
+CONTRIBS=( halog iprange )
+# ip6range is present in 1.6, but broken.
+ver_test ${PV} -ge 1.7.0 && CONTRIBS+=( ip6range spoa_example tcploop )
+# TODO: mod_defender - requires apache / APR, modsecurity - the same
+ver_test ${PV} -ge 1.8.0 && CONTRIBS+=( hpack )
+
+haproxy_use() {
+ (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
+
+ usex "${1}" "USE_${2}=1" "USE_${2}="
+}
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+ if use net_ns; then
+ CONFIG_CHECK="~NET_NS"
+ linux-info_pkg_setup
+ fi
+}
+
+src_compile() {
+ local -a args=(
+ V=1
+ TARGET=linux-glibc
+ )
+
+ # TODO: PCRE2_WIDTH?
+ args+=( $(haproxy_use threads THREAD) )
+ args+=( $(haproxy_use crypt LIBCRYPT) )
+ args+=( $(haproxy_use net_ns NS) )
+ args+=( $(haproxy_use pcre PCRE) )
+ args+=( $(haproxy_use pcre-jit PCRE_JIT) )
+ args+=( $(haproxy_use pcre2 PCRE2) )
+ args+=( $(haproxy_use pcre2-jit PCRE2_JIT) )
+ args+=( $(haproxy_use ssl OPENSSL) )
+ args+=( $(haproxy_use slz SLZ) )
+ args+=( $(haproxy_use zlib ZLIB) )
+ args+=( $(haproxy_use lua LUA) )
+ args+=( $(haproxy_use 51degrees 51DEGREES) )
+ args+=( $(haproxy_use device-atlas DEVICEATLAS) )
+ args+=( $(haproxy_use wurfl WURFL) )
+ args+=( $(haproxy_use systemd SYSTEMD) )
+
+ # For now, until the strict-aliasing breakage will be fixed
+ append-cflags -fno-strict-aliasing
+
+ # Bug #668002
+ if use ppc || use arm || use hppa; then
+ TARGET_LDFLAGS=-latomic
+ fi
+
+ if use prometheus-exporter; then
+ EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
+ fi
+
+ # HAProxy really needs some of those "SPEC_CFLAGS", like -fno-strict-aliasing
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" ${args[@]}
+ emake -C contrib/systemd SBINDIR=/usr/sbin
+
+ if use tools ; then
+ for contrib in ${CONTRIBS[@]} ; do
+ # Those two includes are a workaround for hpack Makefile missing those
+ emake -C contrib/${contrib} \
+ CFLAGS="${CFLAGS} -I../../include/ -I../../ebtree/" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+ done
+ fi
+}
+
+src_install() {
+ dosbin haproxy
+ dosym ../sbin/haproxy /usr/bin/haproxy
+
+ newconfd "${FILESDIR}/${PN}.confd" ${PN}
+ newinitd "${FILESDIR}/${PN}.initd-r6" ${PN}
+
+ doman doc/haproxy.1
+
+ systemd_dounit contrib/systemd/haproxy.service
+
+ einstalldocs
+
+ # The errorfiles are used by upstream defaults.
+ insinto /etc/haproxy/errors/
+ doins examples/errorfiles/*
+
+ if use doc; then
+ dodoc ROADMAP doc/*.txt
+ #if use lua; then
+ # TODO: doc/lua-api/
+ #fi
+ fi
+
+ if use tools ; then
+ has halog "${CONTRIBS[@]}" && dobin contrib/halog/halog
+ has "iprange" "${CONTRIBS[@]}" && newbin contrib/iprange/iprange haproxy_iprange
+ has "ip6range" "${CONTRIBS[@]}" && newbin contrib/ip6range/ip6range haproxy_ip6range
+ has "spoa_example" "${CONTRIBS[@]}" && newbin contrib/spoa_example/spoa haproxy_spoa_example
+ has "spoa_example" "${CONTRIBS[@]}" && newdoc contrib/spoa_example/README README.spoa_example
+ has "tcploop" "${CONTRIBS[@]}" && newbin contrib/tcploop/tcploop haproxy_tcploop
+ has "hpack" "${CONTRIBS[@]}" && newbin contrib/hpack/gen-rht haproxy_hpack
+ fi
+
+ if use examples ; then
+ docinto examples
+ dodoc examples/*.cfg
+ dodoc doc/seamless_reload.txt
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins contrib/syntax-highlight/haproxy.vim
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
+ ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
+ ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
+ ewarn "Make use of them with the \"user\" and \"group\" directives."
+
+ if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
+ einfo "Please consult the installed documentation for learning the configuration file's syntax."
+ einfo "The documentation and sample configuration files are installed here:"
+ einfo " ${EROOT}/usr/share/doc/${PF}"
+ fi
+ fi
+}
diff --git a/net-proxy/haproxy/haproxy-2.4.12.ebuild b/net-proxy/haproxy/haproxy-2.4.12.ebuild
new file mode 100644
index 000000000000..ba20ee3537d8
--- /dev/null
+++ b/net-proxy/haproxy/haproxy-2.4.12.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+LUA_COMPAT=( lua5-3 )
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit toolchain-funcs flag-o-matic lua-single systemd linux-info ${SCM}
+
+MY_P="${PN}-${PV/_beta/-dev}"
+
+DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
+HOMEPAGE="http://www.haproxy.org"
+if [[ ${PV} != *9999 ]]; then
+ SRC_URI="http://haproxy.1wt.eu/download/$(ver_cut 1-2)/src/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
+else
+ EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(ver_cut 1-2).git/"
+ EGIT_BRANCH=master
+fi
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="+crypt doc examples +slz +net_ns +pcre pcre-jit pcre2 pcre2-jit prometheus-exporter
+ssl systemd +threads tools vim-syntax zlib lua device-atlas 51degrees wurfl"
+REQUIRED_USE="pcre-jit? ( pcre )
+ pcre2-jit? ( pcre2 )
+ pcre? ( !pcre2 )
+ lua? ( ${LUA_REQUIRED_USE} )
+ device-atlas? ( pcre )
+ ?? ( slz zlib )"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND="
+ crypt? ( virtual/libcrypt:= )
+ pcre? (
+ dev-libs/libpcre
+ pcre-jit? ( dev-libs/libpcre[jit] )
+ )
+ pcre2? (
+ dev-libs/libpcre2:=
+ pcre2-jit? ( dev-libs/libpcre2:=[jit] )
+ )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+ systemd? ( sys-apps/systemd )
+ zlib? ( sys-libs/zlib )
+ lua? ( ${LUA_DEPS} )
+ device-atlas? ( dev-libs/device-atlas-api-c )"
+RDEPEND="${DEPEND}
+ acct-group/haproxy
+ acct-user/haproxy"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
+EXTRAS=( admin/halog admin/iprange dev/tcploop dev/hpack )
+
+haproxy_use() {
+ (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
+
+ usex "${1}" "USE_${2}=1" "USE_${2}="
+}
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+ if use net_ns; then
+ CONFIG_CHECK="~NET_NS"
+ linux-info_pkg_setup
+ fi
+}
+
+src_compile() {
+ local -a args=(
+ V=1
+ TARGET=linux-glibc
+ )
+
+ # TODO: PCRE2_WIDTH?
+ args+=( $(haproxy_use threads THREAD) )
+ args+=( $(haproxy_use crypt LIBCRYPT) )
+ args+=( $(haproxy_use net_ns NS) )
+ args+=( $(haproxy_use pcre PCRE) )
+ args+=( $(haproxy_use pcre-jit PCRE_JIT) )
+ args+=( $(haproxy_use pcre2 PCRE2) )
+ args+=( $(haproxy_use pcre2-jit PCRE2_JIT) )
+ args+=( $(haproxy_use ssl OPENSSL) )
+ args+=( $(haproxy_use slz SLZ) )
+ args+=( $(haproxy_use zlib ZLIB) )
+ args+=( $(haproxy_use lua LUA) )
+ args+=( $(haproxy_use 51degrees 51DEGREES) )
+ args+=( $(haproxy_use device-atlas DEVICEATLAS) )
+ args+=( $(haproxy_use wurfl WURFL) )
+ args+=( $(haproxy_use systemd SYSTEMD) )
+ args+=( $(haproxy_use prometheus-exporter PROMEX) )
+
+ # Bug #668002
+ if use ppc || use arm || use hppa; then
+ TARGET_LDFLAGS=-latomic
+ fi
+
+ # HAProxy really needs some of those "SPEC_CFLAGS", like -fno-strict-aliasing
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]}
+ emake -C admin/systemd CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) SBINDIR=/usr/sbin
+
+ if use tools ; then
+ for extra in ${EXTRAS[@]} ; do
+ if [ "${extra}" = "admin/halog" ]; then
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]} admin/halog/halog
+ elif [ "${extra}" = "dev/hpack" ]; then
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]} dev/hpack/{decode,gen-enc,gen-rht}
+ else
+ # Those two includes are a workaround for hpack Makefile missing those
+ emake -C ${extra} \
+ CFLAGS="${CFLAGS} -I../../include/ -I../../ebtree/" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+ fi
+ done
+ fi
+}
+
+src_install() {
+ dosbin haproxy
+ dosym ../sbin/haproxy /usr/bin/haproxy
+
+ newconfd "${FILESDIR}/${PN}.confd" ${PN}
+ newinitd "${FILESDIR}/${PN}.initd-r6" ${PN}
+
+ doman doc/haproxy.1
+
+ systemd_dounit admin/systemd/haproxy.service
+
+ einstalldocs
+
+ # The errorfiles are used by upstream defaults.
+ insinto /etc/haproxy/errors/
+ doins examples/errorfiles/*
+
+ if use doc; then
+ dodoc ROADMAP doc/*.txt
+ #if use lua; then
+ # TODO: doc/lua-api/
+ #fi
+ fi
+
+ if use tools ; then
+ has admin/halog "${EXTRAS[@]}" && dobin admin/halog/halog
+ has admin/iprange "${EXTRAS[@]}" && { newbin admin/iprange/iprange haproxy_iprange; newbin admin/iprange/ip6range haproxy_ip6range; }
+ has dev/tcploop "${EXTRAS[@]}" && newbin dev/tcploop/tcploop haproxy_tcploop
+ has dev/hpack "${EXTRAS[@]}" && {
+ newbin dev/hpack/gen-rht haproxy_gen-rht
+ newbin dev/hpack/gen-enc haproxy_gen-enc
+ newbin dev/hpack/decode haproxy_decode
+ }
+ fi
+
+ if use examples ; then
+ docinto examples
+ dodoc examples/*.cfg
+ dodoc doc/seamless_reload.txt
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins admin/syntax-highlight/haproxy.vim
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
+ ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
+ ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
+ ewarn "Make use of them with the \"user\" and \"group\" directives."
+
+ if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
+ einfo "Please consult the installed documentation for learning the configuration file's syntax."
+ einfo "The documentation and sample configuration files are installed here:"
+ einfo " ${EROOT}/usr/share/doc/${PF}"
+ fi
+ fi
+}
diff --git a/net-proxy/haproxy/haproxy-2.5.1.ebuild b/net-proxy/haproxy/haproxy-2.5.1.ebuild
new file mode 100644
index 000000000000..ba20ee3537d8
--- /dev/null
+++ b/net-proxy/haproxy/haproxy-2.5.1.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+LUA_COMPAT=( lua5-3 )
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit toolchain-funcs flag-o-matic lua-single systemd linux-info ${SCM}
+
+MY_P="${PN}-${PV/_beta/-dev}"
+
+DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
+HOMEPAGE="http://www.haproxy.org"
+if [[ ${PV} != *9999 ]]; then
+ SRC_URI="http://haproxy.1wt.eu/download/$(ver_cut 1-2)/src/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
+else
+ EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(ver_cut 1-2).git/"
+ EGIT_BRANCH=master
+fi
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="+crypt doc examples +slz +net_ns +pcre pcre-jit pcre2 pcre2-jit prometheus-exporter
+ssl systemd +threads tools vim-syntax zlib lua device-atlas 51degrees wurfl"
+REQUIRED_USE="pcre-jit? ( pcre )
+ pcre2-jit? ( pcre2 )
+ pcre? ( !pcre2 )
+ lua? ( ${LUA_REQUIRED_USE} )
+ device-atlas? ( pcre )
+ ?? ( slz zlib )"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND="
+ crypt? ( virtual/libcrypt:= )
+ pcre? (
+ dev-libs/libpcre
+ pcre-jit? ( dev-libs/libpcre[jit] )
+ )
+ pcre2? (
+ dev-libs/libpcre2:=
+ pcre2-jit? ( dev-libs/libpcre2:=[jit] )
+ )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+ systemd? ( sys-apps/systemd )
+ zlib? ( sys-libs/zlib )
+ lua? ( ${LUA_DEPS} )
+ device-atlas? ( dev-libs/device-atlas-api-c )"
+RDEPEND="${DEPEND}
+ acct-group/haproxy
+ acct-user/haproxy"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
+EXTRAS=( admin/halog admin/iprange dev/tcploop dev/hpack )
+
+haproxy_use() {
+ (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
+
+ usex "${1}" "USE_${2}=1" "USE_${2}="
+}
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+ if use net_ns; then
+ CONFIG_CHECK="~NET_NS"
+ linux-info_pkg_setup
+ fi
+}
+
+src_compile() {
+ local -a args=(
+ V=1
+ TARGET=linux-glibc
+ )
+
+ # TODO: PCRE2_WIDTH?
+ args+=( $(haproxy_use threads THREAD) )
+ args+=( $(haproxy_use crypt LIBCRYPT) )
+ args+=( $(haproxy_use net_ns NS) )
+ args+=( $(haproxy_use pcre PCRE) )
+ args+=( $(haproxy_use pcre-jit PCRE_JIT) )
+ args+=( $(haproxy_use pcre2 PCRE2) )
+ args+=( $(haproxy_use pcre2-jit PCRE2_JIT) )
+ args+=( $(haproxy_use ssl OPENSSL) )
+ args+=( $(haproxy_use slz SLZ) )
+ args+=( $(haproxy_use zlib ZLIB) )
+ args+=( $(haproxy_use lua LUA) )
+ args+=( $(haproxy_use 51degrees 51DEGREES) )
+ args+=( $(haproxy_use device-atlas DEVICEATLAS) )
+ args+=( $(haproxy_use wurfl WURFL) )
+ args+=( $(haproxy_use systemd SYSTEMD) )
+ args+=( $(haproxy_use prometheus-exporter PROMEX) )
+
+ # Bug #668002
+ if use ppc || use arm || use hppa; then
+ TARGET_LDFLAGS=-latomic
+ fi
+
+ # HAProxy really needs some of those "SPEC_CFLAGS", like -fno-strict-aliasing
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]}
+ emake -C admin/systemd CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) SBINDIR=/usr/sbin
+
+ if use tools ; then
+ for extra in ${EXTRAS[@]} ; do
+ if [ "${extra}" = "admin/halog" ]; then
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]} admin/halog/halog
+ elif [ "${extra}" = "dev/hpack" ]; then
+ emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" TARGET_LDFLAGS="${TARGET_LDFLAGS}" PCRE_LIB=${ERROT}/usr/$(get_libdir) ${args[@]} dev/hpack/{decode,gen-enc,gen-rht}
+ else
+ # Those two includes are a workaround for hpack Makefile missing those
+ emake -C ${extra} \
+ CFLAGS="${CFLAGS} -I../../include/ -I../../ebtree/" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+ fi
+ done
+ fi
+}
+
+src_install() {
+ dosbin haproxy
+ dosym ../sbin/haproxy /usr/bin/haproxy
+
+ newconfd "${FILESDIR}/${PN}.confd" ${PN}
+ newinitd "${FILESDIR}/${PN}.initd-r6" ${PN}
+
+ doman doc/haproxy.1
+
+ systemd_dounit admin/systemd/haproxy.service
+
+ einstalldocs
+
+ # The errorfiles are used by upstream defaults.
+ insinto /etc/haproxy/errors/
+ doins examples/errorfiles/*
+
+ if use doc; then
+ dodoc ROADMAP doc/*.txt
+ #if use lua; then
+ # TODO: doc/lua-api/
+ #fi
+ fi
+
+ if use tools ; then
+ has admin/halog "${EXTRAS[@]}" && dobin admin/halog/halog
+ has admin/iprange "${EXTRAS[@]}" && { newbin admin/iprange/iprange haproxy_iprange; newbin admin/iprange/ip6range haproxy_ip6range; }
+ has dev/tcploop "${EXTRAS[@]}" && newbin dev/tcploop/tcploop haproxy_tcploop
+ has dev/hpack "${EXTRAS[@]}" && {
+ newbin dev/hpack/gen-rht haproxy_gen-rht
+ newbin dev/hpack/gen-enc haproxy_gen-enc
+ newbin dev/hpack/decode haproxy_decode
+ }
+ fi
+
+ if use examples ; then
+ docinto examples
+ dodoc examples/*.cfg
+ dodoc doc/seamless_reload.txt
+ fi
+
+ if use vim-syntax ; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins admin/syntax-highlight/haproxy.vim
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
+ ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
+ ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
+ ewarn "Make use of them with the \"user\" and \"group\" directives."
+
+ if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
+ einfo "Please consult the installed documentation for learning the configuration file's syntax."
+ einfo "The documentation and sample configuration files are installed here:"
+ einfo " ${EROOT}/usr/share/doc/${PF}"
+ fi
+ fi
+}