mutt-1.5.24-r2.ebuild 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils flag-o-matic autotools
  5. PATCHSET_REV="-r1"
  6. DESCRIPTION="A small but very powerful text-based mail client"
  7. HOMEPAGE="http://www.mutt.org/"
  8. SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
  9. https://bitbucket.org/${PN}/${PN}/downloads/${P}.tar.gz
  10. ftp://ftp.mutt.org/pub/mutt/${P}.tar.gz
  11. mirror://gentoo/${P}-gentoo-patches${PATCHSET_REV}.tar.bz2
  12. https://dev.gentoo.org/~grobian/distfiles/${P}-gentoo-patches${PATCHSET_REV}.tar.bz2"
  13. IUSE="berkdb crypt debug doc gdbm gnutls gpg idn imap kerberos libressl mbox nls nntp pop qdbm sasl selinux sidebar slang smime smtp ssl tokyocabinet"
  14. SLOT="0"
  15. LICENSE="GPL-2"
  16. KEYWORDS="alpha amd64 arm hppa ~ia64 ~mips ppc ppc64 ~sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  17. CDEPEND="
  18. app-misc/mime-types
  19. nls? ( virtual/libintl )
  20. tokyocabinet? ( dev-db/tokyocabinet )
  21. !tokyocabinet? (
  22. qdbm? ( dev-db/qdbm )
  23. !qdbm? (
  24. gdbm? ( sys-libs/gdbm )
  25. !gdbm? ( berkdb? ( >=sys-libs/db-4:= ) )
  26. )
  27. )
  28. imap? (
  29. gnutls? ( >=net-libs/gnutls-1.0.17:= )
  30. !gnutls? (
  31. ssl? (
  32. !libressl? ( >=dev-libs/openssl-0.9.6:0= )
  33. libressl? ( dev-libs/libressl:= )
  34. )
  35. )
  36. sasl? ( >=dev-libs/cyrus-sasl-2 )
  37. )
  38. kerberos? ( virtual/krb5 )
  39. pop? (
  40. gnutls? ( >=net-libs/gnutls-1.0.17:= )
  41. !gnutls? (
  42. ssl? (
  43. !libressl? ( >=dev-libs/openssl-0.9.6:0= )
  44. libressl? ( dev-libs/libressl:= )
  45. )
  46. )
  47. sasl? ( >=dev-libs/cyrus-sasl-2 )
  48. )
  49. smtp? (
  50. gnutls? ( >=net-libs/gnutls-1.0.17:= )
  51. !gnutls? (
  52. ssl? (
  53. !libressl? ( >=dev-libs/openssl-0.9.6:0= )
  54. libressl? ( dev-libs/libressl:= )
  55. )
  56. )
  57. sasl? ( >=dev-libs/cyrus-sasl-2 )
  58. )
  59. idn? ( net-dns/libidn )
  60. gpg? ( >=app-crypt/gpgme-0.9.0 <app-crypt/gpgme-1.8.0 )
  61. smime? (
  62. !libressl? ( >=dev-libs/openssl-0.9.6:0= )
  63. libressl? ( dev-libs/libressl:= )
  64. )
  65. slang? ( sys-libs/slang )
  66. !slang? ( >=sys-libs/ncurses-5.2:0= )
  67. "
  68. DEPEND="${CDEPEND}
  69. net-mail/mailbase
  70. doc? (
  71. dev-libs/libxml2
  72. dev-libs/libxslt
  73. app-text/docbook-xsl-stylesheets
  74. || ( www-client/lynx www-client/w3m www-client/elinks )
  75. )"
  76. RDEPEND="${CDEPEND}
  77. selinux? ( sec-policy/selinux-mutt )
  78. "
  79. PATCHDIR="${WORKDIR}"/${P}-gentoo-patches${PATCHSET_REV}
  80. src_prepare() {
  81. # Post-release hot-fixes grabbed from HG, this is what all following
  82. # patches are based on in my Mercurial patchqueue (mq).
  83. # If you ever take over or need to modify patches here, just check
  84. # out the gentoo branch(es) of Gentoo's Mutt Mercurial clone, and
  85. # the patchqueue as it'll save you a lot of work.
  86. # http://hg.code.sf.net/p/gentoomutt/code/
  87. # http://hg.code.sf.net/p/gentoomuttpatches/code/
  88. for rev in $(eval echo {0..${PR#r}}) ; do
  89. local revpatch="${PATCHDIR}"/mutt-gentoo-${PV}-r${rev}.patch
  90. [[ -e ${revpatch} ]] && \
  91. epatch "${revpatch}"
  92. done
  93. # fix compilation with ncurses[tinfo], #459260
  94. epatch "${PATCHDIR}"/ncurses-tinfo.patch
  95. # this patch is non-generic and only works because we use a sysconfdir
  96. # different from the one used by the mailbase ebuild
  97. use prefix && epatch "${PATCHDIR}"/prefix-mailcap.patch
  98. # must have fixes to compile or behave correctly, upstream
  99. # ignores, disagrees or simply doesn't respond/apply
  100. epatch "${PATCHDIR}"/bdb-prefix.patch # fix bdb detection
  101. # same category, but functional bits
  102. epatch "${PATCHDIR}"/dont-reveal-bbc.patch
  103. # the big feature patches that upstream doesn't want to include, but
  104. # nearly every distro has due to their usefulness
  105. for p in "${PATCHDIR}"/[0-9][0-9]-*.patch ; do
  106. epatch "${p}"
  107. done
  108. # we conditionalise this one, simply because it has considerable
  109. # impact on the code
  110. if use sidebar ; then
  111. epatch "${PATCHDIR}"/sidebar-20140412.patch
  112. epatch "${PATCHDIR}"/sidebar-dotpathsep.patch
  113. epatch "${PATCHDIR}"/sidebar-counts.patch
  114. fi
  115. local upatches=
  116. # allow user patches
  117. epatch_user && upatches=" with user patches"
  118. # patch version string for bug reports
  119. sed -i -e 's/"Mutt %s (%s)"/"Mutt %s (%s, Gentoo '"${PVR}${upatches}"')"/' \
  120. muttlib.c || die "failed patching in Gentoo version"
  121. # many patches touch the buildsystem, we always need this
  122. AT_M4DIR="m4" eautoreconf
  123. # the configure script contains some "cleverness" whether or not to setgid
  124. # the dotlock program, resulting in bugs like #278332
  125. sed -i -e 's/@DOTLOCK_GROUP@//' \
  126. Makefile.in || die "sed failed"
  127. # don't just build documentation (lengthy process, with big dependencies)
  128. if use !doc ; then
  129. sed -i -e '/SUBDIRS =/s/doc//' Makefile.in || die
  130. fi
  131. }
  132. src_configure() {
  133. local myconf="
  134. $(use_enable crypt pgp) \
  135. $(use_enable debug) \
  136. $(use_enable gpg gpgme) \
  137. $(use_enable imap) \
  138. $(use_enable nls) \
  139. $(use_enable nntp) \
  140. $(use_enable pop) \
  141. $(use_enable smime) \
  142. $(use_enable smtp) \
  143. $(use_with idn) \
  144. $(use_with kerberos gss) \
  145. $(use slang && echo --with-slang=${EPREFIX}/usr) \
  146. $(use !slang && echo --with-curses=${EPREFIX}/usr) \
  147. --enable-compressed \
  148. --enable-external-dotlock \
  149. --enable-nfs-fix \
  150. --sysconfdir=${EPREFIX}/etc/${PN} \
  151. --with-docdir=${EPREFIX}/usr/share/doc/${PN}-${PVR} \
  152. --with-regex \
  153. --with-exec-shell=${EPREFIX}/bin/sh"
  154. case $CHOST in
  155. *-solaris*)
  156. # Solaris has no flock in the standard headers
  157. myconf+=" --enable-fcntl --disable-flock"
  158. # wchar_t depends on locale
  159. myconf+=" --without-wc-funcs"
  160. ;;
  161. *)
  162. myconf+=" --disable-fcntl --enable-flock"
  163. ;;
  164. esac
  165. # mutt prioritizes gdbm over bdb, so we will too.
  166. # hcache feature requires at least one database is in USE.
  167. if use tokyocabinet; then
  168. myconf="${myconf} --enable-hcache \
  169. --with-tokyocabinet --without-qdbm --without-gdbm --without-bdb"
  170. elif use qdbm; then
  171. myconf="${myconf} --enable-hcache \
  172. --without-tokyocabinet --with-qdbm --without-gdbm --without-bdb"
  173. elif use gdbm ; then
  174. myconf="${myconf} --enable-hcache \
  175. --without-tokyocabinet --without-qdbm --with-gdbm --without-bdb"
  176. elif use berkdb; then
  177. myconf="${myconf} --enable-hcache \
  178. --without-tokyocabinet --without-qdbm --without-gdbm --with-bdb"
  179. else
  180. myconf="${myconf} --disable-hcache \
  181. --without-tokyocabinet --without-qdbm --without-gdbm --without-bdb"
  182. fi
  183. # there's no need for gnutls, ssl or sasl without socket support
  184. if use pop || use imap || use smtp ; then
  185. if use gnutls; then
  186. myconf="${myconf} --with-gnutls"
  187. elif use ssl; then
  188. myconf="${myconf} --with-ssl"
  189. fi
  190. # not sure if this should be mutually exclusive with the other two
  191. myconf="${myconf} $(use_with sasl)"
  192. else
  193. myconf="${myconf} --without-gnutls --without-ssl --without-sasl"
  194. fi
  195. if use mbox; then
  196. myconf="${myconf} --with-mailpath=${EPREFIX}/var/spool/mail"
  197. else
  198. myconf="${myconf} --with-homespool=Maildir"
  199. fi
  200. econf ${myconf} || die "configure failed"
  201. }
  202. src_install() {
  203. emake DESTDIR="${D}" install || die "install failed"
  204. if use mbox; then
  205. insinto /etc/mutt
  206. newins "${FILESDIR}"/Muttrc.mbox Muttrc
  207. else
  208. insinto /etc/mutt
  209. doins "${FILESDIR}"/Muttrc
  210. fi
  211. # A newer file is provided by app-misc/mime-types. So we link it.
  212. rm "${ED}"/etc/${PN}/mime.types
  213. dosym /etc/mime.types /etc/${PN}/mime.types
  214. # A man-page is always handy, so fake one
  215. if use !doc; then
  216. emake -C doc DESTDIR="${D}" muttrc.man || die
  217. # make the fake slightly better, bug #413405
  218. sed -e 's#@docdir@/manual.txt#http://www.mutt.org/doc/devel/manual.html#' \
  219. -e 's#in @docdir@,#at http://www.mutt.org/,#' \
  220. -e "s#@sysconfdir@#${EPREFIX}/etc/${PN}#" \
  221. -e "s#@bindir@#${EPREFIX}/usr/bin#" \
  222. doc/mutt.man > mutt.1
  223. cp doc/muttbug.man flea.1
  224. cp doc/muttrc.man muttrc.5
  225. doman mutt.1 flea.1 muttrc.5
  226. else
  227. # nuke manpages that should be provided by an MTA, bug #177605
  228. rm "${ED}"/usr/share/man/man5/{mbox,mmdf}.5 \
  229. || ewarn "failed to remove files, please file a bug"
  230. fi
  231. if use !prefix ; then
  232. fowners root:mail /usr/bin/mutt_dotlock
  233. fperms g+s /usr/bin/mutt_dotlock
  234. fi
  235. dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
  236. }
  237. pkg_postinst() {
  238. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  239. echo
  240. elog "If you are new to mutt you may want to take a look at"
  241. elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
  242. elog " https://wiki.gentoo.org/wiki/Mutt"
  243. echo
  244. fi
  245. }