1+ # Distributed under the terms of the GNU General Public License v2
2+
3+ EAPI=7
4+ inherit autotools flag-o-matic toolchain-funcs pax-utils
5+
6+ DESCRIPTION=" An open-source memory debugger for GNU/Linux"
7+ HOMEPAGE=" https://www.valgrind.org"
8+ LICENSE=" GPL-2"
9+ SLOT=" 0"
10+ IUSE=" mpi"
11+
12+ SRC_URI=" https://sourceware.org/pub/valgrind/valgrind-3.25.1.tar.bz2 -> valgrind-3.25.1.tar.bz2"
13+ KEYWORDS=" *"
14+
15+ DEPEND=" mpi? ( virtual/mpi )"
16+ RDEPEND=" ${DEPEND} "
17+
18+ src_prepare () {
19+ # Correct hard coded doc location
20+ sed -i -e " s:doc/valgrind:doc/${PF} :" docs/Makefile.am || die
21+
22+ # Don't force multiarch stuff on OSX, bug #306467
23+ sed -i -e ' s:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
24+
25+ # Respect CFLAGS, LDFLAGS
26+ eapply " ${FILESDIR} " /${PN} -3.7.0-respect-flags.patch
27+
28+ eapply " ${FILESDIR} " /${PN} -3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
29+
30+ # Allow users to test their own patches
31+ eapply_user
32+
33+ # Regenerate autotools files
34+ eautoreconf
35+ }
36+
37+ src_configure () {
38+ local myconf=()
39+
40+ # Respect ar, bug #468114
41+ tc-export AR
42+
43+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
44+ # while compiling insn_sse.c in none/tests/x86
45+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
46+ # because valgrind doesn't link to glibc (bug #114347)
47+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
48+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
49+ # -fstack-protector-strong See -fstack-protector (bug #620402)
50+ # -m64 -mx32 for multilib-portage, bug #398825
51+ # -ggdb3 segmentation fault on startup
52+ filter-flags -fomit-frame-pointer
53+ filter-flags -fstack-protector
54+ filter-flags -fstack-protector-all
55+ filter-flags -fstack-protector-strong
56+ filter-flags -m64 -mx32
57+ replace-flags -ggdb3 -ggdb2
58+
59+ # Don't use mpicc unless the user asked for it (bug #258832)
60+ if ! use mpi; then
61+ myconf+=(" --without-mpicc" )
62+ fi
63+
64+ econf " ${myconf[@]} "
65+ }
66+
67+ src_install () {
68+ default
69+ dodoc FAQ.txt
70+ pax-mark m " ${ED} " /usr/$( get_libdir) /valgrind/* -* -linux
71+ }
72+
73+ pkg_postinst () {
74+ elog " Valgrind will not work if glibc does not have debug symbols."
75+ elog " To fix this you can add splitdebug to FEATURES in make.conf"
76+ elog " and remerge glibc. See:"
77+ elog " https://bugs.gentoo.org/show_bug.cgi?id=214065"
78+ elog " https://bugs.gentoo.org/show_bug.cgi?id=274771"
79+ elog " https://bugs.gentoo.org/show_bug.cgi?id=388703"
80+ }
0 commit comments