notmuch-0.23.7.ebuild 4.5 KB

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