diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2016-06-28 13:48:17 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2016-06-28 13:48:17 -0400 |
commit | f670c8d44348e03d4d3f1e349aa39843cafb5608 (patch) | |
tree | 67bf6a234a95e9b0c54c31b58005cb6c6e38ba80 | |
parent | sys-devel/binutils: add ld BE emulations for ppc64le target #580614 (diff) | |
download | ppc64le-f670c8d44348e03d4d3f1e349aa39843cafb5608.tar.gz ppc64le-f670c8d44348e03d4d3f1e349aa39843cafb5608.tar.bz2 ppc64le-f670c8d44348e03d4d3f1e349aa39843cafb5608.zip |
dev-utils/perf: copy from tree
-rw-r--r-- | dev-utils/perf/Manifest | 10 | ||||
-rw-r--r-- | dev-utils/perf/files/perf-4.1.5-prefix.patch | 43 | ||||
-rw-r--r-- | dev-utils/perf/metadata.xml | 29 | ||||
-rw-r--r-- | dev-utils/perf/perf-3.12.ebuild | 178 | ||||
-rw-r--r-- | dev-utils/perf/perf-3.13.1-r1.ebuild | 183 | ||||
-rw-r--r-- | dev-utils/perf/perf-3.15.5.ebuild | 183 | ||||
-rw-r--r-- | dev-utils/perf/perf-3.8-r1.ebuild | 170 | ||||
-rw-r--r-- | dev-utils/perf/perf-4.1.5-r1.ebuild | 191 | ||||
-rw-r--r-- | dev-utils/perf/perf-4.4.4.ebuild | 185 |
9 files changed, 1172 insertions, 0 deletions
diff --git a/dev-utils/perf/Manifest b/dev-utils/perf/Manifest new file mode 100644 index 0000000..e756632 --- /dev/null +++ b/dev-utils/perf/Manifest @@ -0,0 +1,10 @@ +DIST linux-3.12.tar.bz2 91111381 SHA256 43129defd9079c99cf5e57506d36b6b01614c734a5ed9e604d3a7c1510ab8b22 SHA512 bea14d044c8a0257d8312f45db6a39ca4f9dffe8ac32a11198e90762ee1735c8b6975bb81c635a4755d451793fa7c7e5b2d7d692c9e57133b15b4cdc941febf1 WHIRLPOOL 1889c3f689cf305856112f350e3901175b9f6c4f1e4143d62b40e502000685ade3e75b211a8a9fd948f6225e1c57a68cae10ceb649ff7976981089290d562926 +DIST linux-3.13.tar.xz 77187032 SHA256 4d5e5eee5f276424c32e9591f1b6c971baedc7b49f28ce03d1f48b1e5d6226a2 SHA512 1ba223bb4b885d691a67196d86a8aaf7b4a1c351bf2a762f50f1b0c32da00dd0c28895872a66b49e8d244498d996876609268e64861d28ac4048886ef9f79b87 WHIRLPOOL 2992257a17e85b3eb16fcaf21678fa6dbf31f80c2099fd1ad0ff9852ac1d16122ac8e2c0b46421d8895d4368253a724e439cd625307ee7af7bd1e50cb2c9b62a +DIST linux-3.15.tar.xz 79676484 SHA256 c3927e87be4040fa8aca1b58663dc0776aaf00485604ff88a623be2f3fb07794 SHA512 d5dc477cad4584e56e2e2ef9e0950c2b22e76e5cf5090a896ba099cb7c5e5db1853a4aeb96b199189653dc66d461557e95198e37516a619f7ddc01ba6b308e02 WHIRLPOOL 7f3dfde1a23aab75b7f40770ae2ca77c1b28f845e4abe6296b2aec9b56fe94f7afa76b00eb6cc7475305c31b726ebeb4643107dd48c12ac04c933cf1856b8e77 +DIST linux-3.8.tar.bz2 84623657 SHA256 fce774b5313e73949cb35f128e91e7b2ccd7fa2438abc5cff69267e504395a45 SHA512 966a3b08aecc4b135a48ea73ba3326e1710c455e6da29693479e9d1a56663fc10f569e2342fa861486d39d4ea5c2af406d1bd40613c15555acffdba160ef7ba9 WHIRLPOOL a83baa904c78f71fed5e4cf2607b8e6d1db70a4137b5c00b3cc5f60f04042724faa3cfec36a781417d483548ba0c811f559e82146806edacd1c2fe90bd398e64 +DIST linux-4.1.tar.xz 83017828 SHA256 caf51f085aac1e1cea4d00dbbf3093ead07b551fc07b31b2a989c05f8ea72d9f SHA512 168ef84a4e67619f9f53f3574e438542a5747f9b43443363cb83597fcdac9f40d201625c66e375a23226745eaada9176eb006ca023613cec089349e91751f3c0 WHIRLPOOL 85fcfdb67ea7f865272a85d3b4c3ec1f5a1267f4664bf073c562bb3875e9d96ad68486259d8866a9aced98c95de16840ec531d89745aec75b7315a64ebe650b8 +DIST linux-4.4.tar.xz 87295988 SHA256 401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2 SHA512 13c8459933a8b80608e226a1398e3d1848352ace84bcfb7e6a4a33cb230bbe1ab719d4b58e067283df91ce5311be6d2d595fc8c19e2ae6ecc652499415614b3e WHIRLPOOL 02abc203d867404b9934aaa4c1e5b5dcbb0b0021e91a03f3a7e7fd224eed106821d8b4949f32a590536db150e5a88c16fcde88538777a26d0c17900f0257b1bc +DIST patch-3.13.1.xz 2884 SHA256 74a093b2cacddac0a105e0989b7bf0e9829b9923e2d71ca10382e90324a17e74 SHA512 164235a15e6a984e9aeaf9fe475a8b2975d5e4c4b28dd4ecf99064b0f0c72eea766d925340f1a7232cabcbd23d26773527c300b6d995bf5cde18a276208fdccc WHIRLPOOL 0ea0118960970b7d6465445252e7a21a6aeb494c0afefec5f52a68c0b7e0d63fd2ed59a3877fbe9ebd282ac03812235b021534866efa8f46d549b6f70228e4b6 +DIST patch-3.15.5.xz 122232 SHA256 9b0d000e0bdec7a25ee6303afdab8d2af77439995876eadd6ce248e5c954037d SHA512 6831200503334e839c3cccdad29058aecc0205171cc5b75205d0a2aada8636633889ebff35d9677d4567bbaeea249efc83571e016104cd67554fe72b3b405755 WHIRLPOOL 56e1e817c08b4557e18b34d148d8ffd0f73bf8dec92f2339ca9413ca2143b65ec35f6d48c87e37f140226e57d7df33f06d6c53a48dafa7ddf090a839fdabe024 +DIST patch-4.1.5.xz 170056 SHA256 b495cf8a7b978986dd2b757b687751c62f635d15cc2228edb80934bc0d449dcc SHA512 1325cdb35ea1f277d513932af37804f788b96ae63b94cedeb3c9b916ee8963bbd6aca5d0e13279e36a81f1de06005c5f3666ecfc845609932686f261fa4250c5 WHIRLPOOL 291ddfcde395c3d201a8172f7281ac560167a8bce78d3196b47e4c7be759545282cc1104fc7b2edc95d90250a834cc23103199275bc8c6974bd4229dd530d1a3 +DIST patch-4.4.4.xz 200972 SHA256 9061d8f57cc25d760387c4e6b7d5cceacaa808e8784a3e478012e7c2949853c8 SHA512 c206af7803cb0915fbe2bd27ed33282452db3fbd3070c73e4c7147443efd3c7588fb3be12d0abc08742381fbe892190602b29147684630aa9e6ff5e9efa49dbc WHIRLPOOL e6a004e32eecca1507354f97d3de85a07c1b9512fe3d4d87173e6d39c02ef1c2411abd0c26b6a077cd5eaefde11dd201445f72b9a0cf185e76635bdcc36df8dd diff --git a/dev-utils/perf/files/perf-4.1.5-prefix.patch b/dev-utils/perf/files/perf-4.1.5-prefix.patch new file mode 100644 index 0000000..0c4dff0 --- /dev/null +++ b/dev-utils/perf/files/perf-4.1.5-prefix.patch @@ -0,0 +1,43 @@ +commit 75e84ab906ef8935cff3df3d8929f1bafea81599 +Author: Lukas Wunner <lukas@wunner.de> +Date: Thu Jun 18 13:00:32 2015 +0200 + + perf tools: Fix build breakage if prefix= is specified + + Invoking Makefile.perf with prefix= breaks the build since Makefile.perf + hands that variable down to Makefile.build where it overrides + + prefix := $(subst ./,,$(OUTPUT)$(dir)/) + + leading to errors like this: + + No rule to make target '/usrabspath.o', needed by '/usrlibperf-in.o' + + Signed-off-by: Lukas Wunner <lukas@wunner.de> + Acked-by: Jiri Olsa <jolsa@kernel.org> + Cc: David Ahern <dsahern@gmail.com> + Fixes: c819e2cf2eb6f65d3208d195d7a0edef6108d5 + Link: http://lkml.kernel.org/r/5582c48a.84a22b0a.a918.5285SMTPIN_ADDED_MISSING@mx.google.com + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> + +diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build +index 10df572..98cfc38 100644 +--- a/tools/build/Makefile.build ++++ b/tools/build/Makefile.build +@@ -94,12 +94,12 @@ obj-y := $(patsubst %/, %/$(obj)-in.o, $(obj-y)) + subdir-obj-y := $(filter %/$(obj)-in.o, $(obj-y)) + + # '$(OUTPUT)/dir' prefix to all objects +-prefix := $(subst ./,,$(OUTPUT)$(dir)/) +-obj-y := $(addprefix $(prefix),$(obj-y)) +-subdir-obj-y := $(addprefix $(prefix),$(subdir-obj-y)) ++objprefix := $(subst ./,,$(OUTPUT)$(dir)/) ++obj-y := $(addprefix $(objprefix),$(obj-y)) ++subdir-obj-y := $(addprefix $(objprefix),$(subdir-obj-y)) + + # Final '$(obj)-in.o' object +-in-target := $(prefix)$(obj)-in.o ++in-target := $(objprefix)$(obj)-in.o + + PHONY += $(subdir-y) + diff --git a/dev-utils/perf/metadata.xml b/dev-utils/perf/metadata.xml new file mode 100644 index 0000000..ec35d2e --- /dev/null +++ b/dev-utils/perf/metadata.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>naota@gentoo.org</email> + </maintainer> + <use> + <flag name="demangle"> + Enable C++ symbol name demangling, using libbfd from + <pkg>sys-devel/binutils</pkg>. When this flag is enabled, the + package will have to be rebuilt after every version bump of + binutils. + </flag> + <flag name="doc"> + Build documentation and man pages. With this USE flag disabled, + the --help parameter for perf and its sub-tools will not be + available. This is optional because it depends on a few + documentation handling tools that are not always welcome on user + systems. + </flag> + <flag name="numa">Enable NUMA support</flag> + <flag name="perl"> + Add support for Perl as a scripting language for perf tools. + </flag> + <flag name="unwind"> + Use sys-libs/libunwind for frame unwinding support. + </flag> + </use> +</pkgmetadata> diff --git a/dev-utils/perf/perf-3.12.ebuild b/dev-utils/perf/perf-3.12.ebuild new file mode 100644 index 0000000..17af617 --- /dev/null +++ b/dev-utils/perf/perf-3.12.ebuild @@ -0,0 +1,178 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +inherit versionator eutils toolchain-funcs python-single-r1 linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV/_rc} != ${PV} ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.bz2 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +elif [[ $(get_version_component_count) == 4 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV}.bz2 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" +else + LINUX_VER=${PV} + SRC_URI="" +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.bz2" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86" +IUSE="audit +demangle +doc perl python slang unwind" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + ) + python? ( ${PYTHON_DEPS} )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_unpack() { + local paths=( tools/perf tools/scripts tools/lib include lib "arch/*/include" "arch/*/lib" ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \ + -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile || die + sed -i -e 's:-Werror::' "${S_K}"/tools/lib/lk/Makefile || die + sed -i \ + -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \ + "${S}"/Makefile \ + "${S}"/Documentation/Makefile || die + + # Avoid the call to make kernelversion + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + # The arch parsing is a bit funky. The perf tools package is integrated + # into the kernel, so it wants an ARCH that looks like the kernel arch, + # but it also wants to know about the split value -- i386/x86_64 vs just + # x86. We can get that by telling the func to use an older linux version. + # It's kind of a hack, but not that bad ... + local arch=$(KV=2.6.23 tc-arch-kernel) + emake -j1 V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" \ + prefix="/usr" bindir_relative="sbin" \ + CFLAGS_OPTIMIZE="${CFLAGS}" \ + LDFLAGS_OPTIMIZE="${LDFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + WERROR=0 \ + "$@" +} + +src_compile() { + perf_make + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} diff --git a/dev-utils/perf/perf-3.13.1-r1.ebuild b/dev-utils/perf/perf-3.13.1-r1.ebuild new file mode 100644 index 0000000..e11af3b --- /dev/null +++ b/dev-utils/perf/perf-3.13.1-r1.ebuild @@ -0,0 +1,183 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +inherit versionator eutils toolchain-funcs python-single-r1 linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV} == *_rc* ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +else + VER_COUNT=$(get_version_component_count) + if [[ ${VER_COUNT} -gt 2 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-2) + LINUX_PATCH=patch-${PV}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" + else + LINUX_VER=${PV} + SRC_URI="" + fi +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86" +IUSE="audit +demangle +doc gtk perl python slang unwind" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils ) + gtk? ( x11-libs/gtk+:2 ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + ) + python? ( ${PYTHON_DEPS} )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_unpack() { + local paths=( tools/perf tools/scripts tools/lib include lib "arch/*/include" "arch/*/lib" ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \ + -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile || die + sed -i -e 's:-Werror::' "${S_K}"/tools/lib/lk/Makefile || die + sed -i \ + -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \ + "${S}"/Makefile \ + "${S}"/Documentation/Makefile || die + + # Avoid the call to make kernelversion + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + # The arch parsing is a bit funky. The perf tools package is integrated + # into the kernel, so it wants an ARCH that looks like the kernel arch, + # but it also wants to know about the split value -- i386/x86_64 vs just + # x86. We can get that by telling the func to use an older linux version. + # It's kind of a hack, but not that bad ... + local arch=$(KV=2.6.23 tc-arch-kernel) + emake V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" \ + prefix="/usr" bindir_relative="bin" \ + CFLAGS_OPTIMIZE="${CFLAGS}" \ + LDFLAGS_OPTIMIZE="${LDFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_GTK2=$(puse gtk) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + WERROR=0 \ + "$@" +} + +src_compile() { + perf_make -f Makefile.perf + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make -f Makefile.perf install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} diff --git a/dev-utils/perf/perf-3.15.5.ebuild b/dev-utils/perf/perf-3.15.5.ebuild new file mode 100644 index 0000000..ee4515c --- /dev/null +++ b/dev-utils/perf/perf-3.15.5.ebuild @@ -0,0 +1,183 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +inherit versionator eutils toolchain-funcs python-single-r1 linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV} == *_rc* ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +else + VER_COUNT=$(get_version_component_count) + if [[ ${VER_COUNT} -gt 2 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-2) + LINUX_PATCH=patch-${PV}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" + else + LINUX_VER=${PV} + SRC_URI="" + fi +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86" +IUSE="audit debug +demangle +doc gtk perl python slang unwind" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils ) + gtk? ( x11-libs/gtk+:2 ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + ) + python? ( ${PYTHON_DEPS} )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_unpack() { + local paths=( tools/perf tools/scripts tools/include tools/lib include lib "arch/*/include" "arch/*/lib" ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \ + -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile || die + sed -i -e 's:-Werror::' "${S_K}"/tools/lib/api/Makefile || die + sed -i \ + -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \ + "${S}"/Makefile \ + "${S}"/Documentation/Makefile || die + + # Avoid the call to make kernelversion + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + # The arch parsing is a bit funky. The perf tools package is integrated + # into the kernel, so it wants an ARCH that looks like the kernel arch, + # but it also wants to know about the split value -- i386/x86_64 vs just + # x86. We can get that by telling the func to use an older linux version. + # It's kind of a hack, but not that bad ... + local arch=$(KV=2.6.23 tc-arch-kernel) + emake V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" \ + prefix="/usr" bindir_relative="bin" \ + CFLAGS_OPTIMIZE="${CFLAGS}" \ + LDFLAGS_OPTIMIZE="${LDFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_GTK2=$(puse gtk) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + WERROR=0 \ + "$@" +} + +src_compile() { + perf_make -f Makefile.perf + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make -f Makefile.perf install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} diff --git a/dev-utils/perf/perf-3.8-r1.ebuild b/dev-utils/perf/perf-3.8-r1.ebuild new file mode 100644 index 0000000..1f72038 --- /dev/null +++ b/dev-utils/perf/perf-3.8-r1.ebuild @@ -0,0 +1,170 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="4" + +PYTHON_DEPEND="python? 2" +inherit versionator eutils toolchain-funcs python linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV/_rc} != ${PV} ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.bz2 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +elif [[ $(get_version_component_count) == 4 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV}.bz2 + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" +else + LINUX_VER=${PV} + SRC_URI="" +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.bz2" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86" +IUSE="audit +demangle +doc perl python slang unwind" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python_set_active_version 2 +} + +src_unpack() { + local paths=( tools/perf tools/scripts tools/lib include lib "arch/*/include" "arch/*/lib" ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \ + -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile + sed -i \ + -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \ + "${S}"/Makefile \ + "${S}"/Documentation/Makefile + + # Avoid the call to make kernelversion + echo "PERF_VERSION = ${MY_PV}" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + local arch=$(tc-arch) + [[ "${arch}" == "amd64" ]] && arch="x86_64" + emake -j1 V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" \ + prefix="/usr" bindir_relative="sbin" \ + CFLAGS_OPTIMIZE="${CFLAGS}" \ + LDFLAGS_OPTIMIZE="${LDFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + "$@" +} + +src_compile() { + perf_make + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} diff --git a/dev-utils/perf/perf-4.1.5-r1.ebuild b/dev-utils/perf/perf-4.1.5-r1.ebuild new file mode 100644 index 0000000..f502d10 --- /dev/null +++ b/dev-utils/perf/perf-4.1.5-r1.ebuild @@ -0,0 +1,191 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +inherit versionator eutils toolchain-funcs python-single-r1 linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV} == *_rc* ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +else + VER_COUNT=$(get_version_component_count) + if [[ ${VER_COUNT} -gt 2 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-2) + LINUX_PATCH=patch-${PV}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" + else + LINUX_VER=${PV} + SRC_URI="" + fi +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~ppc ~x86" +IUSE="audit debug +demangle +doc gtk numa perl python slang unwind" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils:= ) + gtk? ( x11-libs/gtk+:2 ) + numa? ( sys-process/numactl ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + ) + python? ( ${PYTHON_DEPS} )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_unpack() { + local paths=( + tools/build tools/include tools/lib tools/perf tools/scripts + include lib "arch/*/include" "arch/*/lib" + ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \ + > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + epatch "${FILESDIR}"/${P}-prefix.patch + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \ + -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile || die + sed -i -e 's:-Werror::' "${S_K}"/tools/lib/api/Makefile || die + sed -i \ + -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \ + "${S}"/Makefile \ + "${S}"/Documentation/Makefile || die + + # Avoid the call to make kernelversion + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + # The arch parsing is a bit funky. The perf tools package is integrated + # into the kernel, so it wants an ARCH that looks like the kernel arch, + # but it also wants to know about the split value -- i386/x86_64 vs just + # x86. We can get that by telling the func to use an older linux version. + # It's kind of a hack, but not that bad ... + local arch=$(tc-arch-kernel) + emake V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" \ + prefix="/usr" bindir_relative="bin" \ + CFLAGS_OPTIMIZE="${CFLAGS}" \ + LDFLAGS_OPTIMIZE="${LDFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_GTK2=$(puse gtk) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + NO_LIBNUMA=$(puse numa) \ + WERROR=0 \ + "$@" +} + +src_compile() { + perf_make -f Makefile.perf + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make -f Makefile.perf install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} diff --git a/dev-utils/perf/perf-4.4.4.ebuild b/dev-utils/perf/perf-4.4.4.ebuild new file mode 100644 index 0000000..18dd89e --- /dev/null +++ b/dev-utils/perf/perf-4.4.4.ebuild @@ -0,0 +1,185 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +inherit versionator eutils toolchain-funcs python-single-r1 linux-info + +MY_PV="${PV/_/-}" +MY_PV="${MY_PV/-pre/-git}" + +DESCRIPTION="Userland tools for Linux Performance Counters" +HOMEPAGE="https://perf.wiki.kernel.org/" + +LINUX_V="${PV:0:1}.x" +if [[ ${PV} == *_rc* ]] ; then + LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1)) + PATCH_VERSION=$(get_version_component_range 1-3) + LINUX_PATCH=patch-${PV//_/-}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH} + mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}" +else + VER_COUNT=$(get_version_component_count) + if [[ ${VER_COUNT} -gt 2 ]] ; then + # stable-release series + LINUX_VER=$(get_version_component_range 1-2) + LINUX_PATCH=patch-${PV}.xz + SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}" + else + LINUX_VER=${PV} + SRC_URI="" + fi +fi + +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz" +SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86" +IUSE="audit debug +demangle +doc gtk numa perl python slang unwind" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND="audit? ( sys-process/audit ) + demangle? ( sys-devel/binutils:= ) + gtk? ( x11-libs/gtk+:2 ) + numa? ( sys-process/numactl ) + perl? ( dev-lang/perl ) + slang? ( dev-libs/newt ) + unwind? ( sys-libs/libunwind ) + dev-libs/elfutils" +DEPEND="${RDEPEND} + >=sys-kernel/linux-headers-4.4 + ${LINUX_PATCH+dev-util/patchutils} + sys-devel/bison + sys-devel/flex + doc? ( + app-text/asciidoc + app-text/sgml-common + app-text/xmlto + sys-process/time + ) + python? ( ${PYTHON_DEPS} )" + +S_K="${WORKDIR}/linux-${LINUX_VER}" +S="${S_K}/tools/perf" + +CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS" + +pkg_setup() { + linux-info_pkg_setup + use python && python-single-r1_pkg_setup +} + +src_unpack() { + local paths=( + tools/arch tools/build tools/include tools/lib tools/perf tools/scripts + include lib "arch/*/lib" + ) + + # We expect the tar implementation to support the -j option (both + # GNU tar and libarchive's tar support that). + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}" + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \ + "${paths[@]/#/linux-${LINUX_VER}/}" || die + + if [[ -n ${LINUX_PATCH} ]] ; then + eshopts_push -o noglob + ebegin "Filtering partial source patch" + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \ + > ${P}.patch || die + eend $? || die "filterdiff failed" + eshopts_pop + fi + + local a + for a in ${A}; do + [[ ${a} == ${LINUX_SOURCES} ]] && continue + [[ ${a} == ${LINUX_PATCH} ]] && continue + unpack ${a} + done +} + +src_prepare() { + if [[ -n ${LINUX_PATCH} ]] ; then + cd "${S_K}" + epatch "${WORKDIR}"/${P}.patch + fi + + # Drop some upstream too-developer-oriented flags and fix the + # Makefile in general + sed -i \ + -e 's:-Werror::' \ + -e 's:-ggdb3::' \ + -e 's:-fstack-protector-all::' \ + -e 's:^LDFLAGS =:EXTLIBS +=:' \ + -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \ + -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \ + "${S}"/config/Makefile || die + sed -i \ + -e 's:$(sysconfdir_SQ)/bash_completion.d:/usr/share/bash-completion:' \ + "${S}"/Makefile.perf || die + sed -i -e 's:-Werror::' "${S_K}"/tools/lib/api/Makefile || die + + # Avoid the call to make kernelversion + echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE + + # The code likes to compile local assembly files which lack ELF markings. + find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} + +} + +puse() { usex $1 "" no; } +perf_make() { + # The arch parsing is a bit funky. The perf tools package is integrated + # into the kernel, so it wants an ARCH that looks like the kernel arch, + # but it also wants to know about the split value -- i386/x86_64 vs just + # x86. We can get that by telling the func to use an older linux version. + # It's kind of a hack, but not that bad ... + local arch=$(tc-arch-kernel) + emake V=1 \ + CC="$(tc-getCC)" AR="$(tc-getAR)" LD="$(tc-getLD)" \ + prefix="/usr" bindir_relative="bin" \ + EXTRA_CFLAGS="${CFLAGS}" \ + ARCH="${arch}" \ + NO_DEMANGLE=$(puse demangle) \ + NO_GTK2=$(puse gtk) \ + NO_LIBAUDIT=$(puse audit) \ + NO_LIBPERL=$(puse perl) \ + NO_LIBPYTHON=$(puse python) \ + NO_LIBUNWIND=$(puse unwind) \ + NO_NEWT=$(puse slang) \ + NO_LIBNUMA=$(puse numa) \ + WERROR=0 \ + "$@" +} + +src_compile() { + perf_make -f Makefile.perf + use doc && perf_make -C Documentation +} + +src_test() { + : +} + +src_install() { + perf_make -f Makefile.perf install DESTDIR="${D}" + + dodoc CREDITS + + dodoc *txt Documentation/*.txt + if use doc ; then + dohtml Documentation/*.html + doman Documentation/*.1 + fi +} + +pkg_postinst() { + if ! use doc ; then + elog "Without the doc USE flag you won't get any documentation nor man pages." + elog "And without man pages, you won't get any --help output for perf and its" + elog "sub-tools." + fi +} |