| 1 |
# Copyright 1999-2009 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-util/valgrind/valgrind-3.4.1-r1.ebuild,v 1.1 2009/07/26 12:05:52 griffon26 Exp $
|
| 4 |
|
| 5 |
inherit autotools eutils flag-o-matic toolchain-funcs
|
| 6 |
|
| 7 |
DESCRIPTION="An open-source memory debugger for GNU/Linux"
|
| 8 |
HOMEPAGE="http://www.valgrind.org"
|
| 9 |
SRC_URI="http://www.valgrind.org/downloads/${P}.tar.bz2"
|
| 10 |
|
| 11 |
LICENSE="GPL-2"
|
| 12 |
SLOT="0"
|
| 13 |
KEYWORDS="-* ~amd64 ~ppc ~ppc64 ~x86"
|
| 14 |
IUSE="mpi"
|
| 15 |
|
| 16 |
DEPEND="mpi? ( virtual/mpi )"
|
| 17 |
RDEPEND="${DEPEND}
|
| 18 |
!dev-util/callgrind"
|
| 19 |
|
| 20 |
src_unpack() {
|
| 21 |
unpack ${A}
|
| 22 |
cd "${S}"
|
| 23 |
|
| 24 |
# make sure our CFLAGS are respected
|
| 25 |
einfo "Changing configure.in to respect CFLAGS"
|
| 26 |
sed -i -e 's:^CFLAGS="-Wno-long-long":CFLAGS="$CFLAGS -Wno-long-long":' configure.in
|
| 27 |
|
| 28 |
# undefined references to __guard and __stack_smash_handler in VEX (bug #114347)
|
| 29 |
einfo "Changing Makefile.flags.am to disable SSP"
|
| 30 |
sed -i -e 's:^AM_CFLAGS_BASE = :AM_CFLAGS_BASE = -fno-stack-protector :' Makefile.flags.am
|
| 31 |
|
| 32 |
# Correct hard coded doc location
|
| 33 |
sed -i -e "s:doc/valgrind:doc/${P}:" docs/Makefile.am
|
| 34 |
|
| 35 |
# Remove defaulting to ppc32-linux on ppc64 without multilib
|
| 36 |
# "valgrind: failed to start tool 'memcheck' for platform 'ppc32-linux':
|
| 37 |
# No such file or directory"
|
| 38 |
if use ppc64 && ! has_multilib_profile; then
|
| 39 |
epatch "${FILESDIR}/valgrind-3.3.0-only64bit.patch"
|
| 40 |
fi
|
| 41 |
|
| 42 |
# Use local labels in inline asm to prevent 'symbol already defined' errors
|
| 43 |
# when optimisation is on (bug #234644).
|
| 44 |
epatch "${FILESDIR}/valgrind-3.3.1-local-labels.patch"
|
| 45 |
|
| 46 |
# More local labels (bug #260802, upstream revision 9539)
|
| 47 |
epatch "${FILESDIR}/valgrind-3.4.1-local-labels.patch"
|
| 48 |
|
| 49 |
# valgrind spits out many false positives on amd64 because of glibc-2.10's
|
| 50 |
# optimized strlen if there is no debug info for glibc (bug #274771). This
|
| 51 |
# patch adds a run-time error if debug info cannot be found.
|
| 52 |
epatch "${FILESDIR}/valgrind-3.4.1-x86_64-ldso-strlen.patch"
|
| 53 |
|
| 54 |
# Fix up some suppressions that were not general enough for glibc versions
|
| 55 |
# with more than just a major and minor number.
|
| 56 |
epatch "${FILESDIR}/valgrind-3.4.1-glibc-2.10.1.patch"
|
| 57 |
|
| 58 |
# Respect LDFLAGS also for libmpiwrap.so (bug #279194)
|
| 59 |
epatch "${FILESDIR}/valgrind-3.4.1-respect-LDFLAGS.patch"
|
| 60 |
|
| 61 |
# Regenerate autotools files
|
| 62 |
eautoreconf
|
| 63 |
}
|
| 64 |
|
| 65 |
src_compile() {
|
| 66 |
local myconf
|
| 67 |
|
| 68 |
# -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
|
| 69 |
# while compiling insn_sse.c in none/tests/x86
|
| 70 |
# -fpie valgrind seemingly hangs when built with pie on
|
| 71 |
# amd64 (bug #102157)
|
| 72 |
# -fstack-protector more undefined references to __guard and __stack_smash_handler
|
| 73 |
# because valgrind doesn't link to glibc (bug #114347)
|
| 74 |
# -ggdb3 segmentation fault on startup
|
| 75 |
filter-flags -fomit-frame-pointer
|
| 76 |
filter-flags -fpie
|
| 77 |
filter-flags -fstack-protector
|
| 78 |
replace-flags -ggdb3 -ggdb2
|
| 79 |
|
| 80 |
# gcc 3.3.x fails to compile valgrind with -O3 (bug #129776)
|
| 81 |
if [ "$(gcc-version)" == "3.3" ] && is-flagq -O3; then
|
| 82 |
ewarn "GCC 3.3 cannot compile valgrind with -O3 in CFLAGS, using -O2 instead."
|
| 83 |
replace-flags -O3 -O2
|
| 84 |
fi
|
| 85 |
|
| 86 |
if use amd64 || use ppc64; then
|
| 87 |
! has_multilib_profile && myconf="${myconf} --enable-only64bit"
|
| 88 |
fi
|
| 89 |
|
| 90 |
# Don't use mpicc unless the user asked for it (bug #258832)
|
| 91 |
if ! use mpi; then
|
| 92 |
myconf="${myconf} --without-mpicc"
|
| 93 |
fi
|
| 94 |
|
| 95 |
econf ${myconf} || die "Configure failed!"
|
| 96 |
emake || die "Make failed!"
|
| 97 |
}
|
| 98 |
|
| 99 |
src_install() {
|
| 100 |
make DESTDIR="${D}" install || die "Install failed!"
|
| 101 |
dodoc ACKNOWLEDGEMENTS AUTHORS FAQ.txt NEWS README*
|
| 102 |
}
|
| 103 |
|
| 104 |
pkg_postinst() {
|
| 105 |
if use ppc || use ppc64 || use amd64 ; then
|
| 106 |
ewarn "Valgrind will not work on ppc, ppc64 or amd64 if glibc does not have"
|
| 107 |
ewarn "debug symbols (see https://bugs.gentoo.org/show_bug.cgi?id=214065"
|
| 108 |
ewarn "and http://bugs.gentoo.org/show_bug.cgi?id=274771)."
|
| 109 |
ewarn "To fix this you can add splitdebug to FEATURES in make.conf and"
|
| 110 |
ewarn "remerge glibc."
|
| 111 |
fi
|
| 112 |
}
|