Gentoo Archives: gentoo-commits

From: Christian Ruppert <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-proxy/haproxy/, net-proxy/haproxy/files/
Date: Thu, 30 Nov 2017 10:53:25
Message-Id: 1512039191.ce51abd31589184eb86587cf0d784ead6eb821f5.idl0r@gentoo
1 commit: ce51abd31589184eb86587cf0d784ead6eb821f5
2 Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 30 10:52:34 2017 +0000
4 Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 30 10:53:11 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce51abd3
7
8 net-proxy/haproxy: HAProxy 1.8.0 re bug 639040
9
10 Package-Manager: Portage-2.3.16, Repoman-2.3.6
11
12 net-proxy/haproxy/Manifest | 1 +
13 net-proxy/haproxy/files/haproxy-1.8-contrib.patch | 81 ++++++++++
14 net-proxy/haproxy/haproxy-1.8.0.ebuild | 171 ++++++++++++++++++++++
15 net-proxy/haproxy/metadata.xml | 2 +
16 4 files changed, 255 insertions(+)
17
18 diff --git a/net-proxy/haproxy/Manifest b/net-proxy/haproxy/Manifest
19 index 4b41f47b5f0..a5314a77b67 100644
20 --- a/net-proxy/haproxy/Manifest
21 +++ b/net-proxy/haproxy/Manifest
22 @@ -3,3 +3,4 @@ DIST haproxy-1.5.19.tar.gz 1362834 SHA256 e00ae2a633da614967f2e3ebebdb817ec537cb
23 DIST haproxy-1.6.11.tar.gz 1574029 SHA256 62fe982edb102a9f55205792bc14b0d05745cc7993cd6bee5d73cd3c5ae16ace SHA512 73ff1c7301197b3bd75a3b1355787419676854d132ce2dcdacb2a296e297dcdfc52b0c571a4fb715e369f1126e1a58196fabb21f828c880f15904032da78e434 WHIRLPOOL 4454c51da89bb089579aefcf54093fd4c09b42918e81e41772d263ebc19f243a37b42135a02c4012705e4cc31370f377cf0b429e81707f307cffe9ed23f5183b
24 DIST haproxy-1.6.13.tar.gz 1580214 SHA256 7d318583f3a1bf185e857bd40449004b29c95547c89bbb36718f284e29502a1b SHA512 ffed3b347e0cd9cefdc379c91890a3c104d6848b976a9f28984878a9c2d05ca7ddea678f7a93f75cb9d29ae2be921e5a5bd295b1a8771765b099d1c619ded7a3 WHIRLPOOL 70176ee090dacbbdc822c74bba137589f168482c560734c06b98dc23b4d957ed1e016309f11f25a0b486bc6917633455f1174dc6688d6aef53667c61b83a9ff3
25 DIST haproxy-1.7.9.tar.gz 1748159 BLAKE2B 6826ad3519ff300fb1c91992014834543f971fade8a8b89956d4cd1fc0000b1b3e259586a21ee9fa8ca0ee1f4520517dfc328d83d7a858f469f0366df6e3da43 SHA512 d1ed791bc9607dbeabcfc6a1853cf258e28b3a079923b63d3bf97504dd59e64a5f5f44f9da968c23c12b4279e8d45ff3bd39418942ca6f00d9d548c9a0ccfd73
26 +DIST haproxy-1.8.0.tar.gz 2036854 BLAKE2B c7cebcb3e27f61f8fd65e084c8557c6ecbde07a9517c5950330b315cc76a4ced86272ca7b75a292380a867229be5e2b4e65514d4daae276472fa4d6a7919798c SHA512 7461c49cc00e7d6baf08dad9aba77e2b5cbbb532a902131838b0cc670a9ea85232f2da7187c3463c3bb76ca6955e17ce7eeec57378c002aaac3cf1dfbaf6cceb
27
28 diff --git a/net-proxy/haproxy/files/haproxy-1.8-contrib.patch b/net-proxy/haproxy/files/haproxy-1.8-contrib.patch
29 new file mode 100644
30 index 00000000000..a3e336a5773
31 --- /dev/null
32 +++ b/net-proxy/haproxy/files/haproxy-1.8-contrib.patch
33 @@ -0,0 +1,81 @@
34 +From c702537864f7e062d18f4ccce3e29d14d4ccf05f Mon Sep 17 00:00:00 2001
35 +From: Christian Ruppert <idl0r@g.o>
36 +Date: Thu, 30 Nov 2017 10:11:36 +0100
37 +Subject: [PATCH] Fix LDFLAGS vs. LIBS re linking order
38 +
39 +Signed-off-by: Christian Ruppert <idl0r@g.o>
40 +---
41 + contrib/mod_defender/Makefile | 5 ++---
42 + contrib/modsecurity/Makefile | 5 ++---
43 + contrib/spoa_example/Makefile | 5 ++---
44 + 3 files changed, 6 insertions(+), 9 deletions(-)
45 +
46 +diff --git a/contrib/mod_defender/Makefile b/contrib/mod_defender/Makefile
47 +index ac17774d..efc7d7f6 100644
48 +--- a/contrib/mod_defender/Makefile
49 ++++ b/contrib/mod_defender/Makefile
50 +@@ -28,9 +28,8 @@ EVENT_INC := /usr/include
51 + endif
52 +
53 + CFLAGS += -g -Wall -pthread
54 +-LDFLAGS += -lpthread $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
55 + INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) -I$(EVENT_INC)
56 +-LIBS =
57 ++LIBS += -lpthread $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
58 +
59 + CXXFLAGS = -g -std=gnu++11
60 + CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
61 +@@ -43,7 +42,7 @@ CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
62 + CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
63 +
64 + defender: $(OBJS) $(CXXOBJS)
65 +- $(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
66 ++ $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
67 +
68 + install: defender
69 + install defender $(DESTDIR)$(BINDIR)
70 +diff --git a/contrib/modsecurity/Makefile b/contrib/modsecurity/Makefile
71 +index bb918c30..aa0d6e38 100644
72 +--- a/contrib/modsecurity/Makefile
73 ++++ b/contrib/modsecurity/Makefile
74 +@@ -34,14 +34,13 @@ EVENT_INC := /usr/include
75 + endif
76 +
77 + CFLAGS += -g -Wall -pthread
78 +-LDFLAGS += -lpthread $(EVENT_LIB) -levent_pthreads -lcurl -lapr-1 -laprutil-1 -lxml2 -lpcre -lyajl
79 + INCS += -I../../include -I../../ebtree -I$(MODSEC_INC) -I$(APACHE2_INC) -I$(APR_INC) -I$(LIBXML_INC) -I$(EVENT_INC)
80 +-LIBS =
81 ++LIBS += -lpthread $(EVENT_LIB) -levent_pthreads -lcurl -lapr-1 -laprutil-1 -lxml2 -lpcre -lyajl
82 +
83 + OBJS = spoa.o modsec_wrapper.o
84 +
85 + modsecurity: $(OBJS)
86 +- $(LD) $(LDFLAGS) $(LIBS) -o $@ $^ $(MODSEC_LIB)/standalone.a
87 ++ $(LD) $(LDFLAGS) -o $@ $^ $(MODSEC_LIB)/standalone.a $(LIBS)
88 +
89 + install: modsecurity
90 + install modsecurity $(DESTDIR)$(BINDIR)
91 +diff --git a/contrib/spoa_example/Makefile b/contrib/spoa_example/Makefile
92 +index d04a01e1..c44c2b87 100644
93 +--- a/contrib/spoa_example/Makefile
94 ++++ b/contrib/spoa_example/Makefile
95 +@@ -6,15 +6,14 @@ CC = gcc
96 + LD = $(CC)
97 +
98 + CFLAGS = -g -O2 -Wall -Werror -pthread
99 +-LDFLAGS = -lpthread -levent -levent_pthreads
100 + INCS += -I../../ebtree -I./include
101 +-LIBS =
102 ++LIBS = -lpthread -levent -levent_pthreads
103 +
104 + OBJS = spoa.o
105 +
106 +
107 + spoa: $(OBJS)
108 +- $(LD) $(LDFLAGS) $(LIBS) -o $@ $^
109 ++ $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
110 +
111 + install: spoa
112 + install spoa $(DESTDIR)$(BINDIR)
113 +--
114 +2.13.6
115
116 diff --git a/net-proxy/haproxy/haproxy-1.8.0.ebuild b/net-proxy/haproxy/haproxy-1.8.0.ebuild
117 new file mode 100644
118 index 00000000000..80e41f24b2a
119 --- /dev/null
120 +++ b/net-proxy/haproxy/haproxy-1.8.0.ebuild
121 @@ -0,0 +1,171 @@
122 +# Copyright 1999-2017 Gentoo Foundation
123 +# Distributed under the terms of the GNU General Public License v2
124 +
125 +EAPI="6"
126 +
127 +[[ ${PV} == *9999 ]] && SCM="git-r3"
128 +inherit user versionator toolchain-funcs flag-o-matic systemd linux-info $SCM
129 +
130 +MY_P="${PN}-${PV/_beta/-dev}"
131 +
132 +DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
133 +HOMEPAGE="http://haproxy.1wt.eu"
134 +if [[ ${PV} != *9999 ]]; then
135 + SRC_URI="http://haproxy.1wt.eu/download/$(get_version_component_range 1-2)/src/${MY_P}.tar.gz"
136 + KEYWORDS="~amd64 ~arm ~ppc ~x86"
137 +else
138 + EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(get_version_component_range 1-2).git/"
139 + EGIT_BRANCH=master
140 +fi
141 +
142 +LICENSE="GPL-2 LGPL-2.1"
143 +SLOT="0"
144 +IUSE="+crypt doc examples libressl slz net_ns +pcre pcre-jit pcre2 pcre2-jit ssl
145 +systemd +threads tools vim-syntax +zlib lua device-atlas 51degrees wurfl"
146 +REQUIRED_USE="pcre-jit? ( pcre )
147 + pcre2-jit? ( pcre2 )
148 + pcre? ( !pcre2 )
149 + device-atlas? ( pcre )
150 + ?? ( slz zlib )"
151 +
152 +DEPEND="
153 + pcre? (
154 + dev-libs/libpcre
155 + pcre-jit? ( dev-libs/libpcre[jit] )
156 + )
157 + pcre2? (
158 + dev-libs/libpcre
159 + pcre2-jit? ( dev-libs/libpcre2[jit] )
160 + )
161 + ssl? (
162 + !libressl? ( dev-libs/openssl:0=[zlib?] )
163 + libressl? ( dev-libs/libressl:0= )
164 + )
165 + slz? ( dev-libs/libslz:= )
166 + zlib? ( sys-libs/zlib )
167 + lua? ( dev-lang/lua:5.3 )
168 + device-atlas? ( dev-libs/device-atlas-api-c )"
169 +RDEPEND="${DEPEND}"
170 +
171 +S="${WORKDIR}/${MY_P}"
172 +
173 +DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
174 +version_is_at_least 1.7.0 $PV && PATCHES=( "${FILESDIR}"/haproxy-1.7-contrib.patch )
175 +version_is_at_least 1.8.0 $PV && PATCHES=( "${FILESDIR}"/haproxy-1.8-contrib.patch )
176 +CONTRIBS=( halog iprange )
177 +# ip6range is present in 1.6, but broken.
178 +version_is_at_least 1.7.0 $PV && CONTRIBS+=( ip6range spoa_example tcploop )
179 +# TODO: mod_defender - requires apache / APR, modsecurity - the same
180 +version_is_at_least 1.8.0 $PV && CONTRIBS+=( hpack )
181 +
182 +haproxy_use() {
183 + (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
184 +
185 + usex "${1}" "USE_${2}=1" "USE_${2}="
186 +}
187 +
188 +pkg_setup() {
189 + enewgroup haproxy
190 + enewuser haproxy -1 -1 -1 haproxy
191 +
192 + if use net_ns; then
193 + CONFIG_CHECK="~NET_NS"
194 + linux-info_pkg_setup
195 + fi
196 +}
197 +
198 +src_compile() {
199 + local -a args=(
200 + TARGET=linux2628
201 + USE_GETADDRINFO=1
202 + USE_TFO=1
203 + )
204 +
205 + # TODO: PCRE2_WIDTH?
206 + args+=( $(haproxy_use threads THREAD) )
207 + args+=( $(haproxy_use crypt LIBCRYPT) )
208 + args+=( $(haproxy_use net_ns NS) )
209 + args+=( $(haproxy_use pcre PCRE) )
210 + args+=( $(haproxy_use pcre-jit PCRE_JIT) )
211 + args+=( $(haproxy_use ssl OPENSSL) )
212 + args+=( $(haproxy_use slz SLZ) )
213 + args+=( $(haproxy_use zlib ZLIB) )
214 + args+=( $(haproxy_use lua LUA) )
215 + args+=( $(haproxy_use 51degrees 51DEGREES) )
216 + args+=( $(haproxy_use device-atlas DEVICEATLAS) )
217 + args+=( $(haproxy_use wurfl WURFL) )
218 + args+=( $(haproxy_use systemd SYSTEMD) )
219 +
220 + # For now, until the strict-aliasing breakage will be fixed
221 + append-cflags -fno-strict-aliasing
222 +
223 + emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
224 + emake -C contrib/systemd SBINDIR=/usr/sbin
225 +
226 + if use tools ; then
227 + for contrib in ${CONTRIBS[@]} ; do
228 + emake -C contrib/${contrib} \
229 + CFLAGS="${CFLAGS}" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
230 + done
231 + fi
232 +}
233 +
234 +src_install() {
235 + dosbin haproxy
236 + dosym /usr/sbin/haproxy /usr/bin/haproxy
237 +
238 + newconfd "${FILESDIR}/${PN}.confd" $PN
239 + newinitd "${FILESDIR}/${PN}.initd-r6" $PN
240 +
241 + doman doc/haproxy.1
242 +
243 + systemd_dounit contrib/systemd/haproxy.service
244 +
245 + einstalldocs
246 +
247 + # The errorfiles are used by upstream defaults.
248 + insinto /etc/haproxy/errors/
249 + doins examples/errorfiles/*
250 +
251 + if use doc; then
252 + dodoc ROADMAP doc/*.txt
253 + #if use lua; then
254 + # TODO: doc/lua-api/
255 + #fi
256 + fi
257 +
258 + if use tools ; then
259 + has halog "${CONTRIBS[@]}" && dobin contrib/halog/halog
260 + has "iprange" "${CONTRIBS[@]}" && newbin contrib/iprange/iprange haproxy_iprange
261 + has "ip6range" "${CONTRIBS[@]}" && newbin contrib/ip6range/ip6range haproxy_ip6range
262 + has "spoa_example" "${CONTRIBS[@]}" && newbin contrib/spoa_example/spoa haproxy_spoa_example
263 + has "spoa_example" "${CONTRIBS[@]}" && newdoc contrib/spoa_example/README README.spoa_example
264 + has "tcploop" "${CONTRIBS[@]}" && newbin contrib/tcploop/tcploop haproxy_tcploop
265 + has "hpack" "${CONTRIBS[@]}" && newbin contrib/hpack/gen-rht haproxy_hpack
266 + fi
267 +
268 + if use examples ; then
269 + docinto examples
270 + dodoc examples/*.cfg
271 + dodoc examples/seamless_reload.txt
272 + fi
273 +
274 + if use vim-syntax ; then
275 + insinto /usr/share/vim/vimfiles/syntax
276 + doins examples/haproxy.vim
277 + fi
278 +}
279 +
280 +pkg_postinst() {
281 + if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
282 + ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
283 + ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
284 + ewarn "Make use of them with the \"user\" and \"group\" directives."
285 +
286 + if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
287 + einfo "Please consult the installed documentation for learning the configuration file's syntax."
288 + einfo "The documentation and sample configuration files are installed here:"
289 + einfo " ${EROOT}usr/share/doc/${PF}"
290 + fi
291 + fi
292 +}
293
294 diff --git a/net-proxy/haproxy/metadata.xml b/net-proxy/haproxy/metadata.xml
295 index 017b2b8ad09..6a09dde73e2 100644
296 --- a/net-proxy/haproxy/metadata.xml
297 +++ b/net-proxy/haproxy/metadata.xml
298 @@ -21,6 +21,8 @@
299 <use>
300 <flag name="net_ns">Enable network namespace support (CONFIG_NET_NS)</flag>
301 <flag name="pcre-jit">Use JIT support for PCRE</flag>
302 + <flag name="pcre2">Enable PCRE2 RegEx support</flag>
303 + <flag name="pcre2-jit">Use JIT support for PCRE2</flag>
304 <flag name="slz">Use <pkg>dev-libs/libslz</pkg> compression library</flag>
305 <flag name="tools">Install additional tools (halog, iprange)</flag>
306 <flag name="device-atlas">Use <pkg>dev-libs/device-atlas-api-c</pkg> library</flag>