*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / www-servers / varnish / varnish-4.1.8.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 PYTHON_COMPAT=( python2_7 )
7
8 inherit user autotools systemd python-r1
9
10 DESCRIPTION="Varnish is a state-of-the-art, high-performance HTTP accelerator"
11 HOMEPAGE="https://varnish-cache.org/"
12 SRC_URI="http://varnish-cache.org/_downloads/${P}.tgz"
13
14 LICENSE="BSD-2 GPL-2"
15 SLOT="0"
16 KEYWORDS="amd64 ~mips ~ppc ~ppc64 x86"
17 IUSE="jemalloc jit static-libs"
18
19 CDEPEND="
20         sys-libs/readline:0=
21         dev-libs/libpcre[jit?]
22         jemalloc? ( dev-libs/jemalloc )
23         sys-libs/ncurses:0="
24
25 #varnish compiles stuff at run time
26 RDEPEND="
27         ${PYTHON_DEPS}
28         ${CDEPEND}
29         sys-devel/gcc"
30
31 DEPEND="
32         ${CDEPEND}
33         dev-python/docutils
34         virtual/pkgconfig"
35
36 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
37
38 RESTRICT="test" #315725
39
40 pkg_setup() {
41         ebegin "Creating varnish user and group"
42         enewgroup varnish
43         enewuser varnish -1 -1 /var/lib/varnish varnish
44         eend $?
45 }
46
47 src_prepare() {
48         # Remove bundled libjemalloc. We also fix
49         # automagic dep in our patches, bug #461638
50         rm -rf lib/libjemalloc
51
52         # Fix bug #620952
53         eapply "${FILESDIR}"/fix-build-x86.patch
54
55         # Remove -Werror bug #528354
56         sed -i -e 's/-Werror\([^=]\)/\1/g' configure.ac
57
58         eapply_user
59
60         eautoreconf
61 }
62
63 src_configure() {
64         econf \
65                 $(use_enable static-libs static) \
66                 $(use_enable jit pcre-jit ) \
67                 $(use_with jemalloc)
68 }
69
70 src_install() {
71         emake DESTDIR="${D}" install
72
73         python_replicate_script "${D}/usr/share/varnish/vmodtool.py"
74
75         newinitd "${FILESDIR}"/varnishlog.initd varnishlog
76         newconfd "${FILESDIR}"/varnishlog.confd varnishlog
77
78         newinitd "${FILESDIR}"/varnishncsa.initd varnishncsa
79         newconfd "${FILESDIR}"/varnishncsa.confd varnishncsa
80
81         newinitd "${FILESDIR}"/varnishd.initd-r4 varnishd
82         newconfd "${FILESDIR}"/varnishd.confd-r4 varnishd
83
84         insinto /etc/logrotate.d/
85         newins "${FILESDIR}/varnishd.logrotate-r2" varnishd
86
87         diropts -m750
88
89         dodir /var/log/varnish/
90
91         systemd_dounit "${FILESDIR}/${PN}d.service"
92
93         insinto /etc/varnish/
94         doins lib/libvmod_std/vmod.vcc
95         doins etc/example.vcl
96
97         dodoc README.rst
98         dodoc doc/changes.rst
99
100         fowners root:varnish /etc/varnish/
101         fowners varnish:varnish /var/lib/varnish/
102         fperms 0750 /var/lib/varnish/ /etc/varnish/
103 }