1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils flag-o-matic autotools
10 PATCHSET="gentoo-${PVR}/${PATCHREV}"
12 DESCRIPTION="A small but very powerful text-based mail client"
13 HOMEPAGE="http://www.mutt.org/"
14 MUTT_G_PATCHES="mutt-gentoo-${PV}-patches-${PATCHREV}.tar.xz"
15 SRC_URI="ftp://ftp.mutt.org/pub/mutt/${P}.tar.gz
16 https://bitbucket.org/${PN}/${PN}/downloads/${P}.tar.gz
17 https://dev.gentoo.org/~grobian/distfiles/${MUTT_G_PATCHES}"
18 IUSE="berkdb crypt debug doc gdbm gnutls gpg idn imap kerberos libressl mbox nls nntp notmuch pop qdbm sasl selinux sidebar slang smime smtp ssl tokyocabinet vanilla"
21 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
24 nls? ( virtual/libintl )
25 tokyocabinet? ( dev-db/tokyocabinet )
29 gdbm? ( sys-libs/gdbm )
30 !gdbm? ( berkdb? ( >=sys-libs/db-4:= ) )
34 gnutls? ( >=net-libs/gnutls-1.0.17:= )
37 !libressl? ( >=dev-libs/openssl-0.9.6:0= )
38 libressl? ( dev-libs/libressl:= )
41 sasl? ( >=dev-libs/cyrus-sasl-2 )
43 kerberos? ( virtual/krb5 )
45 gnutls? ( >=net-libs/gnutls-1.0.17:= )
48 !libressl? ( >=dev-libs/openssl-0.9.6:0= )
49 libressl? ( dev-libs/libressl:= )
52 sasl? ( >=dev-libs/cyrus-sasl-2 )
55 gnutls? ( >=net-libs/gnutls-1.0.17:= )
58 !libressl? ( >=dev-libs/openssl-0.9.6:0= )
59 libressl? ( dev-libs/libressl:= )
62 sasl? ( >=dev-libs/cyrus-sasl-2 )
64 idn? ( net-dns/libidn )
65 gpg? ( >=app-crypt/gpgme-0.9.0:= )
67 !libressl? ( >=dev-libs/openssl-0.9.6:0= )
68 libressl? ( dev-libs/libressl:= )
70 notmuch? ( net-mail/notmuch:= )
71 slang? ( sys-libs/slang )
72 !slang? ( >=sys-libs/ncurses-5.2:0= )
79 app-text/docbook-xsl-stylesheets
80 || ( www-client/lynx www-client/w3m www-client/elinks )
83 selinux? ( sec-policy/selinux-mutt )
87 local PATCHDIR="${WORKDIR}"/gentoo-mutt-${PV}-patches
89 if use !vanilla ; then
91 export EPATCH_FORCE="yes"
92 export EPATCH_SUFFIX="patch"
101 for patchset in "${patches[@]}" ; do
102 einfo "Applying ${PATCHSET} patchset ${patchset}"
103 EPATCH_SOURCE="${PATCHDIR}"/${patchset} epatch \
104 || die "patchset ${patchset} failed"
106 # add some explanation as to why not to go upstream
108 -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\\' \
109 main.c || die "Failed to add bug instructions"
114 eapply_user && upatches=" with user patches"
116 # patch version string for bug reports
118 use vanilla || patchset=", ${PATCHSET}"
119 sed -i -e 's|"Mutt %s (%s)"|"Mutt %s (%s'"${patchset}${upatches}"')"|' \
120 muttlib.c || die "failed patching in Gentoo version"
122 # many patches touch the buildsystem, we always need this
123 AT_M4DIR="m4" eautoreconf
125 # the configure script contains some "cleverness" whether or not to setgid
126 # the dotlock program, resulting in bugs like #278332
127 sed -i -e 's/@DOTLOCK_GROUP@//' \
128 Makefile.in || die "sed failed"
133 "$(use_enable crypt pgp)"
134 "$(use_enable debug)"
136 "$(use_enable gpg gpgme)"
141 "$(use_enable sidebar)"
142 "$(use_enable smime)"
144 "$(use_enable notmuch)"
146 "$(use_with kerberos gss)"
147 "--with-$(use slang && echo slang || echo curses)=${EPREFIX}/usr"
148 "--enable-compressed"
149 "--enable-external-dotlock"
151 "--sysconfdir=${EPREFIX}/etc/${PN}"
152 "--with-docdir=${EPREFIX}/usr/share/doc/${PN}-${PVR}"
154 "--with-exec-shell=${EPREFIX}/bin/sh"
157 if [[ ${CHOST} == *-solaris* ]] ; then
158 # arrows in index view do not show when using wchar_t
159 myconf+=( "--without-wc-funcs" )
162 # mutt prioritizes gdbm over bdb, so we will too.
163 # hcache feature requires at least one database is in USE.
170 local ucache hcache lcache
171 for hcache in "${hcaches[@]}" ; do
172 if use ${hcache%%:*} ; then
177 if [[ -n ${ucache} ]] ; then
178 myconf+=( "--enable-hcache" )
180 myconf+=( "--disable-hcache" )
182 for hcache in "${hcaches[@]}" ; do
183 [[ ${hcache} == ${ucache} ]] \
184 && myconf+=( "--with-${hcache#*:}" ) \
185 || myconf+=( "--without-${hcache#*:}" )
188 # there's no need for gnutls, ssl or sasl without socket support
189 if use pop || use imap || use smtp ; then
191 myconf+=( "--with-gnutls" )
193 myconf+=( "--with-ssl" )
195 # not sure if this should be mutually exclusive with the other two
196 myconf+=( "$(use_with sasl)" )
206 myconf+=( "--with-mailpath=${EPREFIX}/var/spool/mail" )
208 myconf+=( "--with-homespool=Maildir" )
211 econf "${myconf[@]}" || die "configure failed"
215 emake DESTDIR="${D}" install || die "install failed"
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 /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 || die
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
237 cp doc/muttbug.man flea.1
238 cp doc/muttrc.man muttrc.5
239 doman mutt.1 flea.1 muttrc.5
241 # nuke manpages that should be provided by an MTA, bug #177605
242 rm "${ED}"/usr/share/man/man5/{mbox,mmdf}.5 \
243 || ewarn "failed to remove files, please file a bug"
246 if use !prefix ; then
247 fowners root:mail /usr/bin/mutt_dotlock
248 fperms g+s /usr/bin/mutt_dotlock
251 dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
255 if [[ -z ${REPLACING_VERSIONS} ]] ; then
257 elog "If you are new to mutt you may want to take a look at"
258 elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
259 elog " https://wiki.gentoo.org/wiki/Mutt"
264 for ver in ${REPLACING_VERSIONS} ; do
265 [[ ${ver} == "1.5"* || ${ver} == "1.6"* ]] && preconddate=true
267 if [[ -n ${preconddate} ]] ; then
269 elog "The SmartTime functionality has been replaced with"
270 elog "CondDate feature. To mimic SmartTime, use this CondDate formatter:"
271 elog "%<[12m?%<[7d?%<[12H?%[%H:%M ]&%[%a-%d]>&%[%d-%b]>&%[%b-%y]>"