summaryrefslogtreecommitdiff
blob: 413d772d1ac3d4e9bc5370f928c0e70ba8ef2f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/leaktracer/leaktracer-2.4-r1.ebuild,v 1.1 2007/12/24 09:56:30 dev-zero Exp $

inherit eutils multilib toolchain-funcs

# Upstream-package has no version in it's name.
# We therefore repackage it directly, together with the patches.
PATCH_LEVEL="1"

DESCRIPTION="trace and analyze memory leaks in C++ programs"
HOMEPAGE="http://www.andreasen.org/LeakTracer/"
SRC_URI="mirror://gentoo/${P}-gentoo_p${PATCH_LEVEL}.tbz2"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""

DEPEND=">=dev-lang/perl-5
	sys-devel/gdb"
RDEPEND="${DEPEND}"

# leaktracer is being realized using LD_PRELOAD and segfaults
# when being run in the sandbox and the library is _not_ in
# /usr/$(get_libdir) which is not possible before installation
RESTRICT="test"

src_unpack() {
	unpack ${A}
	cd "${S}"

	EPATCH_SOURCE="${WORKDIR}/patches"
	EPATCH_SUFFIX="patch"
	epatch

	sed -i \
		-e "s|%LIB%|$(get_libdir)|" \
		LeakCheck || die "sed for setting lib path failed"
}

src_compile() {
	emake CXX=$(tc-getCXX) LDFLAGS=${LDFLAGS} || die "emake failed"
}

src_install() {
	dobin LeakCheck leak-analyze || die "dobin failed"
	dolib.so LeakTracer.so || die "dolib.so failed"
	dohtml README.html
	dodoc README "${WORKDIR}/patches/multi-stack.readme"
}

pkg_postinst() {
	elog "To use LeakTracer, run LeakCheck my_prog and then leak-analyze my_prog leak.out"
	elog "Please reffer to README file for more info."
}