]> Pileus Git - ~andy/sunrise/blob - mail-client/mutt-kz/mutt-kz-0_pre20120627.ebuild
app-accessibility/onboard: Update Manifest
[~andy/sunrise] / mail-client / mutt-kz / mutt-kz-0_pre20120627.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=4
6
7 inherit eutils autotools vcs-snapshot
8
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"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18
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"
23
24 # dependencies used several times
25 RDEPEND_PROTOCOL="
26         gnutls? ( >=net-libs/gnutls-1.0.17 )
27         !gnutls? ( ssl? ( >=dev-libs/openssl-0.9.6 ) )
28         sasl? ( >=dev-libs/cyrus-sasl-2 )"
29 RDEPEND="
30         app-misc/mime-types
31         !mail-client/mutt
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 )
40         !tokyocabinet? (
41                 qdbm? ( dev-db/qdbm )
42                 !qdbm? (
43                         gdbm? ( sys-libs/gdbm )
44                         !gdbm? ( berkdb? ( >=sys-libs/db-4 ) )
45                 )
46         )"
47 # unsure if mailbase only belongs to DEPEND
48 # unsure on mutt flag for net-mail/notmuch
49 # unsure on crypt dependency too
50 RDEPEND="${RDEPEND}
51         net-mail/mailbase
52         notmuch? (
53                 net-mail/notmuch[mutt]
54                 crypt? ( net-mail/notmuch[crypt] )
55         )"
56 DEPEND="${RDEPEND}
57         doc? (
58                 app-text/docbook-xsl-stylesheets
59                 dev-libs/libxml2
60                 dev-libs/libxslt
61                 || ( www-client/w3m www-client/elinks www-client/lynx )
62         )"
63
64 MY_PN="mutt"
65
66 src_prepare() {
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
71
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"
75
76         # allow user patches
77         epatch_user
78
79         # many patches touch the buildsystem, we always need this
80         AT_M4DIR="m4" eautoreconf
81
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"
86
87         # don't just build documentation (lengthy process, with big dependencies)
88         if use !doc ; then
89                 sed -i -e '/SUBDIRS =/s/doc//' Makefile.in || die "sed failed"
90         fi
91 }
92
93 src_configure() {
94         local myconf="
95                 $(use_enable crypt pgp) \
96                 $(use_enable debug) \
97                 $(use_enable gpg gpgme) \
98                 $(use_enable imap) \
99                 $(use_enable nls) \
100                 $(use_enable notmuch) \
101                 $(use_enable pop) \
102                 $(use_enable smime) \
103                 $(use_enable smtp) \
104                 $(use_with idn) \
105                 $(use_with !notmuch mixmaster) \
106                 --enable-external-dotlock \
107                 --enable-nfs-fix \
108                 --sysconfdir="${EPREFIX}"/etc/${MY_PN} \
109                 --with-curses \
110                 --with-docdir="${EPREFIX}"/usr/share/doc/${PF} \
111                 --with-regex \
112                 --with-exec-shell="${EPREFIX}"/bin/sh"
113
114         case $CHOST in
115                 *-solaris*)
116                         # Solaris has no flock in the standard headers
117                         myconf+=" --enable-fcntl --disable-flock"
118                 ;;
119                 *)
120                         myconf+=" --disable-fcntl --enable-flock"
121                 ;;
122         esac
123
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"
129         elif use qdbm; then
130                 myconf+=" --enable-hcache \
131                         --without-tokyocabinet --with-qdbm --without-gdbm --without-bdb"
132         elif use gdbm ; then
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"
138         else
139                 myconf+=" --disable-hcache \
140                         --without-tokyocabinet --without-qdbm --without-gdbm --without-bdb"
141         fi
142
143         # there's no need for gnutls, ssl or sasl without socket support
144         if use pop || use imap || use smtp ; then
145                 if use gnutls; then
146                         myconf+=" --with-gnutls"
147                 elif use ssl; then
148                         myconf+=" --with-ssl"
149                 fi
150                 # not sure if this should be mutually exclusive with the other two
151                 myconf+=" $(use_with sasl)"
152         else
153                 myconf+=" --without-gnutls --without-ssl --without-sasl"
154         fi
155
156         if use mbox; then
157                 myconf+=" --with-mailpath=${EPREFIX}/var/spool/mail"
158         else
159                 myconf+=" --with-homespool=Maildir"
160         fi
161
162         econf ${myconf}
163 }
164
165 src_install() {
166         emake DESTDIR="${D}" install
167
168         insinto /etc/"${MY_PN}"
169         if use mbox; then
170                 newins "${FILESDIR}"/Muttrc.mbox Muttrc
171         else
172                 doins "${FILESDIR}"/Muttrc
173         fi
174
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
178
179         # A man-page is always handy, so fake one
180         if use !doc; then
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
190                 doman mutt.1
191         else
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"
195         fi
196
197         dodoc BEWARE ChangeLog NEWS OPS* PATCHES README* TODO
198 }
199
200 pkg_postinst() {
201         echo
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"
205         echo
206
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\"."
212                 echo
213         fi
214 }
215
216 pkg_info() {
217         einfo "`"${MY_PN}" -v`"
218 }