net-mail/tnef: sparc stable wrt bug #701816
[gentoo.git] / net-mail / metamail / metamail-2.7.53.3-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools toolchain-funcs
7
8 MY_PV=$(ver_cut 1-2)
9 DEB_PV=${MY_PV}-$(ver_cut 3)
10
11 DESCRIPTION="Metamail (with Debian patches) - Generic MIME package"
12 HOMEPAGE="http://ftp.funet.fi/pub/unix/mail/metamail/"
13 SRC_URI="http://ftp.funet.fi/pub/unix/mail/metamail/mm${MY_PV}.tar.Z
14         mirror://debian/pool/main/m/metamail/metamail_${DEB_PV}.diff.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="~alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86"
19 IUSE="static-libs"
20
21 DEPEND="sys-libs/ncurses
22         app-arch/sharutils
23         net-mail/mailbase"
24 RDEPEND="app-misc/mime-types
25         sys-apps/debianutils
26         !app-misc/run-mailcap"
27
28 S=${WORKDIR}/mm${MY_PV}/src
29
30 src_prepare() {
31         eapply "${WORKDIR}"/metamail_${DEB_PV}.diff
32         eapply "${FILESDIR}"/${PN}-2.7.45.3-CVE-2006-0709.patch
33         eapply "${FILESDIR}"/${P}-glibc-2.10.patch
34
35         # respect CFLAGS
36         sed -i -e 's/CFLAGS/LIBS/' \
37                 "${S}"/src/{metamail,richmail}/Makefile.am || die
38
39         # add missing include - QA
40         sed -i -e '/config.h/a #include <string.h>' \
41                 "${S}"/src/metamail/shared.c || die
42
43         # Fix building with ncurses[tinfo]
44         sed -i -e "s/-lncurses/$($(tc-getPKG_CONFIG) --libs ncurses)/" \
45                 src/richmail/Makefile.am \
46                 src/metamail/Makefile.am || die
47
48         eapply_user
49         eautoreconf
50         chmod +x "${S}"/configure
51 }
52
53 src_configure() {
54         econf $(use_enable static-libs static)
55 }
56
57 src_compile() {
58         emake CC=$(tc-getCC) CFLAGS="${CFLAGS}"
59 }
60
61 src_install() {
62         emake DESTDIR="${D}" install
63         dodoc CREDITS README
64         rm man/mmencode.1
65         rm man/mailcap.5
66         doman man/* debian/mimencode.1 debian/mimeit.1
67
68         use static-libs || find "${D}"/usr/lib* -name '*.la' -delete
69 }