summaryrefslogtreecommitdiff
blob: abdc192cc4c4df2184dbb4f89dcb0974fee6078e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools systemd tmpfiles

COMMIT=31339cb1615765f2fbb4ec7779400535bad6da46

DESCRIPTION="A lightweight HTTP/SSL proxy"
HOMEPAGE="https://github.com/tinyproxy/tinyproxy/"
SRC_URI="https://github.com/tinyproxy/tinyproxy/archive/${COMMIT}.tar.gz -> ${PN}-${COMMIT}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm ppc ~sparc x86"

IUSE="test debug +filter-proxy reverse-proxy transparent-proxy
+upstream-proxy +xtinyproxy-header"
RESTRICT="!test? ( test )"
REQUIRED_USE="test? ( xtinyproxy-header )"

S="${WORKDIR}"/${PN}-${COMMIT}

DEPEND="
	acct-group/tinyproxy
	acct-user/tinyproxy
"

RDEPEND="${DEPEND}"

src_prepare() {
	default

	sed -i \
		-e "s|nobody|${PN}|g" \
		etc/${PN}.conf.in || die "sed failed"

	sed -i -e "s# -Wp,-D_FORTIFY_SOURCE=2##" configure.ac || die "sed failed"

	eautoreconf
}

src_configure() {
	econf \
		$(use_enable debug) \
		$(use_enable filter-proxy filter) \
		$(use_enable reverse-proxy reverse) \
		$(use_enable transparent-proxy transparent) \
		$(use_enable upstream-proxy upstream) \
		$(use_enable xtinyproxy-header xtinyproxy) \
		--localstatedir=/var
}

src_test() {
	# The make check target does not run the test suite
	emake test
}

src_install() {
	default

	dodoc AUTHORS ChangeLog NEWS README TODO

	diropts -m0775 -o ${PN} -g ${PN}
	keepdir /var/log/${PN}

	newinitd "${FILESDIR}"/${PN}-1.10.0.initd tinyproxy
	systemd_newunit "${FILESDIR}"/${PN}-1.10.0.service tinyproxy.service
	dotmpfiles "${FILESDIR}"/${PN}.tmpfiles.conf
}

pkg_postinst() {
	tmpfiles_process ${PN}.tmpfiles.conf

	elog "For filtering domains and URLs, enable filter option in the configuration"
	elog "file and add them to the filter file (one domain or URL per line)."
}