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