notmuch-0.24.1.ebuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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,3_5,3_6} )
  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-desktop
  104. --without-ruby
  105. --zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions"
  106. $(use_with emacs)
  107. $(use_with doc api-docs)
  108. )
  109. tc-export CC CXX
  110. econf "${myeconfargs[@]}"
  111. }
  112. src_compile() {
  113. V=1 default
  114. bindings python distutils-r1_src_compile
  115. if use mutt; then
  116. pushd contrib/notmuch-mutt || die
  117. emake notmuch-mutt.1
  118. popd || die
  119. fi
  120. if use doc; then
  121. pydocs() {
  122. pushd docs || die
  123. emake html
  124. rm -r html/_sources || die
  125. rm html/{objects.inv,.buildinfo} || die
  126. mkdir -p ../html && mv html ../html/python || die
  127. popd || die
  128. }
  129. LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" bindings python pydocs
  130. fi
  131. }
  132. src_test() {
  133. pax-mark -m notmuch
  134. LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" V=1 default
  135. pax-mark -ze notmuch
  136. }
  137. src_install() {
  138. default
  139. if use emacs; then
  140. elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
  141. fi
  142. if use nmbug; then
  143. dobin devel/nmbug/nmbug
  144. dobin devel/nmbug/notmuch-report
  145. fi
  146. if use mutt; then
  147. pushd contrib/notmuch-mutt || die
  148. dobin notmuch-mutt
  149. doman notmuch-mutt.1
  150. insinto /etc/mutt
  151. doins notmuch-mutt.rc
  152. dodoc README-mutt
  153. popd || die
  154. fi
  155. DOCS="" bindings python distutils-r1_src_install
  156. use doc && bindings python dodoc -r html
  157. }
  158. pkg_preinst() {
  159. if use mutt && ! [[ -e ${ROOT}/etc/mutt/notmuch-mutt.rc ]]; then
  160. elog "To enable notmuch support in mutt, add the following line into"
  161. elog "your mutt config file, please:"
  162. elog ""
  163. elog " source /etc/mutt/notmuch-mutt.rc"
  164. fi
  165. }
  166. pkg_postinst() {
  167. use emacs && elisp-site-regen
  168. }
  169. pkg_postrm() {
  170. use emacs && elisp-site-regen
  171. }