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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Jun 28 08:23:07 2012 UTC (2 years, 4 months ago) by naota
Branch: MAIN
Version bump; Assign myself as a maintainer.

(Portage version: 2.2.0_alpha110/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.2.ebuild,v 1.1 2012/02/28 22:21:05 vapier 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 sys-devel/bison
49 sys-devel/flex
50 doc? (
51 app-text/asciidoc
52 app-text/sgml-common
53 app-text/xmlto
54 sys-process/time )"
55
56 S_K="${WORKDIR}/linux-${LINUX_VER}"
57 S="${S_K}/tools/perf"
58
59 CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
60
61 pkg_setup() {
62 use python && python_set_active_version 2
63 }
64
65 src_unpack() {
66 local paths=( tools/perf include lib "arch/*/include" "arch/*/lib" )
67
68 # We expect the tar implementation to support the -j option (both
69 # GNU tar and libarchive's tar support that).
70 echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
71 tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
72 "${paths[@]/#/linux-${LINUX_VER}/}" || die
73
74 if [[ -n ${LINUX_PATCH} ]] ; then
75 eshopts_push -o noglob
76 ebegin "Filtering partial source patch"
77 filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} > ${P}.patch || die
78 eend $? || die "filterdiff failed"
79 eshopts_pop
80 fi
81
82 local a
83 for a in ${A}; do
84 [[ ${a} == ${LINUX_SOURCES} ]] && continue
85 [[ ${a} == ${LINUX_PATCH} ]] && continue
86 unpack ${a}
87 done
88 }
89
90 src_prepare() {
91 if [[ -n ${LINUX_PATCH} ]] ; then
92 cd "${S_K}"
93 epatch "${WORKDIR}"/${P}.patch
94 fi
95
96 # Drop some upstream too-developer-oriented flags and fix the
97 # Makefile in general
98 sed -i \
99 -e 's:-Werror::' \
100 -e 's:-ggdb3::' \
101 -e 's:-fstack-protector-all::' \
102 -e 's:^LDFLAGS =:EXTLIBS +=:' \
103 -e '/\(PERL\|PYTHON\)_EMBED_LDOPTS/s:ALL_LDFLAGS +=:EXTLIBS +=:' \
104 -e '/-x c - /s:\$(ALL_LDFLAGS):\0 $(EXTLIBS):' \
105 -e '/^ALL_CFLAGS =/s:$: $(CFLAGS_OPTIMIZE):' \
106 -e '/^ALL_LDFLAGS =/s:$: $(LDFLAGS_OPTIMIZE):' \
107 -e '/.FORCE-PERF-VERSION-FILE/s,.FORCE-PERF-VERSION-FILE,,g' \
108 "${S}"/Makefile
109
110 # Avoid the call to make kernelversion
111 echo "PERF_VERSION = ${MY_PV}" > PERF-VERSION-FILE
112
113 # The code likes to compile local assembly files which lack ELF markings.
114 find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
115 }
116
117 puse() { usex $1 "" no; }
118 perf_make() {
119 emake V=1 \
120 CC="$(tc-getCC)" AR="$(tc-getAR)" \
121 prefix="/usr" bindir_relative="sbin" \
122 CFLAGS_OPTIMIZE="${CFLAGS}" \
123 LDFLAGS_OPTIMIZE="${LDFLAGS}" \
124 ARCH="$(tc-arch-kernel)" \
125 NO_DEMANGLE=$(puse demangle) \
126 NO_LIBPERL=$(puse perl) \
127 NO_LIBPYTHON=$(puse python) \
128 NO_NEWT=$(puse slang) \
129 "$@"
130 }
131
132 src_compile() {
133 perf_make
134
135 if use doc ; then
136 pushd Documentation
137 emake ${makeargs}
138 popd
139 fi
140 }
141
142 src_test() {
143 :
144 }
145
146 src_install() {
147 perf_make install DESTDIR="${D}"
148
149 dodoc CREDITS
150
151 dodoc *txt Documentation/*.txt
152 if use doc ; then
153 dohtml Documentation/*.html
154 doman Documentation/*.1
155 fi
156 }
157
158 pkg_postinst() {
159 if ! use doc ; then
160 elog "Without the doc USE flag you won't get any documentation nor man pages."
161 elog "And without man pages, you won't get any --help output for perf and its"
162 elog "sub-tools."
163 fi
164 }

  ViewVC Help
Powered by ViewVC 1.1.20