1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils autotools vcs-snapshot
9 DESCRIPTION="A fork of mutt, the small but very powerful text-based mail client"
10 HOMEPAGE="https://github.com/karelzak/mutt-kz/wiki/"
11 GIT_REPO_URI="http://github.com/karelzak/${PN}"
12 GIT_COMMIT="12a7ab46c9155d674cf6f249e831983647f4b47c"
13 SRC_URI="${GIT_REPO_URI}/tarball/${GIT_COMMIT} -> ${P}.tar.gz"
17 KEYWORDS="~amd64 ~x86"
19 # TODO: implement "prefix" flag like in original mutt. Must test it first.
20 # TODO: test mbox flag
21 IUSE="berkdb crypt debug doc gdbm gnutls gpg idn imap notmuch mbox nls pop
22 qdbm sasl smime smtp ssl tokyocabinet"
24 # dependencies used several times
26 gnutls? ( >=net-libs/gnutls-1.0.17 )
27 !gnutls? ( ssl? ( >=dev-libs/openssl-0.9.6 ) )
28 sasl? ( >=dev-libs/cyrus-sasl-2 )"
32 >=sys-libs/ncurses-5.2
33 gpg? ( >=app-crypt/gpgme-0.9.0 )
34 idn? ( net-dns/libidn )
35 imap? ( ${RDEPEND_PROTOCOL} )
36 pop? ( ${RDEPEND_PROTOCOL} )
37 smime? ( >=dev-libs/openssl-0.9.6 )
38 smtp? ( ${RDEPEND_PROTOCOL} )
39 tokyocabinet? ( dev-db/tokyocabinet )
43 gdbm? ( sys-libs/gdbm )
44 !gdbm? ( berkdb? ( >=sys-libs/db-4 ) )
47 # unsure if mailbase only belongs to DEPEND
48 # unsure on mutt flag for net-mail/notmuch
49 # unsure on crypt dependency too
53 net-mail/notmuch[mutt]
54 crypt? ( net-mail/notmuch[crypt] )
58 app-text/docbook-xsl-stylesheets
61 || ( www-client/w3m www-client/elinks www-client/lynx )
67 # patch for a QA severe warning
68 # add Gentoo's progress bar, used in the sample .muttrc
69 epatch "${FILESDIR}/${P}"-severe-warnings.patch \
70 "${FILESDIR}/${P}"-progress-bar.patch
72 # patch version string for bug reports
73 sed -i -e 's/"Mutt %s (%s)"/"Mutt-KZ %s (%s, Gentoo '"${PVR}"')"/' \
74 muttlib.c || die "failed patching Gentoo version"
79 # many patches touch the buildsystem, we always need this
80 AT_M4DIR="m4" eautoreconf
82 # the configure script contains some "cleverness" whether or not to setgid
83 # the dotlock program, resulting in bugs like #278332
84 sed -i -e 's/@DOTLOCK_GROUP@//' \
85 Makefile.in || die "sed failed"
87 # don't just build documentation (lengthy process, with big dependencies)
89 sed -i -e '/SUBDIRS =/s/doc//' Makefile.in || die "sed failed"
95 $(use_enable crypt pgp) \
97 $(use_enable gpg gpgme) \
100 $(use_enable notmuch) \
102 $(use_enable smime) \
105 $(use_with !notmuch mixmaster) \
106 --enable-external-dotlock \
108 --sysconfdir="${EPREFIX}"/etc/${MY_PN} \
110 --with-docdir="${EPREFIX}"/usr/share/doc/${PF} \
112 --with-exec-shell="${EPREFIX}"/bin/sh"
116 # Solaris has no flock in the standard headers
117 myconf+=" --enable-fcntl --disable-flock"
120 myconf+=" --disable-fcntl --enable-flock"
124 # mutt prioritizes gdbm over bdb, so we will too.
125 # hcache feature requires at least one database is in USE.
126 if use tokyocabinet; then
127 myconf+=" --enable-hcache \
128 --with-tokyocabinet --without-qdbm --without-gdbm --without-bdb"
130 myconf+=" --enable-hcache \
131 --without-tokyocabinet --with-qdbm --without-gdbm --without-bdb"
133 myconf+=" --enable-hcache \
134 --without-tokyocabinet --without-qdbm --with-gdbm --without-bdb"
135 elif use berkdb; then
136 myconf+=" --enable-hcache \
137 --without-tokyocabinet --without-qdbm --without-gdbm --with-bdb"
139 myconf+=" --disable-hcache \
140 --without-tokyocabinet --without-qdbm --without-gdbm --without-bdb"
143 # there's no need for gnutls, ssl or sasl without socket support
144 if use pop || use imap || use smtp ; then
146 myconf+=" --with-gnutls"
148 myconf+=" --with-ssl"
150 # not sure if this should be mutually exclusive with the other two
151 myconf+=" $(use_with sasl)"
153 myconf+=" --without-gnutls --without-ssl --without-sasl"
157 myconf+=" --with-mailpath=${EPREFIX}/var/spool/mail"
159 myconf+=" --with-homespool=Maildir"
166 emake DESTDIR="${D}" install
168 insinto /etc/"${MY_PN}"
170 newins "${FILESDIR}"/Muttrc.mbox Muttrc
172 doins "${FILESDIR}"/Muttrc
175 # A newer file is provided by app-misc/mime-types. So we link it.
176 rm "${ED}"/etc/${MY_PN}/mime.types || die "Failed to delete file."
177 dosym /etc/mime.types /etc/${MY_PN}/mime.types
179 # A man-page is always handy, so fake one
181 emake -C doc muttrc.man
182 # make the fake slightly better, bug #413405
183 sed -e 's#@docdir@/manual.txt#http://www.mutt.org/doc/devel/manual.html#' \
184 -e 's#in @docdir@,#at http://www.mutt.org/,#' \
185 -e "s#@sysconfdir@#${EPREFIX}/etc/${MY_PN}#" \
186 -e "s#@bindir@#${EPREFIX}/usr/bin#" \
187 doc/mutt.man > mutt.1 || die "sed failed"
188 newman doc/muttbug.man flea.1
189 newman doc/muttrc.man muttrc.5
192 # nuke manpages that should be provided by an MTA, bug #177605
193 rm "${ED}"/usr/share/man/man5/{mbox,mmdf}.5 \
194 || die "failed to remove files, please file a bug"
197 dodoc BEWARE ChangeLog NEWS OPS* PATCHES README* TODO
202 elog "If you are new to mutt you may want to take a look at"
203 elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
204 elog " http://www.gentoo.org/doc/en/guide-to-mutt.xml"
207 if use notmuch ; then
208 # TODO: document a config that works out of the box with notmuch, please help ;)
209 elog "Note that you can use notmuch specific mutt config file, see -F <config> in"
210 elog "\"man mutt\" and also \"man muttrc\". It's also recomended to run \"notmuch setup\""
211 elog "and \"notmuch new\"."
217 einfo "`"${MY_PN}" -v`"