net-mail/dovecot: ppc64 stable wrt bug #723786
[gentoo.git] / net-mail / notmuch / notmuch-0.29.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 DISTUTILS_OPTIONAL=1
7 PYTHON_COMPAT=( python{3_6,3_7} )
8
9 inherit bash-completion-r1 elisp-common eutils flag-o-matic pax-utils \
10         distutils-r1 toolchain-funcs
11
12 DESCRIPTION="Thread-based e-mail indexer, supporting quick search and tagging"
13 HOMEPAGE="https://notmuchmail.org/"
14 SRC_URI="https://notmuchmail.org/releases/${P}.tar.xz
15         test? ( https://notmuchmail.org/releases/test-databases/database-v1.tar.xz )"
16
17 LICENSE="GPL-3"
18 # Sub-slot corresponds to major wersion of libnotmuch.so.X.Y.  Bump of Y is
19 # meant to be binary backward compatible.
20 SLOT="0/5"
21 KEYWORDS="~alpha amd64 x86 ~x64-solaris"
22 REQUIRED_USE="
23         nmbug? ( python )
24         python? ( ${PYTHON_REQUIRED_USE} )
25         test? ( crypt emacs python valgrind )
26         "
27 IUSE="crypt doc emacs mutt nmbug python test valgrind"
28
29 RESTRICT="!test? ( test )"
30
31 CDEPEND="
32         !!<app-shells/bash-completion-1.9
33         >=dev-libs/glib-2.22:2
34         >=dev-libs/gmime-3.0.3:3.0
35         >=dev-libs/xapian-1.4.8:=
36         dev-python/sphinx
37         sys-apps/texinfo
38         >=sys-libs/zlib-1.2.5.2
39         sys-libs/talloc
40         crypt? ( dev-libs/gmime:3.0[crypt] )
41         emacs? ( >=app-editors/emacs-24.1:* )
42         python? ( ${PYTHON_DEPS} )
43         "
44 DEPEND="${CDEPEND}
45         virtual/pkgconfig
46         doc? (
47                 app-doc/doxygen
48                 dev-python/mock[${PYTHON_USEDEP}]
49         )
50         test? (
51                 app-misc/dtach
52                 >=app-editors/emacs-24.1:*[libxml2]
53                 sys-devel/gdb
54                 crypt? ( app-crypt/gnupg dev-libs/openssl )
55         )
56         valgrind? ( dev-util/valgrind )
57         "
58 RDEPEND="${CDEPEND}
59         crypt? ( app-crypt/gnupg )
60         nmbug? ( dev-vcs/git )
61         mutt? (
62                 dev-perl/File-Which
63                 dev-perl/Mail-Box
64                 dev-perl/MailTools
65                 dev-perl/String-ShellQuote
66                 dev-perl/Term-ReadLine-Gnu
67                 virtual/perl-Digest-SHA
68                 virtual/perl-File-Path
69                 virtual/perl-Getopt-Long
70                 virtual/perl-Pod-Parser
71         )
72         "
73
74 DOCS=( AUTHORS NEWS README )
75 NEED_EMACS="24.1"
76 SITEFILE="50${PN}-gentoo.el"
77 MY_LD_LIBRARY_PATH="${WORKDIR}/${P}/lib"
78 PATCHES=(
79         "${FILESDIR}"/${PV}-0001-Use-loopback-IP-address-rather-than-name.patch
80 )
81
82 bindings() {
83         local ret=0
84
85         if use $1; then
86                 pushd bindings/$1 || die
87                 shift
88                 "$@"
89                 ret=$?
90                 popd || die
91         fi
92
93         return $ret
94 }
95
96 pkg_pretend() {
97         if has_version '<net-mail/notmuch-0.18'; then
98                 ewarn
99                 ewarn "There are few not backward compatible changes between"
100                 ewarn "<notmuch-0.18 and >=notmuch-0.18.  See NEWS file"
101                 ewarn "(0.18 section) for details before first use!"
102                 ewarn
103         fi
104 }
105
106 pkg_setup() {
107         use emacs && elisp-check-emacs-version
108 }
109
110 src_unpack() {
111         unpack "${P}".tar.xz
112         if use test; then
113                 mkdir -p "${S}"/test/test-databases || die
114                 cp "${DISTDIR}"/database-v1.tar.xz "${S}"/test/test-databases/ || die
115         fi
116 }
117
118 src_prepare() {
119         default
120
121         bindings python distutils-r1_src_prepare
122         bindings python mv README README-python || die
123         mv contrib/notmuch-mutt/README contrib/notmuch-mutt/README-mutt || die
124
125         # assure that new Makefile.config will be generated
126         rm -f Makefile.config || die
127
128         sed -e 's@^install: all install-man install-info$@install: all install-info@' -i Makefile.local
129
130         if use test; then
131                 append-cflags -g
132                 append-cxxflags -g
133         fi
134
135         if [[ ${CHOST} == *-solaris* ]] ; then
136                 append-ldflags -lnsl -lsocket   # non-autoconf configure
137         fi
138 }
139
140 src_configure() {
141         python_setup  # for sphinx
142
143         local myeconfargs=(
144                 --bashcompletiondir="$(get_bashcompdir)"
145                 --emacslispdir="${EPREFIX}/${SITELISP}/${PN}"
146                 --emacsetcdir="${EPREFIX}/${SITEETC}/${PN}"
147                 --without-desktop
148                 --without-ruby
149                 --zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions"
150                 $(use_with emacs)
151                 $(use_with doc api-docs)
152         )
153         tc-export CC CXX
154         econf "${myeconfargs[@]}"
155 }
156
157 src_compile() {
158         python_setup  # for sphinx
159
160         V=1 default
161         bindings python distutils-r1_src_compile
162
163         if use mutt; then
164                 pushd contrib/notmuch-mutt || die
165                 emake notmuch-mutt.1
166                 popd || die
167         fi
168
169         if use doc; then
170                 pydocs() {
171                         pushd docs || die
172                         emake html
173                         rm -r html/_sources || die
174                         rm html/{objects.inv,.buildinfo} || die
175                         mkdir -p ../html && mv html ../html/python || die
176                         popd || die
177                 }
178                 LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" bindings python pydocs
179         fi
180 }
181
182 src_test() {
183         pax-mark -m notmuch
184         LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH}" V=1 default
185         pax-mark -ze notmuch
186 }
187
188 src_install() {
189         default
190
191         if use doc; then
192                 doman doc/_build/man/man?/*.?
193         fi
194
195         if use emacs; then
196                 elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
197         fi
198
199         if use nmbug; then
200                 dobin devel/nmbug/nmbug
201                 dobin devel/nmbug/notmuch-report
202         fi
203
204         if use mutt; then
205                 pushd contrib/notmuch-mutt || die
206                 dobin notmuch-mutt
207                 doman notmuch-mutt.1
208                 insinto /etc/mutt
209                 doins notmuch-mutt.rc
210                 dodoc README-mutt
211                 popd || die
212         fi
213
214         DOCS="" bindings python distutils-r1_src_install
215         use doc && bindings python dodoc -r html
216 }
217
218 pkg_preinst() {
219         if use mutt && ! [[ -e ${ROOT}/etc/mutt/notmuch-mutt.rc ]]; then
220                 elog "To enable notmuch support in mutt, add the following line into"
221                 elog "your mutt config file, please:"
222                 elog ""
223                 elog "  source /etc/mutt/notmuch-mutt.rc"
224         fi
225 }
226
227 pkg_postinst() {
228         use emacs && elisp-site-regen
229 }
230
231 pkg_postrm() {
232         use emacs && elisp-site-regen
233 }