notmuch-0.21.ebuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. DISTUTILS_OPTIONAL=1
  5. PYTHON_COMPAT=( python{2_7,3_4} )
  6. inherit bash-completion-r1 elisp-common eutils flag-o-matic pax-utils \
  7. distutils-r1 toolchain-funcs
  8. DESCRIPTION="Thread-based e-mail indexer, supporting quick search and tagging"
  9. HOMEPAGE="http://notmuchmail.org/"
  10. SRC_URI="${HOMEPAGE%/}/releases/${P}.tar.gz"
  11. LICENSE="GPL-3"
  12. # Sub-slot corresponds to major wersion of libnotmuch.so.X.Y. Bump of Y is
  13. # meant to be binary backward compatible.
  14. SLOT="0/4"
  15. KEYWORDS="amd64 x86"
  16. REQUIRED_USE="
  17. nmbug? ( python )
  18. python? ( ${PYTHON_REQUIRED_USE} )
  19. test? ( crypt debug emacs python )
  20. "
  21. IUSE="crypt debug doc emacs mutt nmbug python test"
  22. CDEPEND="
  23. !!<app-shells/bash-completion-1.9
  24. >=dev-libs/glib-2.22
  25. >=dev-libs/gmime-2.6.7
  26. !=dev-libs/gmime-2.6.19
  27. <dev-libs/xapian-1.3
  28. dev-python/sphinx[${PYTHON_USEDEP}]
  29. >=sys-libs/zlib-1.2.5.2
  30. sys-libs/talloc
  31. debug? ( dev-util/valgrind )
  32. emacs? ( >=virtual/emacs-23 )
  33. python? ( ${PYTHON_DEPS} )
  34. x86? ( >=dev-libs/xapian-1.2.7-r2 )
  35. "
  36. DEPEND="${CDEPEND}
  37. virtual/pkgconfig
  38. doc? ( app-doc/doxygen )
  39. test? ( app-misc/dtach || ( >=app-editors/emacs-23[libxml2]
  40. >=app-editors/emacs-vcs-23[libxml2] ) sys-devel/gdb )
  41. "
  42. RDEPEND="${CDEPEND}
  43. crypt? ( app-crypt/gnupg )
  44. nmbug? ( dev-vcs/git )
  45. mutt? ( dev-perl/File-Which dev-perl/Mail-Box dev-perl/MailTools
  46. dev-perl/String-ShellQuote dev-perl/Term-ReadLine-Gnu
  47. virtual/perl-Digest-SHA virtual/perl-File-Path virtual/perl-Getopt-Long
  48. virtual/perl-Pod-Parser
  49. )
  50. "
  51. DOCS=( AUTHORS NEWS README )
  52. SITEFILE="50${PN}-gentoo.el"
  53. MY_LD_LIBRARY_PATH="${WORKDIR}/${P}/lib"
  54. MY_PATCHES=( )
  55. bindings() {
  56. local ret=0
  57. if use $1; then
  58. pushd bindings/$1 || die
  59. shift
  60. "$@"
  61. ret=$?
  62. popd || die
  63. fi
  64. return $ret
  65. }
  66. pkg_pretend() {
  67. if has_version '<net-mail/notmuch-0.18'; then
  68. ewarn
  69. ewarn "There are few not backward compatible changes between"
  70. ewarn "<notmuch-0.18 and >=notmuch-0.18. See NEWS file"
  71. ewarn "(0.18 section) for details before first use!"
  72. ewarn
  73. fi
  74. }
  75. pkg_setup() {
  76. if use emacs; then
  77. elisp-need-emacs 23 || die "Emacs version too low"
  78. fi
  79. }
  80. src_prepare() {
  81. [[ "${MY_PATCHES[@]}" ]] && epatch "${MY_PATCHES[@]}"
  82. bindings python distutils-r1_src_prepare
  83. bindings python mv README README-python || die
  84. mv contrib/notmuch-mutt/README contrib/notmuch-mutt/README-mutt || die
  85. # assure that new Makefile.config will be generated
  86. rm -f Makefile.config || die
  87. if use debug; then
  88. append-cflags -g
  89. append-cxxflags -g
  90. fi
  91. }
  92. src_configure() {
  93. local myeconfargs=(
  94. --bashcompletiondir="$(get_bashcompdir)"
  95. --emacslispdir="${EPREFIX}/${SITELISP}/${PN}"
  96. --emacsetcdir="${EPREFIX}/${SITEETC}/${PN}"
  97. --without-ruby
  98. --zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions"
  99. $(use_with emacs)
  100. )
  101. tc-export CC CXX
  102. econf "${myeconfargs[@]}"
  103. }
  104. src_compile() {
  105. V=1 default
  106. bindings python distutils-r1_src_compile
  107. if use mutt; then
  108. pushd contrib/notmuch-mutt || die
  109. emake notmuch-mutt.1
  110. popd || die
  111. fi
  112. if use doc; then
  113. pydocs() {
  114. pushd docs || die
  115. emake html
  116. mv html ../python || die
  117. popd || die
  118. }
  119. LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" bindings python pydocs
  120. fi
  121. }
  122. src_test() {
  123. pax-mark -m notmuch
  124. emake download-test-databases
  125. LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" V=1 default
  126. pax-mark -ze notmuch
  127. }
  128. src_install() {
  129. default
  130. if use emacs; then
  131. elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
  132. fi
  133. if use nmbug; then
  134. dobin devel/nmbug/nmbug
  135. dobin devel/nmbug/nmbug-status
  136. fi
  137. if use mutt; then
  138. pushd contrib/notmuch-mutt || die
  139. dobin notmuch-mutt
  140. doman notmuch-mutt.1
  141. insinto /etc/mutt
  142. doins notmuch-mutt.rc
  143. dodoc README-mutt
  144. popd || die
  145. fi
  146. DOCS="" bindings python distutils-r1_src_install
  147. use doc && bindings python dohtml -r python
  148. }
  149. pkg_preinst() {
  150. if use mutt && ! [[ -e ${ROOT}/etc/mutt/notmuch-mutt.rc ]]; then
  151. elog "To enable notmuch support in mutt, add the following line into"
  152. elog "your mutt config file, please:"
  153. elog ""
  154. elog " source /etc/mutt/notmuch-mutt.rc"
  155. fi
  156. }
  157. pkg_postinst() {
  158. use emacs && elisp-site-regen
  159. }
  160. pkg_postrm() {
  161. use emacs && elisp-site-regen
  162. }