summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-util/perf
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-util/perf')
-rw-r--r--dev-util/perf/Manifest6
-rw-r--r--dev-util/perf/metadata.xml31
-rw-r--r--dev-util/perf/perf-3.12.ebuild178
-rw-r--r--dev-util/perf/perf-3.13.1-r1.ebuild183
-rw-r--r--dev-util/perf/perf-3.15.5.ebuild183
-rw-r--r--dev-util/perf/perf-3.8-r1.ebuild170
6 files changed, 751 insertions, 0 deletions
diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
new file mode 100644
index 000000000000..1b4f9567cee8
--- /dev/null
+++ b/dev-util/perf/Manifest
@@ -0,0 +1,6 @@
+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 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
diff --git a/dev-util/perf/metadata.xml b/dev-util/perf/metadata.xml
new file mode 100644
index 000000000000..b4aba5127c82
--- /dev/null
+++ b/dev-util/perf/metadata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>naota@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="audit">
+ Enable support for sys-process/audit.
+ </flag>
+ <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="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-util/perf/perf-3.12.ebuild b/dev-util/perf/perf-3.12.ebuild
new file mode 100644
index 000000000000..af262155bd1a
--- /dev/null
+++ b/dev-util/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="http://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-util/perf/perf-3.13.1-r1.ebuild b/dev-util/perf/perf-3.13.1-r1.ebuild
new file mode 100644
index 000000000000..33e2f9e4cffb
--- /dev/null
+++ b/dev-util/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="http://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-util/perf/perf-3.15.5.ebuild b/dev-util/perf/perf-3.15.5.ebuild
new file mode 100644
index 000000000000..dc9dac7a843e
--- /dev/null
+++ b/dev-util/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="http://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-util/perf/perf-3.8-r1.ebuild b/dev-util/perf/perf-3.8-r1.ebuild
new file mode 100644
index 000000000000..74afde049bd6
--- /dev/null
+++ b/dev-util/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="http://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
+}