Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bcc/
Date: Thu, 06 Jan 2022 18:50:35
Message-Id: 1641495027.b3b55edd079bd584a8051be35c6c313d562966f6.chutzpah@gentoo
1 commit: b3b55edd079bd584a8051be35c6c313d562966f6
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 6 18:50:21 2022 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 6 18:50:27 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3b55edd
7
8 dev-util/bcc: Revbump, rename "trace" tool (bug #828438)
9
10 Closes: https://bugs.gentoo.org/828438
11 Package-Manager: Portage-3.0.30, Repoman-3.0.3
12 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
13
14 dev-util/bcc/bcc-0.23.0-r4.ebuild | 132 ++++++++++++++++++++++++++++++++++++++
15 1 file changed, 132 insertions(+)
16
17 diff --git a/dev-util/bcc/bcc-0.23.0-r4.ebuild b/dev-util/bcc/bcc-0.23.0-r4.ebuild
18 new file mode 100644
19 index 000000000000..4f45cf6e2a90
20 --- /dev/null
21 +++ b/dev-util/bcc/bcc-0.23.0-r4.ebuild
22 @@ -0,0 +1,132 @@
23 +# Copyright 1999-2022 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +
28 +LUA_COMPAT=( luajit )
29 +PYTHON_COMPAT=( python3_{7..10} )
30 +LLVM_MAX_SLOT=13
31 +
32 +inherit cmake eapi8-dosym linux-info llvm lua-single python-r1 toolchain-funcs
33 +
34 +DESCRIPTION="Tools for BPF-based Linux IO analysis, networking, monitoring, and more"
35 +HOMEPAGE="https://iovisor.github.io/bcc/"
36 +SRC_URI="https://github.com/iovisor/bcc/archive/v${PV}.tar.gz -> ${P}.tar.gz"
37 +
38 +LICENSE="Apache-2.0"
39 +SLOT="0"
40 +KEYWORDS="~amd64 ~arm64 ~x86"
41 +IUSE="+lua test"
42 +REQUIRED_USE="${PYTHON_REQUIRED_USE}
43 + lua? ( ${LUA_REQUIRED_USE} )"
44 +# tests need root access
45 +RESTRICT="test"
46 +
47 +RDEPEND="
48 + >=dev-libs/elfutils-0.166:=
49 + >=dev-libs/libbpf-0.5.0:=[static-libs(-)]
50 + sys-kernel/linux-headers
51 + <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
52 + <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)]
53 + ${PYTHON_DEPS}
54 + lua? ( ${LUA_DEPS} )
55 +"
56 +DEPEND="${RDEPEND}
57 + test? (
58 + || (
59 + net-misc/iputils[arping]
60 + net-analyzer/arping
61 + )
62 + net-analyzer/netperf
63 + net-misc/iperf:*
64 + )
65 +"
66 +BDEPEND="
67 + virtual/pkgconfig
68 +"
69 +
70 +PATCHES=(
71 + "${FILESDIR}/bcc-0.9.0-no-luajit-automagic-dep.patch"
72 + "${FILESDIR}/bcc-0.14.0-cmakelists.patch"
73 + "${FILESDIR}/bcc-0.23.0-man-compress.patch"
74 +)
75 +
76 +pkg_pretend() {
77 + local CONFIG_CHECK="~BPF ~BPF_SYSCALL ~NET_CLS_BPF ~NET_ACT_BPF
78 + ~HAVE_EBPF_JIT ~BPF_EVENTS ~DEBUG_INFO ~FUNCTION_TRACER ~KALLSYMS_ALL
79 + ~KPROBES"
80 +
81 + check_extra_config
82 +}
83 +
84 +pkg_setup() {
85 + llvm_pkg_setup
86 + python_setup
87 +}
88 +
89 +src_prepare() {
90 + local bpf_link_path
91 +
92 + # this avoids bundling
93 + bpf_link_path="$(realpath --relative-to="${S}/src/cc/libbpf" /usr/include/bpf)" || die
94 + ln -sfn "${bpf_link_path}" src/cc/libbpf/include || die
95 +
96 + # bug 811288
97 + local script scriptname
98 + for script in $(find tools/old -type f -name "*.py" || die); do
99 + scriptname=$(basename ${script} || die)
100 + mv ${script} tools/old/old-${scriptname} || die
101 + done
102 +
103 + cmake_src_prepare
104 +}
105 +
106 +python_add_impl() {
107 + bcc_python_impls+="${EPYTHON};"
108 +}
109 +
110 +src_configure() {
111 + local bcc_python_impls
112 + python_foreach_impl python_add_impl
113 +
114 + local -a mycmakeargs=(
115 + -DREVISION=${PV%%_*}
116 + -DENABLE_LLVM_SHARED=ON
117 + -DCMAKE_USE_LIBBPF_PACKAGE=ON
118 + -DLIBBPF_INCLUDE_DIRS="$($(tc-getPKG_CONFIG) --cflags-only-I libbpf | sed 's:-I::g')"
119 + -DKERNEL_INCLUDE_DIRS="${KERNEL_DIR}"
120 + -DPYTHON_CMD="${bcc_python_impls%;}"
121 + -Wno-dev
122 + )
123 + if use lua && use lua_single_target_luajit; then
124 + mycmakeargs+=( -DWITH_LUAJIT=1 )
125 + fi
126 +
127 + cmake_src_configure
128 +}
129 +
130 +src_install() {
131 + cmake_src_install
132 +
133 + python_replicate_script $(grep -Flr '#!/usr/bin/python' "${ED}/usr/share/bcc/tools")
134 + python_foreach_impl python_optimize
135 +
136 + newenvd "${FILESDIR}"/60bcc.env 60bcc.env
137 + local -A rename_tools=(
138 + [trace]=1
139 + )
140 +
141 + local tool name
142 + for tool in "${ED}"/usr/share/bcc/tools/*; do
143 + [[ ! -x ${tool} && ! -L ${tool} || -d ${tool} ]] && continue
144 + name=${tool##*/}
145 + [[ -n ${rename_tools[${tool##*/}]} ]] && name=bcc-${tool}
146 + dosym8 -r "${tool#${ED}}" /usr/sbin/${name}
147 + done
148 +
149 + docompress /usr/share/${PN}/man
150 +
151 + newenvd - "70${P}" <<-_EOF_
152 + MANPATH="${EPREFIX}/usr/share/${PN}/man"
153 + _EOF_
154 +}