net-proxy/haproxy: HAProxy 1.8.0 re bug 639040
authorChristian Ruppert <idl0r@gentoo.org>
Thu, 30 Nov 2017 10:52:34 +0000 (11:52 +0100)
committerChristian Ruppert <idl0r@gentoo.org>
Thu, 30 Nov 2017 10:53:11 +0000 (11:53 +0100)
Package-Manager: Portage-2.3.16, Repoman-2.3.6

net-proxy/haproxy/Manifest
net-proxy/haproxy/files/haproxy-1.8-contrib.patch [new file with mode: 0644]
net-proxy/haproxy/haproxy-1.8.0.ebuild [new file with mode: 0644]
net-proxy/haproxy/metadata.xml

index 4b41f47b5f0d650e33b0984e0280911248057629..a5314a77b67e1844efaed99ba89c517d19178bc7 100644 (file)
@@ -3,3 +3,4 @@ DIST haproxy-1.5.19.tar.gz 1362834 SHA256 e00ae2a633da614967f2e3ebebdb817ec537cb
 DIST haproxy-1.6.11.tar.gz 1574029 SHA256 62fe982edb102a9f55205792bc14b0d05745cc7993cd6bee5d73cd3c5ae16ace SHA512 73ff1c7301197b3bd75a3b1355787419676854d132ce2dcdacb2a296e297dcdfc52b0c571a4fb715e369f1126e1a58196fabb21f828c880f15904032da78e434 WHIRLPOOL 4454c51da89bb089579aefcf54093fd4c09b42918e81e41772d263ebc19f243a37b42135a02c4012705e4cc31370f377cf0b429e81707f307cffe9ed23f5183b
 DIST haproxy-1.6.13.tar.gz 1580214 SHA256 7d318583f3a1bf185e857bd40449004b29c95547c89bbb36718f284e29502a1b SHA512 ffed3b347e0cd9cefdc379c91890a3c104d6848b976a9f28984878a9c2d05ca7ddea678f7a93f75cb9d29ae2be921e5a5bd295b1a8771765b099d1c619ded7a3 WHIRLPOOL 70176ee090dacbbdc822c74bba137589f168482c560734c06b98dc23b4d957ed1e016309f11f25a0b486bc6917633455f1174dc6688d6aef53667c61b83a9ff3
 DIST haproxy-1.7.9.tar.gz 1748159 BLAKE2B 6826ad3519ff300fb1c91992014834543f971fade8a8b89956d4cd1fc0000b1b3e259586a21ee9fa8ca0ee1f4520517dfc328d83d7a858f469f0366df6e3da43 SHA512 d1ed791bc9607dbeabcfc6a1853cf258e28b3a079923b63d3bf97504dd59e64a5f5f44f9da968c23c12b4279e8d45ff3bd39418942ca6f00d9d548c9a0ccfd73
