4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
PYTHON_COMPAT=( python3_{10..12} )
|
7 |
|
inherit bash-completion-r1 estack flag-o-matic llvm toolchain-funcs python-r1 linux-info
|
|
7 |
inherit bash-completion-r1 estack flag-o-matic linux-info llvm toolchain-funcs python-r1
|
8 |
8 |
|
9 |
9 |
DESCRIPTION="Userland tools for Linux Performance Counters"
|
10 |
10 |
HOMEPAGE="https://perf.wiki.kernel.org/"
|
... | ... | |
31 |
31 |
|
32 |
32 |
LICENSE="GPL-2"
|
33 |
33 |
SLOT="0"
|
34 |
|
KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
|
35 |
|
IUSE="audit babeltrace caps clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zstd"
|
|
34 |
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
|
|
35 |
IUSE="audit babeltrace bpf caps clang crypt debug +doc gtk java libpfm libtraceevent libtracefs lzma numa perl python slang systemtap tcmalloc unwind zstd"
|
36 |
36 |
|
37 |
|
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
|
37 |
REQUIRED_USE="
|
|
38 |
bpf? ( clang )
|
|
39 |
${PYTHON_REQUIRED_USE}
|
|
40 |
"
|
38 |
41 |
|
39 |
42 |
# setuptools (and Python) are always needed even if not building Python bindings
|
40 |
43 |
BDEPEND="
|
... | ... | |
56 |
59 |
RDEPEND="
|
57 |
60 |
audit? ( sys-process/audit )
|
58 |
61 |
babeltrace? ( dev-util/babeltrace )
|
|
62 |
bpf? (
|
|
63 |
dev-libs/libbpf
|
|
64 |
dev-util/bpftool
|
|
65 |
dev-util/pahole
|
|
66 |
)
|
59 |
67 |
caps? ( sys-libs/libcap )
|
60 |
68 |
clang? (
|
61 |
69 |
sys-devel/clang:=
|
... | ... | |
65 |
73 |
gtk? ( x11-libs/gtk+:2 )
|
66 |
74 |
java? ( virtual/jre:* )
|
67 |
75 |
libpfm? ( dev-libs/libpfm:= )
|
|
76 |
libtraceevent? ( dev-libs/libtraceevent )
|
|
77 |
libtracefs? ( dev-libs/libtracefs )
|
68 |
78 |
lzma? ( app-arch/xz-utils )
|
69 |
79 |
numa? ( sys-process/numactl )
|
70 |
80 |
perl? ( dev-lang/perl:= )
|
71 |
81 |
python? ( ${PYTHON_DEPS} )
|
72 |
82 |
slang? ( sys-libs/slang )
|
73 |
83 |
systemtap? ( dev-util/systemtap )
|
|
84 |
tcmalloc? ( dev-util/google-perftools )
|
74 |
85 |
unwind? ( sys-libs/libunwind:= )
|
75 |
86 |
zstd? ( app-arch/zstd:= )
|
76 |
87 |
dev-libs/elfutils
|
... | ... | |
86 |
97 |
S_K="${WORKDIR}/linux-${LINUX_VER}"
|
87 |
98 |
S="${S_K}/tools/perf"
|
88 |
99 |
|
89 |
|
CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
|
|
100 |
CONFIG_CHECK="
|
|
101 |
~DEBUG_INFO
|
|
102 |
~FTRACE
|
|
103 |
~FTRACE_SYSCALLS
|
|
104 |
~FUNCTION_TRACER
|
|
105 |
~KALLSYMS
|
|
106 |
~KALLSYMS_ALL
|
|
107 |
~KPROBES
|
|
108 |
~KPROBE_EVENTS
|
|
109 |
~PERF_EVENTS
|
|
110 |
~UPROBES
|
|
111 |
~UPROBE_EVENTS
|
|
112 |
"
|
90 |
113 |
|
91 |
114 |
QA_FLAGS_IGNORED=(
|
92 |
115 |
'usr/bin/perf-read-vdso32' # not linked with anything except for libc
|
... | ... | |
106 |
129 |
# We enable python unconditionally as libbpf always generates
|
107 |
130 |
# API headers using python script
|
108 |
131 |
python_setup
|
|
132 |
|
|
133 |
if use bpf ; then
|
|
134 |
CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT"
|
|
135 |
fi
|
|
136 |
|
|
137 |
linux-info_pkg_setup
|
109 |
138 |
}
|
110 |
139 |
|
111 |
140 |
# src_unpack and src_prepare are copied to dev-util/bpftool since
|
112 |
141 |
# it's building from the same tarball, please keep it in sync with bpftool
|
113 |
142 |
src_unpack() {
|
114 |
143 |
local paths=(
|
115 |
|
tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
|
|
144 |
kernel/bpf tools/{arch,bpf,build,include,lib,perf,scripts}
|
116 |
145 |
scripts include lib "arch/*/lib"
|
117 |
146 |
)
|
118 |
147 |
|
... | ... | |
150 |
179 |
pushd "${S_K}" >/dev/null || die
|
151 |
180 |
eapply "${FILESDIR}"/perf-6.0-clang.patch
|
152 |
181 |
eapply "${FILESDIR}"/perf-6.0-c++17.patch
|
|
182 |
eapply "${FILESDIR}"/perf-6.4-libtracefs.patch
|
153 |
183 |
popd || die
|
154 |
184 |
|
155 |
185 |
# Drop some upstream too-developer-oriented flags and fix the
|
... | ... | |
170 |
200 |
find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
|
171 |
201 |
}
|
172 |
202 |
|
173 |
|
puse() { usex $1 "" no; }
|
|
203 |
puse() { usex $1 "" 1; }
|
174 |
204 |
perf_make() {
|
175 |
205 |
# The arch parsing is a bit funky. The perf tools package is integrated
|
176 |
206 |
# into the kernel, so it wants an ARCH that looks like the kernel arch,
|
... | ... | |
194 |
224 |
EXTRA_CFLAGS="${CFLAGS}"
|
195 |
225 |
EXTRA_LDFLAGS="${LDFLAGS}"
|
196 |
226 |
ARCH="${arch}"
|
|
227 |
BUILD_BPF_SKEL=$(usex bpf 1 "") \
|
|
228 |
BUILD_NONDISTRO=1
|
197 |
229 |
JDIR="${java_dir}"
|
198 |
|
LIBCLANGLLVM=$(usex clang 1 "")
|
199 |
|
LIBPFM4=$(usex libpfm 1 "")
|
200 |
|
NO_AUXTRACE=""
|
201 |
|
NO_BACKTRACE=""
|
202 |
|
NO_CORESIGHT=1
|
203 |
|
NO_DEMANGLE=
|
|
230 |
CORESIGHT=
|
204 |
231 |
GTK2=$(usex gtk 1 "")
|
|
232 |
LIBCLANGLLVM=$(usex clang 1 "")
|
205 |
233 |
feature-gtk2-infobar=$(usex gtk 1 "")
|
|
234 |
NO_AUXTRACE=
|
|
235 |
NO_BACKTRACE=
|
|
236 |
NO_DEMANGLE=
|
|
237 |
NO_JEVENTS=$(puse python)
|
206 |
238 |
NO_JVMTI=$(puse java)
|
207 |
239 |
NO_LIBAUDIT=$(puse audit)
|
208 |
240 |
NO_LIBBABELTRACE=$(puse babeltrace)
|
209 |
241 |
NO_LIBBIONIC=1
|
210 |
|
NO_LIBBPF=
|
|
242 |
NO_LIBBPF=$(puse bpf)
|
211 |
243 |
NO_LIBCAP=$(puse caps)
|
212 |
244 |
NO_LIBCRYPTO=$(puse crypt)
|
213 |
245 |
NO_LIBDW_DWARF_UNWIND=
|
214 |
246 |
NO_LIBELF=
|
215 |
247 |
NO_LIBNUMA=$(puse numa)
|
216 |
248 |
NO_LIBPERL=$(puse perl)
|
|
249 |
NO_LIBPFM4=$(puse libpfm)
|
217 |
250 |
NO_LIBPYTHON=$(puse python)
|
|
251 |
NO_LIBTRACEEVENT=$(puse libtraceevent)
|
218 |
252 |
NO_LIBUNWIND=$(puse unwind)
|
219 |
253 |
NO_LIBZSTD=$(puse zstd)
|
220 |
254 |
NO_SDT=$(puse systemtap)
|
221 |
255 |
NO_SLANG=$(puse slang)
|
222 |
256 |
NO_LZMA=$(puse lzma)
|
223 |
257 |
NO_ZLIB=
|
|
258 |
TCMALLOC=$(usex tcmalloc 1 "")
|
224 |
259 |
WERROR=0
|
225 |
260 |
LIBDIR="/usr/libexec/perf-core"
|
226 |
261 |
libdir="${EPREFIX}/usr/$(get_libdir)"
|