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/
Date: Mon, 15 Oct 2018 02:26:12
Message-Id: 1539570353.59d2bb43bf1374b23ec718321ac839033cfb7b44.naota@gentoo
1 commit: 59d2bb43bf1374b23ec718321ac839033cfb7b44
2 Author: Naohiro Aota <naota <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 15 02:25:26 2018 +0000
4 Commit: Naohiro Aota <naota <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 15 02:25:53 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59d2bb43
7
8 dev-util/perf: move in-package library to its dedicated directory
9
10 /usr/lib64/libperf-gtk.so is solely used by this package. So I moved the
11 library to its dedicated directory: /usr/libexec/perf-core. To let the
12 perf command find the library, use LIBDIR config to include the
13 directory to search path list.
14
15 Signed-off-by: Naohiro Aota <naota <AT> gentoo.org>
16 Closes: https://bugs.gentoo.org/515954
17 Package-Manager: Portage-2.3.51, Repoman-2.3.11
18
19 dev-util/perf/perf-4.14.33-r1.ebuild | 185 +++++++++++++++++++++++++++++++++++
20 1 file changed, 185 insertions(+)
21
22 diff --git a/dev-util/perf/perf-4.14.33-r1.ebuild b/dev-util/perf/perf-4.14.33-r1.ebuild
23 new file mode 100644
24 index 00000000000..6eb3fa30238
25 --- /dev/null
26 +++ b/dev-util/perf/perf-4.14.33-r1.ebuild
27 @@ -0,0 +1,185 @@
28 +# Copyright 1999-2018 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=7
32 +
33 +PYTHON_COMPAT=( python2_7 )
34 +inherit bash-completion-r1 eutils toolchain-funcs python-single-r1 linux-info
35 +
36 +MY_PV="${PV/_/-}"
37 +MY_PV="${MY_PV/-pre/-git}"
38 +
39 +DESCRIPTION="Userland tools for Linux Performance Counters"
40 +HOMEPAGE="https://perf.wiki.kernel.org/"
41 +
42 +LINUX_V="${PV:0:1}.x"
43 +if [[ ${PV} == *_rc* ]] ; then
44 + LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
45 + PATCH_VERSION=$(ver_cut 1-3)
46 + LINUX_PATCH=patch-${PV//_/-}.xz
47 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
48 + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
49 +elif [[ ${PV} == *.*.* ]] ; then
50 + # stable-release series
51 + LINUX_VER=$(ver_cut 1-2)
52 + LINUX_PATCH=patch-${PV}.xz
53 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
54 +else
55 + LINUX_VER=${PV}
56 + SRC_URI=""
57 +fi
58 +
59 +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
60 +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
61 +
62 +LICENSE="GPL-2"
63 +SLOT="0"
64 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
65 +IUSE="audit debug +demangle +doc gtk numa perl python slang unwind"
66 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
67 +
68 +RDEPEND="audit? ( sys-process/audit )
69 + demangle? ( sys-libs/binutils-libs:= )
70 + gtk? ( x11-libs/gtk+:2 )
71 + numa? ( sys-process/numactl )
72 + perl? ( dev-lang/perl )
73 + python? ( ${PYTHON_DEPS} )
74 + slang? ( dev-libs/newt )
75 + unwind? ( sys-libs/libunwind )
76 + dev-libs/elfutils"
77 +DEPEND="${RDEPEND}
78 + >=sys-kernel/linux-headers-4.9
79 + ${LINUX_PATCH+dev-util/patchutils}
80 + sys-devel/bison
81 + sys-devel/flex
82 + doc? (
83 + app-text/asciidoc
84 + app-text/sgml-common
85 + app-text/xmlto
86 + sys-process/time
87 + )"
88 +
89 +S_K="${WORKDIR}/linux-${LINUX_VER}"
90 +S="${S_K}/tools/perf"
91 +
92 +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
93 +
94 +pkg_setup() {
95 + linux-info_pkg_setup
96 + use python && python-single-r1_pkg_setup
97 +}
98 +
99 +src_unpack() {
100 + local paths=(
101 + tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
102 + include lib "arch/*/lib"
103 + )
104 +
105 + # We expect the tar implementation to support the -j option (both
106 + # GNU tar and libarchive's tar support that).
107 + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
108 + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
109 + "${paths[@]/#/linux-${LINUX_VER}/}" || die
110 +
111 + if [[ -n ${LINUX_PATCH} ]] ; then
112 + eshopts_push -o noglob
113 + ebegin "Filtering partial source patch"
114 + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
115 + > ${P}.patch || die
116 + eend $? || die "filterdiff failed"
117 + eshopts_pop
118 + fi
119 +
120 + local a
121 + for a in ${A}; do
122 + [[ ${a} == ${LINUX_SOURCES} ]] && continue
123 + [[ ${a} == ${LINUX_PATCH} ]] && continue
124 + unpack ${a}
125 + done
126 +}
127 +
128 +src_prepare() {
129 + default
130 + if [[ -n ${LINUX_PATCH} ]] ; then
131 + cd "${S_K}"
132 + eapply "${WORKDIR}"/${P}.patch
133 + fi
134 +
135 + # Drop some upstream too-developer-oriented flags and fix the
136 + # Makefile in general
137 + sed -i \
138 + -e "s:\$(sysconfdir_SQ)/bash_completion.d:$(get_bashcompdir):" \
139 + "${S}"/Makefile.perf || die
140 + # A few places still use -Werror w/out $(WERROR) protection.
141 + sed -i -e 's:-Werror::' \
142 + "${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
143 +
144 + # Avoid the call to make kernelversion
145 + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE
146 +
147 + # The code likes to compile local assembly files which lack ELF markings.
148 + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
149 +}
150 +
151 +puse() { usex $1 "" no; }
152 +perf_make() {
153 + # The arch parsing is a bit funky. The perf tools package is integrated
154 + # into the kernel, so it wants an ARCH that looks like the kernel arch,
155 + # but it also wants to know about the split value -- i386/x86_64 vs just
156 + # x86. We can get that by telling the func to use an older linux version.
157 + # It's kind of a hack, but not that bad ...
158 +
159 + # LIBDIR sets a search path of perf-gtk.so. Bug 515954
160 +
161 + local arch=$(tc-arch-kernel)
162 + emake V=1 \
163 + CC="$(tc-getCC)" AR="$(tc-getAR)" LD="$(tc-getLD)" \
164 + prefix="${EPREFIX}/usr" bindir_relative="bin" \
165 + EXTRA_CFLAGS="${CFLAGS}" \
166 + ARCH="${arch}" \
167 + NO_DEMANGLE=$(puse demangle) \
168 + NO_GTK2=$(puse gtk) \
169 + NO_LIBAUDIT=$(puse audit) \
170 + NO_LIBPERL=$(puse perl) \
171 + NO_LIBPYTHON=$(puse python) \
172 + NO_LIBUNWIND=$(puse unwind) \
173 + NO_NEWT=$(puse slang) \
174 + NO_LIBNUMA=$(puse numa) \
175 + WERROR=0 \
176 + LIBDIR="/usr/libexec/perf-core" \
177 + "$@"
178 +}
179 +
180 +src_compile() {
181 + perf_make -f Makefile.perf
182 + use doc && perf_make -C Documentation
183 +}
184 +
185 +src_test() {
186 + :
187 +}
188 +
189 +src_install() {
190 + perf_make -f Makefile.perf install DESTDIR="${D}"
191 +
192 + if use gtk; then
193 + mv "${D}"/usr/$(get_libdir)/libperf-gtk.so \
194 + "${D}"/usr/libexec/perf-core || die
195 + fi
196 +
197 + dodoc CREDITS
198 +
199 + dodoc *txt Documentation/*.txt
200 + if use doc ; then
201 + HTML_DOCS="Documentation/*.html" einstalldocs
202 + doman Documentation/*.1
203 + fi
204 +}
205 +
206 +pkg_postinst() {
207 + if ! use doc ; then
208 + elog "Without the doc USE flag you won't get any documentation nor man pages."
209 + elog "And without man pages, you won't get any --help output for perf and its"
210 + elog "sub-tools."
211 + fi
212 +}