net-proxy/haproxy: HAProxy 2.1.x
authorChristian Ruppert <idl0r@gentoo.org>
Wed, 27 Nov 2019 09:51:22 +0000 (10:51 +0100)
committerChristian Ruppert <idl0r@gentoo.org>
Wed, 27 Nov 2019 09:51:37 +0000 (10:51 +0100)
Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
net-proxy/haproxy/Manifest
net-proxy/haproxy/haproxy-2.1.0.ebuild [new file with mode: 0644]
net-proxy/haproxy/haproxy-2.1.9999.ebuild [new file with mode: 0644]

index ef7e789f4cbde3533e418f787506679148531989..8451a3f77ce1ce636996a9e5a5c9f499d7da5db7 100644 (file)
@@ -7,3 +7,4 @@ DIST haproxy-2.0.10.tar.gz 2557865 BLAKE2B 0e98fd2461414b4b55fc2bf100c80f17cbc34
 DIST haproxy-2.0.6.tar.gz 2541637 BLAKE2B 52d88ef3c944437fbee7128163621cc9aae541eac16a71cd3aa1d7396b44e84b643d45a0b3cd990a73686a9d254855633bcc38b0ad1d8a13f8c8e1a2c444bfff SHA512 78c8483a97845928dc3ec7da68bedfda73303c88e8146a6b38c3d2b4e2089af5668817f0675180d41274c6337d5fae7cad5534013bd15d9b06071b89a09a86b5
 DIST haproxy-2.0.7.tar.gz 2542573 BLAKE2B a312244087a3730c7837aebb99c64e40ac98ed06e6dc65f02151356ca4130a7d9b3eddc08b92fcb8d9658b98d19ad95ad3dd3e0945ff7824ee3ce2bf0aac8ce7 SHA512 3257bb90555cb7ccf1b5ef71815f8258598aa87239ec46a24d250929811bd49fef21e4c2d0a12ee9f7aca2cca33367f972e4e62e9b01274b8c644a97e4353574
 DIST haproxy-2.0.8.tar.gz 2546661 BLAKE2B 2e8ec27398e6515c8e5b3cd51b4a219682dcfe798d0ad545ac2933ff5ca8c2ff78568935900c8523a703c3d96da64b61160dd967a832307455e63f1bd64f8d3f SHA512 61cb7274d96bde1c542e9f0cd5c9dc8f7ee5fa710eb8867bd70040718ce696505d533713f867199d6f0780fe0f8c7e989bf25ee93e806c0e3fe6f593382814a6
+DIST haproxy-2.1.0.tar.gz 2583210 BLAKE2B 275d32a0070300745f99c8cccb700f765df7b5877bff3d3c6f90f5b42b3754b0107cfdcf1fb3fbc1c7f17eb62e6576e3f295296768a0ba8c5c0c6cd1f835174f SHA512 fb4cd61ba190d66dc96871dfff3651983592bdc17752ee9d93a04f58820e31fe6096ad5ad692cc3d3e571e901aac8f51125fd99488046324037530ff6a62086a
diff --git a/net-proxy/haproxy/haproxy-2.1.0.ebuild b/net-proxy/haproxy/haproxy-2.1.0.ebuild
new file mode 100644 (file)
index 0000000..06e10c9
--- /dev/null
@@ -0,0 +1,176 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit user toolchain-funcs flag-o-matic 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"
+IUSE="+crypt doc examples libressl 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 )
+       device-atlas? ( pcre )
+       ?? ( slz zlib )"
+
+DEPEND="
+       pcre? (
+               dev-libs/libpcre
+               pcre-jit? ( dev-libs/libpcre[jit] )
+       )
+       pcre2? (
+               dev-libs/libpcre
+               pcre2-jit? ( dev-libs/libpcre2[jit] )
+       )
+       ssl? (
+               !libressl? ( dev-libs/openssl:0=[zlib?] )
+               libressl? ( dev-libs/libressl:0= )
+       )
+       slz? ( dev-libs/libslz:= )
+       zlib? ( sys-libs/zlib )
+       lua? ( dev-lang/lua:5.3 )
+       device-atlas? ( dev-libs/device-atlas-api-c )"
+RDEPEND="${DEPEND}"
+
+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() {
+       enewgroup haproxy
+       enewuser haproxy -1 -1 -1 haproxy
+
+       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
+
+       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}" ${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.1.9999.ebuild b/net-proxy/haproxy/haproxy-2.1.9999.ebuild
new file mode 100644 (file)
index 0000000..06e10c9
--- /dev/null
@@ -0,0 +1,176 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit user toolchain-funcs flag-o-matic 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"
+IUSE="+crypt doc examples libressl 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 )
+       device-atlas? ( pcre )
+       ?? ( slz zlib )"
+
+DEPEND="
+       pcre? (
+               dev-libs/libpcre
+               pcre-jit? ( dev-libs/libpcre[jit] )
+       )
+       pcre2? (
+               dev-libs/libpcre
+               pcre2-jit? ( dev-libs/libpcre2[jit] )
+       )
+       ssl? (
+               !libressl? ( dev-libs/openssl:0=[zlib?] )
+               libressl? ( dev-libs/libressl:0= )
+       )
+       slz? ( dev-libs/libslz:= )
+       zlib? ( sys-libs/zlib )
+       lua? ( dev-lang/lua:5.3 )
+       device-atlas? ( dev-libs/device-atlas-api-c )"
+RDEPEND="${DEPEND}"
+
+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() {
+       enewgroup haproxy
+       enewuser haproxy -1 -1 -1 haproxy
+
+       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
+
+       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}" ${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
+}