+DIST haproxy-1.8.0.tar.gz 2036854 BLAKE2B c7cebcb3e27f61f8fd65e084c8557c6ecbde07a9517c5950330b315cc76a4ced86272ca7b75a292380a867229be5e2b4e65514d4daae276472fa4d6a7919798c SHA512 7461c49cc00e7d6baf08dad9aba77e2b5cbbb532a902131838b0cc670a9ea85232f2da7187c3463c3bb76ca6955e17ce7eeec57378c002aaac3cf1dfbaf6cceb
diff --git a/net-proxy/haproxy/files/haproxy-1.8-contrib.patch b/net-proxy/haproxy/files/haproxy-1.8-contrib.patch
new file mode 100644 (file)
index 0000000..a3e336a
--- /dev/null
@@ -0,0 +1,81 @@
+From c702537864f7e062d18f4ccce3e29d14d4ccf05f Mon Sep 17 00:00:00 2001
+From: Christian Ruppert <idl0r@gentoo.org>
+Date: Thu, 30 Nov 2017 10:11:36 +0100
+Subject: [PATCH] Fix LDFLAGS vs. LIBS re linking order
+
+Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
+---
+ contrib/mod_defender/Makefile | 5 ++---
+ contrib/modsecurity/Makefile  | 5 ++---
+ contrib/spoa_example/Makefile | 5 ++---
+ 3 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/contrib/mod_defender/Makefile b/contrib/mod_defender/Makefile
+index ac17774d..efc7d7f6 100644
+--- a/contrib/mod_defender/Makefile
++++ b/contrib/mod_defender/Makefile
+@@ -28,9 +28,8 @@ EVENT_INC := /usr/include
+ endif
+
+ CFLAGS  += -g -Wall -pthread
+-LDFLAGS += -lpthread  $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
+ INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) -I$(EVENT_INC)
+-LIBS =
++LIBS += -lpthread  $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
+
+ CXXFLAGS = -g -std=gnu++11
+ CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
+@@ -43,7 +42,7 @@ CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
+ CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
+
+ defender: $(OBJS) $(CXXOBJS)
+-      $(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
++      $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ install: defender
+       install defender $(DESTDIR)$(BINDIR)
+diff --git a/contrib/modsecurity/Makefile b/contrib/modsecurity/Makefile
+index bb918c30..aa0d6e38 100644
+--- a/contrib/modsecurity/Makefile
++++ b/contrib/modsecurity/Makefile
+@@ -34,14 +34,13 @@ EVENT_INC := /usr/include
+ endif
+
+ CFLAGS  += -g -Wall -pthread
+-LDFLAGS += -lpthread  $(EVENT_LIB) -levent_pthreads -lcurl -lapr-1 -laprutil-1 -lxml2 -lpcre -lyajl
+ INCS += -I../../include -I../../ebtree -I$(MODSEC_INC) -I$(APACHE2_INC) -I$(APR_INC) -I$(LIBXML_INC) -I$(EVENT_INC)
+-LIBS =
++LIBS += -lpthread  $(EVENT_LIB) -levent_pthreads -lcurl -lapr-1 -laprutil-1 -lxml2 -lpcre -lyajl
+
+ OBJS = spoa.o modsec_wrapper.o
+
+ modsecurity: $(OBJS)
+-      $(LD) $(LDFLAGS) $(LIBS) -o $@ $^ $(MODSEC_LIB)/standalone.a
++      $(LD) $(LDFLAGS) -o $@ $^ $(MODSEC_LIB)/standalone.a $(LIBS)
+
+ install: modsecurity
+       install modsecurity $(DESTDIR)$(BINDIR)
+diff --git a/contrib/spoa_example/Makefile b/contrib/spoa_example/Makefile
+index d04a01e1..c44c2b87 100644
+--- a/contrib/spoa_example/Makefile
++++ b/contrib/spoa_example/Makefile
+@@ -6,15 +6,14 @@ CC = gcc
+ LD = $(CC)
+
+ CFLAGS  = -g -O2 -Wall -Werror -pthread
+-LDFLAGS = -lpthread -levent -levent_pthreads
+ INCS += -I../../ebtree -I./include
+-LIBS =
++LIBS = -lpthread -levent -levent_pthreads
+
+ OBJS = spoa.o
+
+
+ spoa: $(OBJS)
+-      $(LD) $(LDFLAGS) $(LIBS) -o $@ $^
++      $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ install: spoa
+       install spoa $(DESTDIR)$(BINDIR)
+--
+2.13.6
diff --git a/net-proxy/haproxy/haproxy-1.8.0.ebuild b/net-proxy/haproxy/haproxy-1.8.0.ebuild
new file mode 100644 (file)
index 0000000..80e41f2
--- /dev/null
@@ -0,0 +1,171 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+[[ ${PV} == *9999 ]] && SCM="git-r3"
+inherit user versionator 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://haproxy.1wt.eu"
+if [[ ${PV} != *9999 ]]; then
+       SRC_URI="http://haproxy.1wt.eu/download/$(get_version_component_range 1-2)/src/${MY_P}.tar.gz"
+       KEYWORDS="~amd64 ~arm ~ppc ~x86"
+else
+       EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(get_version_component_range 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 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 )
+version_is_at_least 1.7.0 $PV && PATCHES=( "${FILESDIR}"/haproxy-1.7-contrib.patch )
+version_is_at_least 1.8.0 $PV && PATCHES=( "${FILESDIR}"/haproxy-1.8-contrib.patch )
+CONTRIBS=( halog iprange )
+# ip6range is present in 1.6, but broken.
+version_is_at_least 1.7.0 $PV && CONTRIBS+=( ip6range spoa_example tcploop )
+# TODO: mod_defender - requires apache / APR, modsecurity - the same
+version_is_at_least 1.8.0 $PV && 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=(
+               TARGET=linux2628
+               USE_GETADDRINFO=1
+               USE_TFO=1
+       )
+
+       # 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 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
+
+       emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+       emake -C contrib/systemd SBINDIR=/usr/sbin
+
+       if use tools ; then
+               for contrib in ${CONTRIBS[@]} ; do
+                       emake -C contrib/${contrib} \
+                               CFLAGS="${CFLAGS}" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
+               done
+       fi
+}
+
+src_install() {
+       dosbin haproxy
+       dosym /usr/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 examples/seamless_reload.txt
+       fi
+
+       if use vim-syntax ; then
+               insinto /usr/share/vim/vimfiles/syntax
+               doins examples/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
+}
index 017b2b8ad09c1b032b74092f263a2107625f5c06..6a09dde73e296a4d2548cbe1f156151c29467484 100644 (file)
@@ -21,6 +21,8 @@
        <use>
                <flag name="net_ns">Enable network namespace support (CONFIG_NET_NS)</flag>
                <flag name="pcre-jit">Use JIT support for PCRE</flag>
+               <flag name="pcre2">Enable PCRE2 RegEx support</flag>
+               <flag name="pcre2-jit">Use JIT support for PCRE2</flag>
                <flag name="slz">Use <pkg>dev-libs/libslz</pkg> compression library</flag>
                <flag name="tools">Install additional tools (halog, iprange)</flag>
                <flag name="device-atlas">Use <pkg>dev-libs/device-atlas-api-c</pkg> library</flag>