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/
Date: Fri, 24 Apr 2020 09:17:16
Message-Id: 1587719815.208824c4f763c224560f65427413a1c6a4bf6bb5.idl0r@gentoo
1 commit: 208824c4f763c224560f65427413a1c6a4bf6bb5
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Fri Feb 21 06:08:46 2020 +0000
4 Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 24 09:16:55 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=208824c4
7
8 net-proxy/haproxy: add revision with GLEP81 group/user packages
9
10 Bug: https://bugs.gentoo.org/701218
11 Package-Manager: Portage-2.3.85, Repoman-2.3.20
12 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
13 Signed-off-by: Christian Ruppert <idl0r <AT> gentoo.org>
14
15 net-proxy/haproxy/haproxy-2.1.3-r1.ebuild | 175 ++++++++++++++++++++++++++++++
16 1 file changed, 175 insertions(+)
17
18 diff --git a/net-proxy/haproxy/haproxy-2.1.3-r1.ebuild b/net-proxy/haproxy/haproxy-2.1.3-r1.ebuild
19 new file mode 100644
20 index 00000000000..b639eeee5f5
21 --- /dev/null
22 +++ b/net-proxy/haproxy/haproxy-2.1.3-r1.ebuild
23 @@ -0,0 +1,175 @@
24 +# Copyright 1999-2020 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI="7"
28 +
29 +[[ ${PV} == *9999 ]] && SCM="git-r3"
30 +inherit toolchain-funcs flag-o-matic systemd linux-info $SCM
31 +
32 +MY_P="${PN}-${PV/_beta/-dev}"
33 +
34 +DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
35 +HOMEPAGE="http://www.haproxy.org"
36 +if [[ ${PV} != *9999 ]]; then
37 + SRC_URI="http://haproxy.1wt.eu/download/$(ver_cut 1-2)/src/${MY_P}.tar.gz"
38 + KEYWORDS="~amd64 ~arm ~ppc ~x86"
39 +else
40 + EGIT_REPO_URI="http://git.haproxy.org/git/haproxy-$(ver_cut 1-2).git/"
41 + EGIT_BRANCH=master
42 +fi
43 +
44 +LICENSE="GPL-2 LGPL-2.1"
45 +SLOT="0"
46 +IUSE="+crypt doc examples libressl slz +net_ns +pcre pcre-jit pcre2 pcre2-jit prometheus-exporter
47 +ssl systemd +threads tools vim-syntax +zlib lua device-atlas 51degrees wurfl"
48 +REQUIRED_USE="pcre-jit? ( pcre )
49 + pcre2-jit? ( pcre2 )
50 + pcre? ( !pcre2 )
51 + device-atlas? ( pcre )
52 + ?? ( slz zlib )"
53 +
54 +DEPEND="
55 + pcre? (
56 + dev-libs/libpcre
57 + pcre-jit? ( dev-libs/libpcre[jit] )
58 + )
59 + pcre2? (
60 + dev-libs/libpcre
61 + pcre2-jit? ( dev-libs/libpcre2[jit] )
62 + )
63 + ssl? (
64 + !libressl? ( dev-libs/openssl:0=[zlib?] )
65 + libressl? ( dev-libs/libressl:0= )
66 + )
67 + slz? ( dev-libs/libslz:= )
68 + zlib? ( sys-libs/zlib )
69 + lua? ( dev-lang/lua:5.3 )
70 + device-atlas? ( dev-libs/device-atlas-api-c )"
71 +RDEPEND="${DEPEND}
72 + acct-group/haproxy
73 + acct-user/haproxy"
74 +
75 +S="${WORKDIR}/${MY_P}"
76 +
77 +DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
78 +CONTRIBS=( halog iprange )
79 +# ip6range is present in 1.6, but broken.
80 +ver_test $PV -ge 1.7.0 && CONTRIBS+=( ip6range spoa_example tcploop )
81 +# TODO: mod_defender - requires apache / APR, modsecurity - the same
82 +ver_test $PV -ge 1.8.0 && CONTRIBS+=( hpack )
83 +
84 +haproxy_use() {
85 + (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"
86 +
87 + usex "${1}" "USE_${2}=1" "USE_${2}="
88 +}
89 +
90 +pkg_setup() {
91 + if use net_ns; then
92 + CONFIG_CHECK="~NET_NS"
93 + linux-info_pkg_setup
94 + fi
95 +}
96 +
97 +src_compile() {
98 + local -a args=(
99 + V=1
100 + TARGET=linux-glibc
101 + )
102 +
103 + # TODO: PCRE2_WIDTH?
104 + args+=( $(haproxy_use threads THREAD) )
105 + args+=( $(haproxy_use crypt LIBCRYPT) )
106 + args+=( $(haproxy_use net_ns NS) )
107 + args+=( $(haproxy_use pcre PCRE) )
108 + args+=( $(haproxy_use pcre-jit PCRE_JIT) )
109 + args+=( $(haproxy_use pcre2 PCRE2) )
110 + args+=( $(haproxy_use pcre2-jit PCRE2_JIT) )
111 + args+=( $(haproxy_use ssl OPENSSL) )
112 + args+=( $(haproxy_use slz SLZ) )
113 + args+=( $(haproxy_use zlib ZLIB) )
114 + args+=( $(haproxy_use lua LUA) )
115 + args+=( $(haproxy_use 51degrees 51DEGREES) )
116 + args+=( $(haproxy_use device-atlas DEVICEATLAS) )
117 + args+=( $(haproxy_use wurfl WURFL) )
118 + args+=( $(haproxy_use systemd SYSTEMD) )
119 +
120 + # For now, until the strict-aliasing breakage will be fixed
121 + append-cflags -fno-strict-aliasing
122 +
123 + if use prometheus-exporter; then
124 + EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
125 + fi
126 +
127 + # HAProxy really needs some of those "SPEC_CFLAGS", like -fno-strict-aliasing
128 + emake CFLAGS="${CFLAGS} \$(SPEC_CFLAGS)" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) EXTRA_OBJS="${EXTRA_OBJS}" ${args[@]}
129 + emake -C contrib/systemd SBINDIR=/usr/sbin
130 +
131 + if use tools ; then
132 + for contrib in ${CONTRIBS[@]} ; do
133 + # Those two includes are a workaround for hpack Makefile missing those
134 + emake -C contrib/${contrib} \
135 + CFLAGS="${CFLAGS} -I../../include/ -I../../ebtree/" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args[@]}
136 + done
137 + fi
138 +}
139 +
140 +src_install() {
141 + dosbin haproxy
142 + dosym ../sbin/haproxy /usr/bin/haproxy
143 +
144 + newconfd "${FILESDIR}/${PN}.confd" $PN
145 + newinitd "${FILESDIR}/${PN}.initd-r6" $PN
146 +
147 + doman doc/haproxy.1
148 +
149 + systemd_dounit contrib/systemd/haproxy.service
150 +
151 + einstalldocs
152 +
153 + # The errorfiles are used by upstream defaults.
154 + insinto /etc/haproxy/errors/
155 + doins examples/errorfiles/*
156 +
157 + if use doc; then
158 + dodoc ROADMAP doc/*.txt
159 + #if use lua; then
160 + # TODO: doc/lua-api/
161 + #fi
162 + fi
163 +
164 + if use tools ; then
165 + has halog "${CONTRIBS[@]}" && dobin contrib/halog/halog
166 + has "iprange" "${CONTRIBS[@]}" && newbin contrib/iprange/iprange haproxy_iprange
167 + has "ip6range" "${CONTRIBS[@]}" && newbin contrib/ip6range/ip6range haproxy_ip6range
168 + has "spoa_example" "${CONTRIBS[@]}" && newbin contrib/spoa_example/spoa haproxy_spoa_example
169 + has "spoa_example" "${CONTRIBS[@]}" && newdoc contrib/spoa_example/README README.spoa_example
170 + has "tcploop" "${CONTRIBS[@]}" && newbin contrib/tcploop/tcploop haproxy_tcploop
171 + has "hpack" "${CONTRIBS[@]}" && newbin contrib/hpack/gen-rht haproxy_hpack
172 + fi
173 +
174 + if use examples ; then
175 + docinto examples
176 + dodoc examples/*.cfg
177 + dodoc doc/seamless_reload.txt
178 + fi
179 +
180 + if use vim-syntax ; then
181 + insinto /usr/share/vim/vimfiles/syntax
182 + doins contrib/syntax-highlight/haproxy.vim
183 + fi
184 +}
185 +
186 +pkg_postinst() {
187 + if [[ ! -f "${EROOT}/etc/haproxy/haproxy.cfg" ]] ; then
188 + ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
189 + ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
190 + ewarn "Make use of them with the \"user\" and \"group\" directives."
191 +
192 + if [[ -d "${EROOT}/usr/share/doc/${PF}" ]]; then
193 + einfo "Please consult the installed documentation for learning the configuration file's syntax."
194 + einfo "The documentation and sample configuration files are installed here:"
195 + einfo " ${EROOT}/usr/share/doc/${PF}"
196 + fi
197 + fi
198 +}