Gentoo Archives: gentoo-commits

From: Naohiro Aota <naota@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/, dev-util/perf/files/
Date: Fri, 27 Dec 2019 02:56:14
Message-Id: 1577414773.f3dd9104e7803e30f988fc8c83c092998fa1560d.naota@gentoo
1 commit: f3dd9104e7803e30f988fc8c83c092998fa1560d
2 Author: Naohiro Aota <naota <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 25 21:47:13 2019 +0000
4 Commit: Naohiro Aota <naota <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 27 02:46:13 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3dd9104
7
8 version bump with some fixes
9
10 This commit add a multiple python version support to address python3
11 installtion issue. (based on a patch from Holger Hoffstätte
12 <holger <AT> applied-asynchrony.com>)
13
14 Also, this commit add a patch to build with >=sys-devel/clang-9. (patch
15 from Maciej S. Szmigiero <mail <AT> maciej.szmigiero.name> and Dennis
16 Schridde <devurandom <AT> gmx.net>).
17
18 Closes: https://bugs.gentoo.org/679762
19 Closes: https://bugs.gentoo.org/695726
20 Signed-off-by: Naohiro Aota <naota <AT> gentoo.org>
21
22 dev-util/perf/Manifest | 2 +
23 dev-util/perf/files/perf-5.4.6-fix-clang9.patch | 17 ++
24 dev-util/perf/perf-5.4.6.ebuild | 246 ++++++++++++++++++++++++
25 3 files changed, 265 insertions(+)
26
27 diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
28 index 012d8331454..14e8bf98547 100644
29 --- a/dev-util/perf/Manifest
30 +++ b/dev-util/perf/Manifest
31 @@ -1,6 +1,8 @@
32 DIST linux-4.14.tar.xz 100770500 BLAKE2B 85dc4aa953fe65e273a24473d8de98e4f204f97c43be9fc87cf5be01f796f94cfde5c8f9c84619751f1cac51f83ce0b4681fb19c5f2965a72d4a94fe5577846a SHA512 77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8
33 DIST linux-4.20.tar.xz 104257836 BLAKE2B fb52cad2897da319299486fa8c3b9415cd0aee0842dbf353a5b269720dcb902db407bb55dd95a77b212dcb4a488c15363d561f3649d6bd16885561f2466d90b1 SHA512 e282399beea5da539701aed2bc131abd5bc74a970dcd344163e9d295106dfd700180e672ed546ae5e55bc6b9ac95efd5ca1de2039015c1b7a6fc9c01ea6583d4
34 DIST linux-5.3.tar.xz 108558876 BLAKE2B 0d08eed879d05734e4542f0c93823d43f8dc042a54ba5268064c4bbebd7a9d59c03abf3ad5dee8280e784ae148a3b0c56181eaf2d5b3c079b6fe9f5191544df6 SHA512 6b5edef47c319a3fa7f6c20a3e0903a5acd89ec75e32dc5f99adcb60c9fe118ea312722d9c3d27e2e3900afa2455afb86e83a8b6bb131009bc79ddbe6fb0595d
35 +DIST linux-5.4.tar.xz 109441440 BLAKE2B 193bc4a3147e147d5529956164ec4912fad5d5c6fb07f909ff1056e57235834173194afc686993ccd785c1ff15804de0961b625f3008cca0e27493efc8f27b13 SHA512 9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f
36 DIST patch-4.14.33.xz 905284 BLAKE2B e67bd9a96708aaaf65eb0aa852493b2323c9e237bfcc6fa837f795e481943ead3e2d5005ee72e40fc247df01c50877d9da3848a05aba3c999c3cfb7678cbdbc9 SHA512 5c76be5171709c2df7df7d5a8e8f3d0f7ede47b433da3b0f1710f262c8fcf5cf6c744a96d4336ea397c2c88a5f0a7507a5ab08c7c82f08deeb7a6f887ad77cfd
37 DIST patch-4.20.3.xz 91732 BLAKE2B bf99271bcb35508df239343fd6c9d57c246f88320b586e44e2d97771d08b249a24db230214d4957015a5ed35261e201f0680101b99d0e92f0f1f69bc53e21458 SHA512 47178b8e3bfe4ba09cb82bb1ce8b0742e6749d4be3412fb57518918f7109e74eac1d3d8eb32a43e21b3837a14f37d5eefd8cab819defd10cc2db61fb0ceddeaf
38 DIST patch-5.3.7.xz 255616 BLAKE2B 18ec40508fdb2cc17dd927f3ddef07b2b744ff993de75bb7adebe3a3f97c9383ea1845085899aa939ca8a15515420c18a1ac0ae832f9ae52f18cc8ed59a1e75f SHA512 bf2717b721b3acfd423537a6a520388e6a596ae65605ed8c029a67c117a002e9a21c324de0dd41407bfdc8ef95263687764f4f46aa59cbb50f68ab21b96c29d6
39 +DIST patch-5.4.6.xz 167272 BLAKE2B 43d7b0b7ee412f68eceb3be32d2629d1a5effef127b3351a499463a740809bdd7274c1ec409bbd77b203b2e4ef117c5c390b4d4b6a440385ab91ee9dcac74926 SHA512 6f6d73c7ce71d47e810847149f4c258f5fb99c98fc67d385a3ff74889543a415bf8bb77c748a13f72b733bca770773731d84713a9be98d630b7377a792f11f5a
40
41 diff --git a/dev-util/perf/files/perf-5.4.6-fix-clang9.patch b/dev-util/perf/files/perf-5.4.6-fix-clang9.patch
42 new file mode 100644
43 index 00000000000..614e62f676d
44 --- /dev/null
45 +++ b/dev-util/perf/files/perf-5.4.6-fix-clang9.patch
46 @@ -0,0 +1,17 @@
47 +https://bugs.gentoo.org/695726
48 +Created-By: Maciej S. Szmigiero <mail@××××××××××××××××.name>
49 +Created-By: Dennis Schridde <devurandom@×××.net>
50 +--- a/tools/perf/util/c++/clang.cpp.orig 2019-12-20 16:39:21.015363866 +0100
51 ++++ b/tools/perf/util/c++/clang.cpp 2019-12-20 16:40:04.051639185 +0100
52 +@@ -71,7 +71,11 @@
53 + CompilerInstance Clang;
54 + Clang.createDiagnostics();
55 +
56 ++#if CLANG_VERSION_MAJOR < 9
57 + Clang.setVirtualFileSystem(&*VFS);
58 ++#else
59 ++ Clang.createFileManager(&*VFS);
60 ++#endif
61 +
62 + #if CLANG_VERSION_MAJOR < 4
63 + IntrusiveRefCntPtr<CompilerInvocation> CI =
64
65 diff --git a/dev-util/perf/perf-5.4.6.ebuild b/dev-util/perf/perf-5.4.6.ebuild
66 new file mode 100644
67 index 00000000000..8fb6d466869
68 --- /dev/null
69 +++ b/dev-util/perf/perf-5.4.6.ebuild
70 @@ -0,0 +1,246 @@
71 +# Copyright 1999-2019 Gentoo Authors
72 +# Distributed under the terms of the GNU General Public License v2
73 +
74 +EAPI=7
75 +
76 +PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
77 +inherit bash-completion-r1 estack eutils toolchain-funcs python-r1 linux-info
78 +
79 +MY_PV="${PV/_/-}"
80 +MY_PV="${MY_PV/-pre/-git}"
81 +
82 +DESCRIPTION="Userland tools for Linux Performance Counters"
83 +HOMEPAGE="https://perf.wiki.kernel.org/"
84 +
85 +LINUX_V="${PV:0:1}.x"
86 +if [[ ${PV} == *_rc* ]] ; then
87 + LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
88 + PATCH_VERSION=$(ver_cut 1-3)
89 + LINUX_PATCH=patch-${PV//_/-}.xz
90 + SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
91 + https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
92 +elif [[ ${PV} == *.*.* ]] ; then
93 + # stable-release series
94 + LINUX_VER=$(ver_cut 1-2)
95 + LINUX_PATCH=patch-${PV}.xz
96 + SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
97 +else
98 + LINUX_VER=${PV}
99 + SRC_URI=""
100 +fi
101 +
102 +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
103 +SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
104 +
105 +LICENSE="GPL-2"
106 +SLOT="0"
107 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
108 +IUSE="audit clang crypt debug +demangle +doc gtk java lzma numa perl python slang systemtap unwind zlib"
109 +# TODO babeltrace
110 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
111 +
112 +RDEPEND="audit? ( sys-process/audit )
113 + crypt? ( dev-libs/openssl:0= )
114 + clang? (
115 + sys-devel/clang:*
116 + sys-devel/llvm:*
117 + )
118 + demangle? ( sys-libs/binutils-libs:= )
119 + gtk? ( x11-libs/gtk+:2 )
120 + java? ( virtual/jre:* )
121 + lzma? ( app-arch/xz-utils )
122 + numa? ( sys-process/numactl )
123 + perl? ( dev-lang/perl:= )
124 + python? ( ${PYTHON_DEPS} )
125 + slang? ( sys-libs/slang )
126 + systemtap? ( dev-util/systemtap )
127 + unwind? ( sys-libs/libunwind )
128 + zlib? ( sys-libs/zlib )
129 + dev-libs/elfutils"
130 +DEPEND="${RDEPEND}
131 + >=sys-kernel/linux-headers-4.19
132 + ${LINUX_PATCH+dev-util/patchutils}
133 + sys-devel/bison
134 + sys-devel/flex
135 + java? ( virtual/jdk )
136 + doc? (
137 + app-text/asciidoc
138 + app-text/sgml-common
139 + app-text/xmlto
140 + sys-process/time
141 + )"
142 +
143 +S_K="${WORKDIR}/linux-${LINUX_VER}"
144 +S="${S_K}/tools/perf"
145 +
146 +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
147 +
148 +pkg_setup() {
149 + linux-info_pkg_setup
150 + use python && python-r1_pkg_setup
151 +}
152 +
153 +src_unpack() {
154 + local paths=(
155 + tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
156 + include lib "arch/*/lib"
157 + )
158 +
159 + # We expect the tar implementation to support the -j option (both
160 + # GNU tar and libarchive's tar support that).
161 + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
162 + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
163 + "${paths[@]/#/linux-${LINUX_VER}/}" || die
164 +
165 + if [[ -n ${LINUX_PATCH} ]] ; then
166 + eshopts_push -o noglob
167 + ebegin "Filtering partial source patch"
168 + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
169 + > ${P}.patch
170 + eend $? || die "filterdiff failed"
171 + eshopts_pop
172 + fi
173 +
174 + local a
175 + for a in ${A}; do
176 + [[ ${a} == ${LINUX_SOURCES} ]] && continue
177 + [[ ${a} == ${LINUX_PATCH} ]] && continue
178 + unpack ${a}
179 + done
180 +
181 + # support clang8
182 + echo $(clang-major-version)
183 + if use clang; then
184 + local old_CC=${CC}
185 + CC=${CHOST}-clang
186 + if [[ $(clang-major-version) -ge 8 ]]; then
187 + pushd "${S_K}" >/dev/null || die
188 + eapply \
189 + "${FILESDIR}/perf-5.1.15-fix-clang8.patch" \
190 + "${FILESDIR}/perf-5.4.6-fix-clang9.patch"
191 + popd || die
192 + fi
193 + CC=${old_CC}
194 + fi
195 +}
196 +
197 +src_prepare() {
198 + default
199 + if [[ -n ${LINUX_PATCH} ]] ; then
200 + pushd "${S_K}" >/dev/null || die
201 + eapply "${WORKDIR}"/${P}.patch
202 + popd || die
203 + fi
204 +
205 + # Drop some upstream too-developer-oriented flags and fix the
206 + # Makefile in general
207 + sed -i \
208 + -e "s:\$(sysconfdir_SQ)/bash_completion.d:$(get_bashcompdir):" \
209 + "${S}"/Makefile.perf || die
210 + # A few places still use -Werror w/out $(WERROR) protection.
211 + sed -i -e 's:-Werror::' \
212 + "${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
213 +
214 + # Avoid the call to make kernelversion
215 + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE
216 +
217 + # The code likes to compile local assembly files which lack ELF markings.
218 + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
219 +}
220 +
221 +puse() { usex $1 "" no; }
222 +perf_make() {
223 + # The arch parsing is a bit funky. The perf tools package is integrated
224 + # into the kernel, so it wants an ARCH that looks like the kernel arch,
225 + # but it also wants to know about the split value -- i386/x86_64 vs just
226 + # x86. We can get that by telling the func to use an older linux version.
227 + # It's kind of a hack, but not that bad ...
228 +
229 + # LIBDIR sets a search path of perf-gtk.so. Bug 515954
230 +
231 + local arch=$(tc-arch-kernel)
232 + local java_dir
233 + use java && java_dir="/etc/java-config-2/current-system-vm"
234 + # FIXME: NO_CORESIGHT
235 + # FIXME: NO_LIBBABELTRACE
236 + emake V=1 VF=1 \
237 + CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" \
238 + prefix="${EPREFIX}/usr" bindir_relative="bin" \
239 + EXTRA_CFLAGS="${CFLAGS}" \
240 + ARCH="${arch}" \
241 + JDIR="${java_dir}" \
242 + LIBCLANGLLVM=$(usex clang 1 "") \
243 + NO_AUXTRACE="" \
244 + NO_BACKTRACE="" \
245 + NO_CORESIGHT=1 \
246 + NO_DEMANGLE=$(puse demangle) \
247 + NO_GTK2=$(puse gtk) \
248 + NO_JVMTI=$(puse java) \
249 + NO_LIBAUDIT=$(puse audit) \
250 + NO_LIBBABELTRACE=1 \
251 + NO_LIBBIONIC=1 \
252 + NO_LIBBPF="" \
253 + NO_LIBCRYPTO=$(puse crypt) \
254 + NO_LIBDW_DWARF_UNWIND="" \
255 + NO_LIBELF="" \
256 + NO_LIBNUMA=$(puse numa) \
257 + NO_LIBPERL=$(puse perl) \
258 + NO_LIBPYTHON=$(puse python) \
259 + NO_LIBUNWIND=$(puse unwind) \
260 + NO_SDT=$(puse systemtap) \
261 + NO_SLANG=$(puse slang) \
262 + NO_LZMA=$(puse lzma) \
263 + NO_ZLIB= \
264 + WERROR=0 \
265 + LIBDIR="/usr/libexec/perf-core" \
266 + "$@"
267 +}
268 +
269 +src_compile() {
270 + # test-clang.bin not build with g++
271 + if use clang; then
272 + pushd "${S_K}/tools/build/feature/" || die
273 + make V=1 CXX=${CHOST}-clang++ test-clang.bin || die
274 + popd
275 + fi
276 + perf_make -f Makefile.perf
277 + use doc && perf_make -C Documentation
278 +}
279 +
280 +src_test() {
281 + :
282 +}
283 +
284 +src_install() {
285 + _install_python_ext() {
286 + perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
287 + }
288 +
289 + perf_make -f Makefile.perf install DESTDIR="${D}"
290 + if python; then
291 + python_foreach_impl _install_python_ext
292 + fi
293 +
294 + rm -rv "${ED}"/usr/share/doc/perf-tip || die
295 +
296 + if use gtk; then
297 + mv "${ED}"/usr/$(get_libdir)/libperf-gtk.so \
298 + "${ED}"/usr/libexec/perf-core || die
299 + fi
300 +
301 + dodoc CREDITS
302 +
303 + dodoc *txt Documentation/*.txt
304 + if use doc ; then
305 + HTML_DOCS="Documentation/*.html" einstalldocs
306 + doman Documentation/*.1
307 + fi
308 +}
309 +
310 +pkg_postinst() {
311 + if ! use doc ; then
312 + elog "Without the doc USE flag you won't get any documentation nor man pages."
313 + elog "And without man pages, you won't get any --help output for perf and its"
314 + elog "sub-tools."
315 + fi
316 +}