dev-libs/dmalloc: stable 5.5.2-r7 for hppa, bug #702404
[gentoo.git] / dev-libs / dmalloc / dmalloc-5.5.2-r6.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 inherit autotools eutils multilib toolchain-funcs
6
7 DESCRIPTION="A Debug Malloc Library"
8 HOMEPAGE="http://dmalloc.com"
9 SRC_URI="http://dmalloc.com/releases/${P}.tgz"
10
11 LICENSE="CC-BY-SA-3.0"
12 SLOT="0"
13 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
14 IUSE="static-libs threads"
15
16 DEPEND="sys-apps/texinfo"
17 RDEPEND=""
18
19 DOCS=( NEWS README docs/NOTES docs/TODO )
20
21 src_prepare() {
22         # - Build objects twice, once -fPIC for shared.
23         # - Use DESTDIR.
24         # - Fix SONAME and NEEDED.
25         epatch "${FILESDIR}"/${P}-Makefile.in.patch
26
27         # - Broken test, always returns false.
28         epatch "${FILESDIR}"/${P}-cxx.patch
29         epatch "${FILESDIR}"/${P}-ar.patch
30
31         # - Add threads support.
32         use threads && epatch "${FILESDIR}"/${P}-threads.patch
33
34         # strdup() strndup() macros
35         epatch "${FILESDIR}"/${P}-string-macros.patch
36
37         # Respect CFLAGS/LDFLAGS. #337429
38         sed -i \
39                 -e '/libdmalloc/ s:$(CC):& $(CFLAGS) $(LDFLAGS):g' \
40                 -e 's|ar cr|$(AR) cr|g' \
41                 Makefile.in || die
42
43         # Run autoconf for -cxx.patch.
44         eautoconf
45 }
46
47 src_configure() {
48         tc-export AR
49         econf --enable-cxx --enable-shlib $(use_enable threads)
50 }
51
52 src_compile() {
53         default
54
55         cd docs
56         makeinfo dmalloc.texi || die
57 }
58
59 src_test() {
60         emake heavy
61 }
62
63 src_install() {
64         default
65
66         newdoc ChangeLog.1 ChangeLog
67         insinto /usr/share/doc/${PF}
68         doins docs/dmalloc.pdf
69         dohtml RELEASE.html docs/dmalloc.html
70         doinfo docs/dmalloc.info
71
72         # add missing symlinks, lazy
73         dosym lib${PN}.so.${PV} /usr/$(get_libdir)/lib${PN}.so
74         dosym lib${PN}.so.${PV} /usr/$(get_libdir)/lib${PN}.so.${PV%%.*}
75
76         for lib in cxx th thcxx; do
77                 dosym lib${PN}${lib}.so.${PV} /usr/$(get_libdir)/lib${PN}${lib}.so
78                 dosym lib${PN}${lib}.so.${PV} \
79                         /usr/$(get_libdir)/lib${PN}${lib}.so.${PV%%.*}
80         done
81
82         if ! use static-libs; then
83                 rm "${ED}"/usr/$(get_libdir)/lib${PN}*.a || die
84         fi
85 }