x11-misc/alock: Take ownership of package
[gentoo.git] / dev-util / duma / duma-2.5.13.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 inherit eutils flag-o-matic multilib toolchain-funcs versionator
6
7 MY_P="${PN}_$(replace_all_version_separators '_')"
8
9 DESCRIPTION="DUMA (Detect Unintended Memory Access) is a memory debugging library"
10 HOMEPAGE="http://duma.sourceforge.net/"
11
12 SRC_URI="mirror://sourceforge/duma/${MY_P}.tar.gz"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="amd64 ppc x86"
17 IUSE="examples"
18
19 DEPEND=""
20 RDEPEND="${DEPEND}
21         app-shells/bash"
22
23 S="${WORKDIR}/${MY_P}"
24
25 pkg_setup() {
26         #DUMA_OPTIONS="-DDUMA_LIB_NO_LEAKDETECTION"
27         DUMA_OPTIONS="-DDUMA_USE_FRAMENO"
28         if [ -n "${DUMA_OPTIONS}" ]; then
29             ewarn ""
30             elog "Custom build options are ${DUMA_OPTIONS}."
31         else
32             ewarn ""
33             elog "Custom build options are not set!"
34         fi
35         elog "See the package Makefile for for more options (also installed"
36         elog "with package docs as Makefile.duma)."
37         ewarn ""
38 }
39
40 src_unpack(){
41         unpack ${A}
42         cd "${S}"
43         sed -i -e "s:(prefix)/lib:(prefix)/$(get_libdir):g" Makefile
44         sed -i -e "s:share/doc/duma:share/doc/${P}:g" Makefile
45 }
46
47 src_compile(){
48         replace-flags O? O0
49         append-flags -Wall -Wextra -U_FORTIFY_SOURCE
50         tc-export AR CC CXX LD RANLIB
51
52         use amd64 && export DUMA_ALIGNMENT=16
53
54         make CPPFLAGS="${DUMA_OPTIONS}" reconfig || die "make reconfig failed"
55         emake CFLAGS="${CFLAGS}" CC=$(tc-getCC) || die "make failed"
56 }
57
58 src_test() {
59         ewarn "Control-C now if you want to disable tests..."
60         epause 5
61
62         cd "${S}"
63         use amd64 && export DUMA_ALIGNMENT=16
64         make CFLAGS="${DUMA_OPTIONS} ${CFLAGS}" \
65             CC=$(tc-getCC) test || die "make test failed"
66
67         elog ""
68         ewarn "Check output above to verify all tests have passed.  Both"
69         ewarn "static and dynamic confidence tests should say PASSED."
70         elog ""
71 }
72
73 src_install(){
74         # make install fails nicely here on the first file...
75         make DESTDIR="${D}" install || die "make install failed"
76         dodoc CHANGELOG TODO
77         # All the good comments on duma build options are in the Makefile
78         newdoc Makefile Makefile.duma
79
80         if use examples; then
81             insinto /usr/share/doc/${P}/examples
82             doins example[1-6].cpp
83             doins example_makes/ex6/Makefile
84         fi
85 }