/[gentoo-x86]/dev-util/perf/perf-3.2.ebuild
Gentoo

Contents of /dev-util/perf/perf-3.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Feb 28 22:21:05 2012 UTC (3 years, 2 months ago) by vapier
Branch: MAIN
Fix automagic depends #390191 and clean up the ebuild.

(Portage version: 2.2.0_alpha86/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-util/perf/perf-3.1.ebuild,v 1.1 2011/11/01 07:33:12 robbat2 Exp $
4
5 EAPI="4"
6
7 PYTHON_DEPEND="python? 2"
8 inherit versionator eutils toolchain-funcs python linux-info
9
10 MY_PV="${PV/_/-}"
11 MY_PV="${MY_PV/-pre/-git}"
12
13 DESCRIPTION="Userland tools for Linux Performance Counters"
14 HOMEPAGE="http://perf.wiki.kernel.org/"
15
16 LINUX_V=$(get_version_component_range 1-2)
17
18 if [[ ${PV/_rc} != ${PV} ]] ; then
19 LINUX_VER=$(get_version_component_range 1-2).$(($(get_version_component_range 3)-1))
20 PATCH_VERSION=$(get_version_component_range 1-3)
21 LINUX_PATCH=patch-${PV//_/-}.bz2
22 SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
23 mirror://kernel/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
24 elif [[ $(get_version_component_count) == 4 ]] ; then
25 # stable-release series
26 LINUX_VER=$(get_version_component_range 1-3)
27 LINUX_PATCH=patch-${PV}.bz2
28 SRC_URI="mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
29 else
30 LINUX_VER=${PV}
31 SRC_URI=""
32 fi
33
34 LINUX_SOURCES="linux-${LINUX_VER}.tar.bz2"
35 SRC_URI+=" mirror://kernel/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
36
37 LICENSE="GPL-2"
38 SLOT="0"
39 KEYWORDS="~amd64 ~ppc ~x86"
40 IUSE="+demangle +doc perl python slang"
41
42 RDEPEND="demangle? ( sys-devel/binutils )
43 perl? ( || ( >=dev-lang/perl-5.10 sys-devel/libperl ) )
44 slang? ( dev-libs/newt )
45 dev-libs/elfutils"
46 DEPEND="${RDEPEND}
47 ${LINUX_PATCH+dev-util/patchutils}
48 doc? ( app-text/asciidoc app-text/xmlto )"
49
50 S_K="${WORKDIR}/linux-${LINUX_VER}"
51 S="${S_K}/tools/perf"
52
53 CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
54
55 pkg_setup() {
56 use python && python_set_active_version 2
57 }
58
59 src_unpack() {
60 local paths=( tools/perf include lib "arch/*/include" "arch/*/lib" )
61
62 # We expect the tar implementation to support the -j option (both
63 # GNU tar and libarchive's tar support that).
64 echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
65 tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
66 "${paths[@]/#/linux-${LINUX_VER}/}" || die
67
68 if [[ -n ${LINUX_PATCH} ]] ; then
69 eshopts_push -o noglob
70 ebegin "Filtering partial source patch"
71 filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die
72 eend $? || die "filterdiff failed"
73 eshopts_pop
74 fi
75
76 local a
77 for a in ${A}; do
78 [[ ${a} == ${LINUX_SOURCES} ]] && continue
79 [[ ${a} == ${LINUX_PATCH} ]] && continue
80 unpack ${a}
81 done
82 }
83
84 src_prepare() {
85 if [[ -n ${LINUX_PATCH} ]] ; then
86 cd "${S_K}"
87 epatch "${WORKDIR}"/${P}.patch
88 fi
89
90 # Drop some upstream too-developer-oriented flags and fix the
91 # Makefile in general
92 sed -i \
93 -e 's:-Werror::' \
94 -e 's:-ggdb3::' \
95 -e 's:-fstack-protector-all::' \
96 -e 's:^LDFLAGS =:EXTLIBS +=:' \
97 -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \
98 -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \
99 -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \
100 -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \
101 -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \
102 "${S}"/Makefile
103
104 # Avoid the call to make kernelversion
105 echo "PERF_VERSION = ${MY_PV}" > PERF-VERSION-FILE
106
107 # The code likes to compile local assembly files which lack ELF markings.
108 find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
109 }
110
111 puse() { usex $1 "" no; }
112 perf_make() {
113 emake V=1 \
114 CC="$(tc-getCC)" AR="$(tc-getAR)" \
115 prefix="/usr" bindir_relative="sbin" \
116 CFLAGS_OPTIMIZE="${CFLAGS}" \
117 LDFLAGS_OPTIMIZE="${LDFLAGS}" \
118 ARCH="$(tc-arch-kernel)" \
119 NO_DEMANGLE=$(puse demangle) \
120 NO_LIBPERL=$(puse perl) \
121 NO_LIBPYTHON=$(puse python) \
122 NO_NEWT=$(puse slang) \
123 "$@"
124 }
125
126 src_compile() {
127 perf_make
128
129 if use doc ; then
130 pushd Documentation
131 emake ${makeargs}
132 popd
133 fi
134 }
135
136 src_test() {
137 :
138 }
139
140 src_install() {
141 perf_make install DESTDIR="${D}"
142
143 dodoc CREDITS
144
145 dodoc *txt Documentation/*.txt
146 if use doc ; then
147 dohtml Documentation/*.html
148 doman Documentation/*.1
149 fi
150 }
151
152 pkg_postinst() {
153 if ! use doc ; then
154 elog "Without the doc USE flag you won't get any documentation nor man pages."
155 elog "And without man pages, you won't get any --help output for perf and its"
156 elog "sub-tools."
157 fi
158 }

  ViewVC Help
Powered by ViewVC 1.1.20