| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
PYTHON_COMPAT=( python3_{10..13} )
|
| 7 |
|
inherit llvm.org python-r1
|
|
6 |
inherit autotools systemd toolchain-funcs
|
| 8 |
7 |
|
| 9 |
|
DESCRIPTION="Python bindings for llvm-core/clang"
|
| 10 |
|
HOMEPAGE="https://llvm.org/"
|
|
8 |
[ "${PV##*_}" = "beta" ] &&
|
|
9 |
PRIVOXY_STATUS="beta" ||
|
|
10 |
PRIVOXY_STATUS="stable"
|
| 11 |
11 |
|
| 12 |
|
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
|
|
12 |
DESCRIPTION="A web proxy with advanced filtering capabilities for enhancing privacy"
|
|
13 |
HOMEPAGE="https://www.privoxy.org https://sourceforge.net/projects/ijbswa/"
|
|
14 |
SRC_URI="https://downloads.sourceforge.net/ijbswa/${P%_*}-${PRIVOXY_STATUS}-src.tar.gz"
|
|
15 |
|
|
16 |
S="${WORKDIR}/${P%_*}-${PRIVOXY_STATUS}"
|
|
17 |
|
|
18 |
LICENSE="GPL-2+"
|
| 13 |
19 |
SLOT="0"
|
| 14 |
|
KEYWORDS="amd64 ~arm arm64 ~x86"
|
| 15 |
|
IUSE="test"
|
| 16 |
|
RESTRICT="!test? ( test )"
|
| 17 |
|
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
|
20 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
|
|
21 |
IUSE="+acl brotli client-tags compression editor extended-host-patterns
|
|
22 |
extended-statistics external-filters +fast-redirects +force fuzz
|
|
23 |
graceful-termination +image-blocking ipv6 +jit lfs +mbedtls openssl
|
|
24 |
png-images sanitize selinux ssl +stats +threads toggle tools whitelists
|
|
25 |
+zlib"
|
| 18 |
26 |
|
| 19 |
|
# The module is opening libclang.so directly, and doing some blasphemy
|
| 20 |
|
# on top of it.
|
| 21 |
27 |
DEPEND="
|
| 22 |
|
>=llvm-core/clang-${PV}:*
|
| 23 |
|
!llvm-core/llvm:0[clang(-),python(-)]
|
| 24 |
|
!llvm-core/clang:0[python(-)]
|
| 25 |
|
"
|
| 26 |
|
RDEPEND="
|
| 27 |
|
${DEPEND}
|
| 28 |
|
${PYTHON_DEPS}
|
|
28 |
acct-group/privoxy
|
|
29 |
acct-user/privoxy
|
|
30 |
dev-libs/libpcre2
|
|
31 |
brotli? ( app-arch/brotli )
|
|
32 |
ssl? (
|
|
33 |
mbedtls? ( net-libs/mbedtls:0= )
|
|
34 |
openssl? ( dev-libs/openssl:= )
|
|
35 |
)
|
|
36 |
zlib? ( sys-libs/zlib:= )
|
| 29 |
37 |
"
|
| 30 |
|
BDEPEND="
|
| 31 |
|
${PYTHON_DEPS}
|
| 32 |
|
test? (
|
| 33 |
|
llvm-core/clang:${LLVM_MAJOR}
|
|
38 |
RDEPEND="${DEPEND}
|
|
39 |
extended-host-patterns? ( dev-lang/perl )
|
|
40 |
selinux? ( sec-policy/selinux-privoxy )
|
|
41 |
tools? (
|
|
42 |
net-misc/curl
|
|
43 |
dev-lang/perl
|
| 34 |
44 |
)
|
| 35 |
45 |
"
|
|
46 |
REQUIRED_USE="
|
|
47 |
brotli? ( zlib )
|
|
48 |
client-tags? ( threads )
|
|
49 |
compression? ( zlib )
|
|
50 |
extended-statistics? ( threads )
|
|
51 |
fuzz? ( zlib )
|
|
52 |
ssl? ( ^^ ( mbedtls openssl ) threads )
|
|
53 |
toggle? ( editor )
|
|
54 |
"
|
| 36 |
55 |
|
| 37 |
|
LLVM_COMPONENTS=( clang/bindings/python )
|
| 38 |
|
llvm.org_set_globals
|
|
56 |
PATCHES=(
|
|
57 |
"${FILESDIR}"/${PN}-3.0.32-gentoo.patch
|
|
58 |
"${FILESDIR}"/${PN}-3.0.28-strip.patch
|
|
59 |
)
|
|
60 |
|
|
61 |
pkg_pretend() {
|
|
62 |
if ! use threads; then
|
|
63 |
ewarn
|
|
64 |
ewarn "Privoxy may be very slow without threads support, consider enabling it."
|
|
65 |
ewarn "See also https://www.privoxy.org/faq/trouble.html#GENTOO-RICERS"
|
|
66 |
ewarn "Additionally some features may not build or work poperly. You are on your own."
|
|
67 |
ewarn
|
|
68 |
fi
|
|
69 |
}
|
| 39 |
70 |
|
| 40 |
|
python_test() {
|
| 41 |
|
# tests rely on results from a specific clang version, so override
|
| 42 |
|
# the search path
|
| 43 |
|
local -x CLANG_LIBRARY_PATH=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)
|
| 44 |
|
local -x CLANG_NO_DEFAULT_CONFIG=1
|
| 45 |
|
"${EPYTHON}" -m unittest discover -v || die "Tests fail with ${EPYTHON}"
|
|
71 |
src_prepare() {
|
|
72 |
default
|
|
73 |
mv configure.in configure.ac || die
|
|
74 |
sed -i "s|/p\.p/|/config.privoxy.org/|g" tools/privoxy-regression-test.pl || die
|
|
75 |
|
|
76 |
# autoreconf needs to be called even if we don't modify any autotools source files
|
|
77 |
# See main makefile
|
|
78 |
eautoreconf
|
| 46 |
79 |
}
|
| 47 |
80 |
|
| 48 |
|
src_test() {
|
| 49 |
|
python_foreach_impl python_test
|
|
81 |
src_configure() {
|
|
82 |
local myconf="--without-mbedtls --without-openssl"
|
|
83 |
if use ssl; then
|
|
84 |
myconf="$(use_with mbedtls) $(use_with openssl)"
|
|
85 |
fi
|
|
86 |
if use sanitize; then
|
|
87 |
myconf+=" --with-usan"
|
|
88 |
# msan is available in clang only
|
|
89 |
# asan is broken with current configure tests in gcc
|
|
90 |
tc-is-clang && myconf+=" --with-msan --with-asan"
|
|
91 |
fi
|
|
92 |
|
|
93 |
# --with-debug only enables debug CFLAGS
|
|
94 |
# --with-docbook and --with-db2html and their deps are useless,
|
|
95 |
# since docs are already pregenerated in the source tarball
|
|
96 |
econf \
|
|
97 |
--sysconfdir=/etc/privoxy \
|
|
98 |
--disable-accept-filter \
|
|
99 |
--enable-dynamic-pcre \
|
|
100 |
--enable-pcre2 \
|
|
101 |
--without-assertions \
|
|
102 |
--with-user=privoxy \
|
|
103 |
--with-group=privoxy \
|
|
104 |
$(use_enable acl acl-support) \
|
|
105 |
$(use_enable compression) \
|
|
106 |
$(use_enable client-tags) \
|
|
107 |
$(use_enable editor) \
|
|
108 |
$(use_enable extended-host-patterns pcre-host-patterns) \
|
|
109 |
$(use_enable extended-statistics) \
|
|
110 |
$(use_enable fast-redirects) \
|
|
111 |
$(use_enable force) \
|
|
112 |
$(use_enable fuzz) \
|
|
113 |
$(use_enable graceful-termination) \
|
|
114 |
$(use_enable image-blocking) \
|
|
115 |
$(use_enable jit pcre-jit-compilation) \
|
|
116 |
$(use_enable ipv6 ipv6-support) \
|
|
117 |
$(use_enable lfs large-file-support) \
|
|
118 |
$(use_enable png-images no-gifs) \
|
|
119 |
$(use_enable stats) \
|
|
120 |
$(use_enable threads pthread) \
|
|
121 |
$(use_enable toggle) \
|
|
122 |
$(use_enable whitelists trust-files) \
|
|
123 |
$(use_enable zlib) \
|
|
124 |
$(use_with brotli) \
|
|
125 |
${myconf}
|
| 50 |
126 |
}
|
| 51 |
127 |
|
| 52 |
128 |
src_install() {
|
| 53 |
|
python_foreach_impl python_domodule clang
|
|
129 |
default
|
|
130 |
|
|
131 |
newinitd "${FILESDIR}/privoxy.initd-3" privoxy
|
|
132 |
systemd_dounit "${FILESDIR}"/${PN}.service
|
|
133 |
|
|
134 |
insinto /etc/logrotate.d
|
|
135 |
newins "${FILESDIR}/privoxy.logrotate" privoxy
|
|
136 |
|
|
137 |
diropts -m 0750 -g privoxy -o privoxy
|
|
138 |
keepdir /var/log/privoxy
|
|
139 |
|
|
140 |
use extended-host-patterns && newbin tools/url-pattern-translator.pl privoxy-url-pattern-translator.pl
|
|
141 |
if use tools; then
|
|
142 |
dobin tools/{privoxy-log-parser.pl,privoxy-regression-test.pl}
|
|
143 |
newbin tools/uagen.pl privoxy-uagen.pl
|
|
144 |
fi
|
|
145 |
|
|
146 |
rmdir "${ED}/var/run" || die
|
|
147 |
chown privoxy:root "${ED}/etc/privoxy" || die
|
|
148 |
}
|
|
149 |
|
|
150 |
pkg_postinst() {
|
|
151 |
if use extended-host-patterns; then
|
|
152 |
ewarn
|
|
153 |
ewarn "You enabled extended-host-patterns, now you *must* convert all action files in"
|
|
154 |
ewarn "PCRE-compatible format, or privoxy will fail to start. Helper tool"
|
|
155 |
ewarn "privoxy-url-pattern-translator.pl is available."
|
|
156 |
ewarn
|
|
157 |
fi
|
| 54 |
158 |
}
|