1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit autotools eutils multilib toolchain-funcs
7 DESCRIPTION="A Debug Malloc Library"
8 HOMEPAGE="http://dmalloc.com"
9 SRC_URI="http://dmalloc.com/releases/${P}.tgz"
11 LICENSE="CC-BY-SA-3.0"
13 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
14 IUSE="static-libs threads"
16 DEPEND="sys-apps/texinfo"
19 DOCS=( NEWS README docs/NOTES docs/TODO )
22 # - Build objects twice, once -fPIC for shared.
24 # - Fix SONAME and NEEDED.
25 epatch "${FILESDIR}"/${P}-Makefile.in.patch
27 # - Broken test, always returns false.
28 epatch "${FILESDIR}"/${P}-cxx.patch
29 epatch "${FILESDIR}"/${P}-ar.patch
31 # - Add threads support.
32 use threads && epatch "${FILESDIR}"/${P}-threads.patch
34 # strdup() strndup() macros
35 epatch "${FILESDIR}"/${P}-string-macros.patch
37 # Respect CFLAGS/LDFLAGS. #337429
39 -e '/libdmalloc/ s:$(CC):& $(CFLAGS) $(LDFLAGS):g' \
40 -e 's|ar cr|$(AR) cr|g' \
43 # Run autoconf for -cxx.patch.
49 econf --enable-cxx --enable-shlib $(use_enable threads)
56 makeinfo dmalloc.texi || die
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
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%%.*}
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%%.*}
82 if ! use static-libs; then
83 rm "${ED}"/usr/$(get_libdir)/lib${PN}*.a || die