mutt-1.8.0-r1.ebuild 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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="r1"
  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}"/mutt-gentoo-${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.8
  67. # http://hg.code.sf.net/p/gentoomuttpatches/code/file/mutt-1.8
  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. [[ -d "${PATCHDIR}/${patchset}" ]] || continue
  78. einfo "Applying ${PATCHSET} patchset ${patchset}"
  79. EPATCH_SOURCE="${PATCHDIR}"/${patchset} epatch \
  80. || die "patchset ${patchset} failed"
  81. done
  82. # add some explanation as to why not to go upstream
  83. sed -i \
  84. -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\\' \
  85. main.c || die "Failed to add bug instructions"
  86. fi
  87. local upatches=
  88. # allow user patches
  89. eapply_user && upatches=" with user patches"
  90. # patch version string for bug reports
  91. local patchset=
  92. use vanilla || patchset=", ${PATCHSET}"
  93. sed -i -e 's|"Mutt %s (%s)"|"Mutt %s (%s'"${patchset}${upatches}"')"|' \
  94. muttlib.c || die "failed patching in Gentoo version"
  95. # many patches touch the buildsystem, we always need this
  96. AT_M4DIR="m4" eautoreconf
  97. # the configure script contains some "cleverness" whether or not to setgid
  98. # the dotlock program, resulting in bugs like #278332
  99. sed -i -e 's/@DOTLOCK_GROUP@//' \
  100. Makefile.in || die "sed failed"
  101. }
  102. src_configure() {
  103. local myconf=(
  104. "$(use_enable crypt pgp)"
  105. "$(use_enable debug)"
  106. "$(use_enable doc)"
  107. "$(use_enable gpg gpgme)"
  108. "$(use_enable nls)"
  109. "$(use_enable notmuch)"
  110. "$(use_enable sidebar)"
  111. "$(use_enable smime)"
  112. "$(use_enable imap)"
  113. "$(use_enable pop)"
  114. "$(use_enable nntp)"
  115. "$(use_enable smtp)"
  116. $(use ssl && use gnutls && echo --with-gnutls --without-ssl)
  117. $(use ssl && use !gnutls && echo --without-gnutls --with-ssl )
  118. $(use !ssl && echo --without-gnutls --without-ssl)
  119. "$(use_with idn)"
  120. "$(use_with kerberos gss)"
  121. "$(use_with sasl)"
  122. "$(use slang && echo --with-slang=${EPREFIX}/usr)"
  123. "$(use_with !slang curses ${EPREFIX}/usr)"
  124. "--enable-compressed"
  125. "--enable-external-dotlock"
  126. "--enable-nfs-fix"
  127. "--sysconfdir=${EPREFIX}/etc/${PN}"
  128. "--with-docdir=${EPREFIX}/usr/share/doc/${PN}-${PVR}"
  129. "--with-regex"
  130. "--with-exec-shell=${EPREFIX}/bin/sh"
  131. )
  132. if [[ ${CHOST} == *-solaris* ]] ; then
  133. # arrows in index view do not show when using wchar_t
  134. myconf+=( "--without-wc-funcs" )
  135. fi
  136. # REQUIRED_USE should have selected only one of these
  137. local hcaches=(
  138. "berkdb:bdb"
  139. "gdbm"
  140. "lmdb"
  141. "qdbm"
  142. "tokyocabinet"
  143. )
  144. local ucache hcache lcache
  145. for hcache in "${hcaches[@]}" ; do
  146. if use ${hcache%%:*} ; then
  147. ucache=${hcache}
  148. break
  149. fi
  150. done
  151. if [[ -n ${ucache} ]] ; then
  152. myconf+=( "--enable-hcache" )
  153. else
  154. myconf+=( "--disable-hcache" )
  155. fi
  156. for hcache in "${hcaches[@]}" ; do
  157. [[ ${hcache} == ${ucache} ]] \
  158. && myconf+=( "--with-${hcache#*:}" ) \
  159. || myconf+=( "--without-${hcache#*:}" )
  160. done
  161. if use mbox; then
  162. myconf+=( "--with-mailpath=${EPREFIX}/var/spool/mail" )
  163. else
  164. myconf+=( "--with-homespool=Maildir" )
  165. fi
  166. econf "${myconf[@]}" || die "configure failed"
  167. }
  168. src_install() {
  169. emake DESTDIR="${D}" install || die "install failed"
  170. if use mbox; then
  171. insinto /etc/mutt
  172. newins "${FILESDIR}"/Muttrc.mbox Muttrc
  173. else
  174. insinto /etc/mutt
  175. doins "${FILESDIR}"/Muttrc
  176. fi
  177. # A newer file is provided by app-misc/mime-types. So we link it.
  178. rm "${ED}"/etc/${PN}/mime.types
  179. dosym /etc/mime.types /etc/${PN}/mime.types
  180. # A man-page is always handy, so fake one
  181. if use !doc; then
  182. emake -C doc DESTDIR="${D}" muttrc.man || die
  183. # make the fake slightly better, bug #413405
  184. sed -e 's#@docdir@/manual.txt#http://www.mutt.org/doc/devel/manual.html#' \
  185. -e 's#in @docdir@,#at http://www.mutt.org/,#' \
  186. -e "s#@sysconfdir@#${EPREFIX}/etc/${PN}#" \
  187. -e "s#@bindir@#${EPREFIX}/usr/bin#" \
  188. doc/mutt.man > mutt.1
  189. cp doc/muttbug.man flea.1
  190. cp doc/muttrc.man muttrc.5
  191. doman mutt.1 flea.1 muttrc.5
  192. else
  193. # nuke manpages that should be provided by an MTA, bug #177605
  194. rm "${ED}"/usr/share/man/man5/{mbox,mmdf}.5 \
  195. || ewarn "failed to remove files, please file a bug"
  196. fi
  197. if use !prefix ; then
  198. fowners root:mail /usr/bin/mutt_dotlock
  199. fperms g+s /usr/bin/mutt_dotlock
  200. fi
  201. dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
  202. }
  203. pkg_postinst() {
  204. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  205. echo
  206. elog "If you are new to mutt you may want to take a look at"
  207. elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
  208. elog " https://wiki.gentoo.org/wiki/Mutt"
  209. echo
  210. else
  211. local ver
  212. local preconddate=
  213. for ver in ${REPLACING_VERSIONS} ; do
  214. [[ ${ver} == "1.5"* || ${ver} == "1.6"* ]] && preconddate=true
  215. done
  216. if [[ -n ${preconddate} ]] ; then
  217. echo
  218. elog "The SmartTime functionality has been replaced with"
  219. elog "CondDate feature. To mimic SmartTime, use this CondDate formatter:"
  220. elog "%<[12m?%<[7d?%<[12H?%[%H:%M ]&%[%a-%d]>&%[%d-%b]>&%[%b-%y]>"
  221. echo
  222. fi
  223. fi
  224. }