1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils flag-o-matic autotools
9 PATCHSET="gentoo-${PVR}/${PATCHREV}"
11 DESCRIPTION="A small but very powerful text-based mail client"
12 HOMEPAGE="http://www.mutt.org/"
13 MUTT_G_PATCHES="mutt-gentoo-${PV}-patches-${PATCHREV}.tar.xz"
14 SRC_URI="ftp://ftp.mutt.org/pub/mutt/${P}.tar.gz
15 https://bitbucket.org/${PN}/${PN}/downloads/${P}.tar.gz
16 https://dev.gentoo.org/~grobian/distfiles/${MUTT_G_PATCHES}"
17 IUSE="berkdb crypt debug doc gdbm gnutls gpg gpgme +hcache idn +imap kerberos libressl +lmdb mbox nls nntp notmuch pgp_classic pop qdbm +sasl selinux slang smime smime_classic +smtp +ssl tokyocabinet vanilla prefix"
18 # hcache: allow multiple, bug #607360
20 hcache? ( || ( berkdb gdbm lmdb qdbm tokyocabinet ) )
24 smime? ( ssl !gnutls )
25 smime_classic? ( ssl !gnutls )
27 sasl? ( || ( imap pop smtp nntp ) )
28 kerberos? ( || ( imap pop smtp nntp ) )"
31 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
32 # yes, we overdepend on the backend impls here, hopefully one day we can
33 # have REQUIRED_USE do what it is made for again. bug #607360
37 berkdb? ( >=sys-libs/db-4:= )
38 gdbm? ( sys-libs/gdbm )
39 lmdb? ( dev-db/lmdb:= )
41 tokyocabinet? ( dev-db/tokyocabinet )
44 gnutls? ( >=net-libs/gnutls-1.0.17:= )
46 libressl? ( dev-libs/libressl:= )
47 !libressl? ( >=dev-libs/openssl-0.9.6:0= )
51 nls? ( virtual/libintl )
52 sasl? ( >=dev-libs/cyrus-sasl-2 )
53 kerberos? ( virtual/krb5 )
54 idn? ( net-dns/libidn2 )
55 gpg? ( >=app-crypt/gpgme-0.9.0:= )
56 gpgme? ( >=app-crypt/gpgme-0.9.0:= )
57 notmuch? ( net-mail/notmuch:= )
58 slang? ( sys-libs/slang )
59 !slang? ( >=sys-libs/ncurses-5.2:0= )
66 app-text/docbook-xsl-stylesheets
67 || ( www-client/lynx www-client/w3m www-client/elinks )
70 selinux? ( sec-policy/selinux-mutt )
71 smime? ( || ( dev-libs/libressl >=dev-libs/openssl-0.9.6:0 ) )
72 smime_classic? ( || ( dev-libs/libressl >=dev-libs/openssl-0.9.6:0 ) )
73 crypt? ( app-crypt/gnupg )
74 pgp_classic? ( app-crypt/gnupg )
78 local PATCHDIR="${WORKDIR}"/mutt-gentoo-${PV}-patches-${PATCHREV}
80 if use !vanilla ; then
82 export EPATCH_FORCE="yes"
83 export EPATCH_SUFFIX="patch"
84 # http://hg.code.sf.net/p/gentoomuttpatches/code/file/mutt-1.10
93 for patchset in "${patches[@]}" ; do
94 [[ -d "${PATCHDIR}/${patchset}" ]] || continue
95 einfo "Patches for ${PATCHSET} patchset ${patchset}"
96 EPATCH_SOURCE="${PATCHDIR}"/${patchset} epatch \
97 || die "patchset ${patchset} failed"
99 # add some explanation as to why not to go upstream
101 -e '/ReachingUs = N_(/aThis release of Mutt is heavily enriched with patches.\\nFor this reason, any bugs are better reported at https://bugs.gentoo.org/\\nor re-emerge with USE=vanilla and try to reproduce your problem.\\n\\' \
102 main.c || die "Failed to add bug instructions"
107 eapply_user && upatches=" with user patches"
109 # patch version string for bug reports
111 use vanilla || patchset=", ${PATCHSET}"
112 sed -i -e 's|"Mutt %s (%s)"|"Mutt %s (%s'"${patchset}${upatches}"')"|' \
113 muttlib.c || die "failed patching in Gentoo version"
115 # many patches touch the buildsystem, we always need this
116 AT_M4DIR="m4" eautoreconf
118 # the configure script contains some "cleverness" whether or not to setgid
119 # the dotlock program, resulting in bugs like #278332
120 sed -i -e 's/@DOTLOCK_GROUP@//' Makefile.in || die "sed failed"
125 # signing and encryption
126 # clumpsy blocks for transition period of USE-flag renames
127 $(use crypt && use_enable crypt pgp)
128 $(use pgp_classic && use_enable pgp_classic pgp)
129 $(use !crypt && use !pgp_classic && echo "--disable-pgp")
131 $(use smime && use_enable smime)
132 $(use smime_classic && use_enable smime_classic smime)
133 $(use !smime && use !smime_classic && echo "--disable-smime")
135 $(use gpg && use_enable gpg gpgme)
136 $(use gpgme && use_enable gpgme)
137 $(use !gpg && use !gpgme && echo "--disable-gpgme")
143 $(use_enable notmuch)
151 $(use ssl && use gnutls && echo --with-gnutls --without-ssl)
152 $(use ssl && use !gnutls && echo --without-gnutls --with-ssl )
153 $(use !ssl && echo --without-gnutls --without-ssl)
156 $(use_with idn) --without-idn # avoid automagic libidn dep
157 $(use_with kerberos gss)
158 "$(use slang && echo --with-slang="${EPREFIX}"/usr || echo a=b)"
159 "$(use_with !slang curses "${EPREFIX}"/usr)"
161 "--enable-compressed"
162 "--enable-external-dotlock"
165 "--sysconfdir=${EPREFIX}/etc/${PN}"
166 "--with-docdir=${EPREFIX}/usr/share/doc/${PN}-${PVR}"
168 "--with-exec-shell=${EPREFIX}/bin/sh"
171 if [[ ${CHOST} == *-solaris2.* && ${CHOST#*-solaris2.} -le 10 ]] ; then
172 # arrows in index view do not show when using wchar_t
173 # or misalign due to wrong computations
174 myconf+=( "--without-wc-funcs" )
177 # note: REQUIRED_USE should have selected only one of these, but for
178 # bug #607360 we're forced to allow multiple. For that reason, this
179 # list is ordered to preference, and only the first is taken.
187 local ucache hcache lcache
188 for hcache in "${hcaches[@]}" ; do
189 if use ${hcache%%:*} ; then
194 if [[ -n ${ucache} ]] ; then
195 myconf+=( "--enable-hcache" )
197 myconf+=( "--disable-hcache" )
199 for hcache in "${hcaches[@]}" ; do
200 [[ ${hcache} == ${ucache} ]] \
201 && myconf+=( "--with-${hcache#*:}" ) \
202 || myconf+=( "--without-${hcache#*:}" )
206 myconf+=( "--with-mailpath=${EPREFIX}/var/spool/mail" )
208 myconf+=( "--with-homespool=Maildir" )
215 emake DESTDIR="${D}" install
218 newins "${FILESDIR}"/Muttrc.mbox Muttrc
221 doins "${FILESDIR}"/Muttrc
224 # A newer file is provided by app-misc/mime-types. So we link it.
225 rm "${ED}"/etc/${PN}/mime.types
226 dosym "${EPREFIX}"/etc/mime.types /etc/${PN}/mime.types
228 # A man-page is always handy, so fake one
230 emake -C doc DESTDIR="${D}" muttrc.man
231 # make the fake slightly better, bug #413405
232 sed -e 's#@docdir@/manual.txt#http://www.mutt.org/doc/devel/manual.html#' \
233 -e 's#in @docdir@,#at http://www.mutt.org/,#' \
234 -e "s#@sysconfdir@#${EPREFIX}/etc/${PN}#" \
235 -e "s#@bindir@#${EPREFIX}/usr/bin#" \
236 doc/mutt.man > mutt.1 || die
237 cp doc/muttrc.man muttrc.5 || die
238 doman mutt.1 muttrc.5
240 # nuke manpages that should be provided by an MTA, bug #177605
241 rm "${ED}"/usr/share/man/man5/{mbox,mmdf}.5 \
242 || ewarn "failed to remove files, please file a bug"
245 if use !prefix ; then
246 fowners root:mail /usr/bin/mutt_dotlock
247 fperms g+s /usr/bin/mutt_dotlock
250 dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
254 if [[ -z ${REPLACING_VERSIONS} ]] ; then
256 elog "If you are new to mutt you may want to take a look at"
257 elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
258 elog " https://wiki.gentoo.org/wiki/Mutt"
261 if use crypt || use gpg || use smime ; then
262 ewarn "Please note that the crypto related USE-flags of mutt have changed."
263 ewarn "To remove some unclarity, the following USE-flags are renamed:"
264 ewarn "(see https://bugs.gentoo.org/637176)"
265 ewarn " crypt -> pgp_classic"
266 ewarn " gpg -> gpgme"
267 ewarn " smime -> smime_classic"
268 ewarn "The old USE flags still work but their use is deprecated and will"
269 ewarn "be removed in a future release. Please update your package.use"
270 if use gpg && ( use crypt || use smime ) ; then
271 ewarn " Note that gpgme (old gpg) includes both pgp and smime"
272 ewarn " support. You can probably remove pgp_classic (old crypt)"
273 ewarn " and smime_classic (old smime) from your USE-flags and"
274 ewarn " only enable gpgme."
278 ewarn "Note: in order for Mutt to actually use the gpgme backend"
279 ewarn " you MUST include 'set crypt_use_gpgme=yes' in .muttrc"
280 ewarn " https://www.mutt.org/doc/manual/#crypt-use-gpgme"