| 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.ebuild,v 1.4 2009/07/22 20:23:50 josejx 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 |
# valgrind spits out many false positives on amd64 because of glibc-2.10's |
| 47 |
# optimized strlen if there is no debug info for glibc (bug #274771). This |
| 48 |
# patch adds a run-time error if debug info cannot be found. |
| 49 |
epatch "${FILESDIR}/valgrind-3.4.1-x86_64-ldso-strlen.patch" |
| 50 |
|
| 51 |
# Fix up some suppressions that were not general enough for glibc versions |
| 52 |
# with more than just a major and minor number. |
| 53 |
epatch "${FILESDIR}/valgrind-3.4.1-glibc-2.10.1.patch" |
| 54 |
|
| 55 |
# Regenerate autotools files |
| 56 |
eautoreconf |
| 57 |
} |
| 58 |
|
| 59 |
src_compile() { |
| 60 |
local myconf |
| 61 |
|
| 62 |
# -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression" |
| 63 |
# while compiling insn_sse.c in none/tests/x86 |
| 64 |
# -fpie valgrind seemingly hangs when built with pie on |
| 65 |
# amd64 (bug #102157) |
| 66 |
# -fstack-protector more undefined references to __guard and __stack_smash_handler |
| 67 |
# because valgrind doesn't link to glibc (bug #114347) |
| 68 |
# -ggdb3 segmentation fault on startup |
| 69 |
filter-flags -fomit-frame-pointer |
| 70 |
filter-flags -fpie |
| 71 |
filter-flags -fstack-protector |
| 72 |
replace-flags -ggdb3 -ggdb2 |
| 73 |
|
| 74 |
# gcc 3.3.x fails to compile valgrind with -O3 (bug #129776) |
| 75 |
if [ "$(gcc-version)" == "3.3" ] && is-flagq -O3; then |
| 76 |
ewarn "GCC 3.3 cannot compile valgrind with -O3 in CFLAGS, using -O2 instead." |
| 77 |
replace-flags -O3 -O2 |
| 78 |
fi |
| 79 |
|
| 80 |
if use amd64 || use ppc64; then |
| 81 |
! has_multilib_profile && myconf="${myconf} --enable-only64bit" |
| 82 |
fi |
| 83 |
|
| 84 |
# Don't use mpicc unless the user asked for it (bug #258832) |
| 85 |
if ! use mpi; then |
| 86 |
myconf="${myconf} --without-mpicc" |
| 87 |
fi |
| 88 |
|
| 89 |
econf ${myconf} || die "Configure failed!" |
| 90 |
emake || die "Make failed!" |
| 91 |
} |
| 92 |
|
| 93 |
src_install() { |
| 94 |
make DESTDIR="${D}" install || die "Install failed!" |
| 95 |
dodoc ACKNOWLEDGEMENTS AUTHORS FAQ.txt NEWS README* |
| 96 |
} |
| 97 |
|
| 98 |
pkg_postinst() { |
| 99 |
if use ppc || use ppc64 || use amd64 ; then |
| 100 |
ewarn "Valgrind will not work on ppc, ppc64 or amd64 if glibc does not have" |
| 101 |
ewarn "debug symbols (see https://bugs.gentoo.org/show_bug.cgi?id=214065" |
| 102 |
ewarn "and http://bugs.gentoo.org/show_bug.cgi?id=274771)." |
| 103 |
ewarn "To fix this you can add splitdebug to FEATURES in make.conf and" |
| 104 |
ewarn "remerge glibc." |
| 105 |
fi |
| 106 |
} |