mutt-1.7.2-r2.ebuild 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit eutils flag-o-matic autotools
  5. PATCHREV="r3"
  6. PATCHSET="gentoo-${PVR}/${PATCHREV}"
  7. DESCRIPTION="A small but very powerful text-based mail client"
  8. HOMEPAGE="http://www.mutt.org/"
  9. MUTT_G_PATCHES="mutt-gentoo-${PV}-patches-${PATCHREV}.tar.xz"
  10. SRC_URI="ftp://ftp.mutt.org/pub/mutt/${P}.tar.gz
  11. https://bitbucket.org/${PN}/${PN}/downloads/${P}.tar.gz
  12. https://dev.gentoo.org/~grobian/distfiles/${MUTT_G_PATCHES}"
  13. IUSE="berkdb crypt debug doc gdbm gnutls gpg +hcache idn imap kerberos libressl lmdb mbox nls nntp notmuch pop qdbm sasl selinux sidebar slang smime smtp ssl tokyocabinet vanilla"
  14. REQUIRED_USE="
  15. hcache? ( ^^ ( berkdb gdbm lmdb qdbm tokyocabinet ) )
  16. imap? ( ssl )
  17. pop? ( ssl )
  18. nntp? ( ssl )
  19. smime? ( ssl !gnutls )
  20. smtp? ( ssl )
  21. sasl? ( || ( imap pop smtp nntp ) )
  22. kerberos? ( || ( imap pop smtp nntp ) )"
  23. SLOT="0"
  24. LICENSE="GPL-2"
  25. 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"
  26. CDEPEND="
  27. app-misc/mime-types
  28. berkdb? ( >=sys-libs/db-4:= )
  29. gdbm? ( sys-libs/gdbm )
  30. lmdb? ( dev-db/lmdb:= )
  31. qdbm? ( dev-db/qdbm )
  32. tokyocabinet? ( dev-db/tokyocabinet )
  33. ssl? (
  34. gnutls? ( >=net-libs/gnutls-1.0.17:= )
  35. !gnutls? (
  36. libressl? ( dev-libs/libressl:= )
  37. !libressl? ( >=dev-libs/openssl-0.9.6:0= )
  38. )
  39. )
  40. nls? ( virtual/libintl )
  41. sasl? ( >=dev-libs/cyrus-sasl-2 )
  42. kerberos? ( virtual/krb5 )
  43. idn? ( net-dns/libidn )
  44. gpg? ( >=app-crypt/gpgme-0.9.0:= )
  45. notmuch? ( net-mail/notmuch:= )
  46. slang? ( sys-libs/slang )
  47. !slang? ( >=sys-libs/ncurses-5.2:0= )
  48. "
  49. DEPEND="${CDEPEND}
  50. net-mail/mailbase
  51. doc? (
  52. dev-libs/libxml2
  53. dev-libs/libxslt
  54. app-text/docbook-xsl-stylesheets
  55. || ( www-client/lynx www-client/w3m www-client/elinks )
  56. )"
  57. RDEPEND="${CDEPEND}
  58. selinux? ( sec-policy/selinux-mutt )
  59. "
  60. src_prepare() {
  61. local PATCHDIR="${WORKDIR}"/gentoo-mutt-${PV}-patches
  62. if use !vanilla ; then
  63. # apply patches
  64. export EPATCH_FORCE="yes"
  65. export EPATCH_SUFFIX="patch"
  66. # http://hg.code.sf.net/p/gentoomutt/code/file/gentoo-1.7
  67. # http://hg.code.sf.net/p/gentoomuttpatches/code/file/mutt-1.7
  68. local patches=(
  69. patches-mutt
  70. bugs-gentoo
  71. features-common
  72. features-extra
  73. gentoo
  74. )
  75. local patchset
  76. for patchset in "${patches[@]}" ; do
  77. einfo "Applying ${PATCHSET} patchset ${patchset}"
  78. EPATCH_SOURCE="${PATCHDIR}"/${patchset} epatch \
  79. || die "patchset ${patchset} failed"
  80. done
  81. # add some explanation as to why not to go upstream
  82. sed -i \
  83. -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\\' \
  84. main.c || die "Failed to add bug instructions"
  85. fi
  86. local upatches=
  87. # allow user patches
  88. eapply_user && upatches=" with user patches"
  89. # patch version string for bug reports
  90. local patchset=
  91. use vanilla || patchset=", ${PATCHSET}"
  92. sed -i -e 's|"Mutt %s (%s)"|"Mutt %s (%s'"${patchset}${upatches}"')"|' \
  93. muttlib.c || die "failed patching in Gentoo version"
  94. # many patches touch the buildsystem, we always need this
  95. AT_M4DIR="m4" eautoreconf
  96. # the configure script contains some "cleverness" whether or not to setgid
  97. # the dotlock program, resulting in bugs like #278332
  98. sed -i -e 's/@DOTLOCK_GROUP@//' \
  99. Makefile.in || die "sed failed"
  100. }
  101. src_configure() {
  102. local myconf=(
  103. "$(use_enable crypt pgp)"
  104. "$(use_enable debug)"
  105. "$(use_enable doc)"
  106. "$(use_enable gpg gpgme)"
  107. "$(use_enable nls)"
  108. "$(use_enable notmuch)"
  109. "$(use_enable sidebar)"
  110. "$(use_enable smime)"
  111. "$(use_enable imap)"
  112. "$(use_enable pop)"
  113. "$(use_enable nntp)"
  114. "$(use_enable smtp)"
  115. $(use ssl && use gnutls && echo --with-gnutls --without-ssl)
  116. $(use ssl && use !gnutls && echo --without-gnutls --with-ssl )
  117. $(use !ssl && echo --without-gnutls --without-ssl)
  118. "$(use_with idn)"
  119. "$(use_with kerberos gss)"
  120. "$(use_with sasl)"
  121. "$(use slang && echo --with-slang=${EPREFIX}/usr)"
  122. "$(use_with !slang curses ${EPREFIX}/usr)"
  123. "--enable-compressed"
  124. "--enable-external-dotlock"
  125. "--enable-nfs-fix"
  126. "--sysconfdir=${EPREFIX}/etc/${PN}"
  127. "--with-docdir=${EPREFIX}/usr/share/doc/${PN}-${PVR}"
  128. "--with-regex"
  129. "--with-exec-shell=${EPREFIX}/bin/sh"
  130. )
  131. if [[ ${CHOST} == *-solaris* ]] ; then
  132. # arrows in index view do not show when using wchar_t
  133. myconf+=( "--without-wc-funcs" )
  134. fi
  135. # REQUIRED_USE should have selected only one of these
  136. local hcaches=(
  137. "berkdb:bdb"
  138. "gdbm"
  139. "lmdb"
  140. "qdbm"
  141. "tokyocabinet"
  142. )
  143. local ucache hcache lcache
  144. for hcache in "${hcaches[@]}" ; do
  145. if use ${hcache%%:*} ; then
  146. ucache=${hcache}
  147. break
  148. fi
  149. done
  150. if [[ -n ${ucache} ]] ; then
  151. myconf+=( "--enable-hcache" )
  152. else
  153. myconf+=( "--disable-hcache" )
  154. fi
  155. for hcache in "${hcaches[@]}" ; do
  156. [[ ${hcache} == ${ucache} ]] \
  157. && myconf+=( "--with-${hcache#*:}" ) \
  158. || myconf+=( "--without-${hcache#*:}" )
  159. done
  160. if use mbox; then
  161. myconf+=( "--with-mailpath=${EPREFIX}/var/spool/mail" )
  162. else
  163. myconf+=( "--with-homespool=Maildir" )
  164. fi
  165. econf "${myconf[@]}" || die "configure failed"
  166. }
  167. src_install() {
  168. emake DESTDIR="${D}" install || die "install failed"
  169. if use mbox; then
  170. insinto /etc/mutt
  171. newins "${FILESDIR}"/Muttrc.mbox Muttrc
  172. else
  173. insinto /etc/mutt
  174. doins "${FILESDIR}"/Muttrc
  175. fi
  176. # A newer file is provided by app-misc/mime-types. So we link it.
  177. rm "${ED}"/etc/${PN}/mime.types
  178. dosym /etc/mime.types /etc/${PN}/mime.types
  179. # A man-page is always handy, so fake one
  180. if use !doc; then
  181. emake -C doc DESTDIR="${D}" muttrc.man || die
  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/${PN}#" \
  186. -e "s#@bindir@#${EPREFIX}/usr/bin#" \
  187. doc/mutt.man > mutt.1
  188. cp doc/muttbug.man flea.1
  189. cp doc/muttrc.man muttrc.5
  190. doman mutt.1 flea.1 muttrc.5
  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. || ewarn "failed to remove files, please file a bug"
  195. fi
  196. if use !prefix ; then
  197. fowners root:mail /usr/bin/mutt_dotlock
  198. fperms g+s /usr/bin/mutt_dotlock
  199. fi
  200. dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
  201. }
  202. pkg_postinst() {
  203. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  204. echo
  205. elog "If you are new to mutt you may want to take a look at"
  206. elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
  207. elog " https://wiki.gentoo.org/wiki/Mutt"
  208. echo
  209. else
  210. local ver
  211. local preconddate=
  212. for ver in ${REPLACING_VERSIONS} ; do
  213. [[ ${ver} == "1.5"* || ${ver} == "1.6"* ]] && preconddate=true
  214. done
  215. if [[ -n ${preconddate} ]] ; then
  216. echo
  217. elog "The SmartTime functionality has been replaced with"
  218. elog "CondDate feature. To mimic SmartTime, use this CondDate formatter:"
  219. elog "%<[12m?%<[7d?%<[12H?%[%H:%M ]&%[%a-%d]>&%[%d-%b]>&%[%b-%y]>"
  220. echo
  221. fi
  222. fi
  223. }