9dc0d538f5a8904901f7d2137ba9944e9f698255
[gentoo.git] / net-proxy / tinyproxy / tinyproxy-1.10.0-r1.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 inherit autotools systemd tmpfiles user
7
8 DESCRIPTION="A lightweight HTTP/SSL proxy"
9 HOMEPAGE="https://github.com/tinyproxy/tinyproxy/"
10 SRC_URI="https://github.com/tinyproxy/tinyproxy/releases/download/${PV}/${P}.tar.xz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 ~arm ia64 ppc ~sparc x86"
15
16 IUSE="test debug +filter-proxy reverse-proxy transparent-proxy
17 +upstream-proxy +xtinyproxy-header"
18 RESTRICT="!test? ( test )"
19
20 REQUIRED_USE="test? ( xtinyproxy-header )"
21
22 pkg_setup() {
23         enewgroup ${PN}
24         enewuser ${PN} "" "" "" ${PN}
25 }
26
27 src_prepare() {
28         default
29
30         sed -i \
31                 -e "s|nobody|${PN}|g" \
32                 etc/${PN}.conf.in || die "sed failed"
33
34         eautoreconf
35 }
36
37 src_configure() {
38         econf \
39                 $(use_enable debug) \
40                 $(use_enable filter-proxy filter) \
41                 $(use_enable reverse-proxy reverse) \
42                 $(use_enable transparent-proxy transparent) \
43                 $(use_enable upstream-proxy upstream) \
44                 $(use_enable xtinyproxy-header xtinyproxy) \
45                 --disable-silent-rules \
46                 --localstatedir=/var
47 }
48
49 src_test() {
50         # The make check target does not run the test suite
51         emake test
52 }
53
54 src_install() {
55         default
56
57         dodoc AUTHORS ChangeLog NEWS README TODO
58
59         diropts -m0775 -o ${PN} -g ${PN}
60         keepdir /var/log/${PN}
61
62         newinitd "${FILESDIR}"/${PN}-1.10.0.initd tinyproxy
63         systemd_newunit "${FILESDIR}"/${PN}-1.10.0.service tinyproxy.service
64         systemd_dotmpfilesd "${FILESDIR}"/${PN}.tmpfiles.conf
65 }
66
67 pkg_postinst() {
68         tmpfiles_process ${PN}.tmpfiles.conf
69
70         elog "For filtering domains and URLs, enable filter option in the configuration"
71         elog "file and add them to the filter file (one domain or URL per line)."
72 }