blob: d42c2f72d9a61bf94365f9261c41a80da1c7f3d7 (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_1{1..3} )
inherit python-any-r1 cmake
DESCRIPTION="BPF-based packet filtering framework"
HOMEPAGE="
https://bpfilter.io/
https://github.com/facebook/bpfilter
"
SRC_URI="https://github.com/facebook/bpfilter/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+"
SLOT="0/0"
KEYWORDS="~amd64"
IUSE="doc test"
RESTRICT="!test? ( test )"
# tests need root access
RESTRICT+=" test"
DEPEND="
dev-libs/libbpf:=
dev-libs/libnl:3=
test? (
dev-util/cmocka
)
"
RDEPEND="${DEPEND}"
BDEPEND="
sys-devel/bison
sys-devel/flex
doc? (
app-text/doxygen
$(python_gen_any_dep '
dev-python/sphinx[${PYTHON_USEDEP}]
dev-python/linuxdoc[${PYTHON_USEDEP}]
dev-python/breathe[${PYTHON_USEDEP}]
dev-python/furo[${PYTHON_USEDEP}]
')
)
test? (
$(python_gen_any_dep '
net-analyzer/scapy[${PYTHON_USEDEP}]
')
)
"
PATCHES=(
"${FILESDIR}/bpfilter-0.6.0-no-coverage.patch"
)
DOCS=(
CONTRIBUTING.md
README.md
)
pkg_setup() {
(use test || use doc) && python-any-r1_pkg_setup
}
python_check_deps() {
local -a atoms
if use doc; then
python_has_version \
"dev-python/sphinx[${PYTHON_USEDEP}]" \
"dev-python/breathe[${PYTHON_USEDEP}]" \
"dev-python/linuxdoc[${PYTHON_USEDEP}]" \
"dev-python/furo[${PYTHON_USEDEP}]" \
|| return
fi
if use test; then
python_has_version \
"net-analyzer/scapy[${PYTHON_USEDEP}]" \
|| return
fi
}
src_prepare() {
sed -e '/get_version_from_git/ d' -i CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
local CMAKE_BUILD_TYPE=release
local -a mycmakeargs=(
-DNO_CHECKS=ON
-DNO_BENCHMARKS=ON
-DDEFAULT_PROJECT_VERSION="${PV}"
-DNO_DOCS=$(usex doc 'OFF' 'ON')
-DNO_TESTS=$(usex test 'OFF' 'ON')
)
cmake_src_configure
}
src_compile() {
cmake_src_compile
use doc && cmake_build doc
}
src_test() {
cmake_src_test
cmake_build e2e || die "tests failed"
}
src_install() {
cmake_src_install
use doc && dodoc -r "${BUILD_DIR}/doc/"{ht,x}ml
}
|