notmuch-0.39.ebuild (6004B)
1 # Copyright 1999-2025 Gentoo Authors 2 # Distributed under the terms of the GNU General Public License v2 3 4 EAPI=8 5 6 DISTUTILS_EXT=1 7 DISTUTILS_OPTIONAL=1 8 DISTUTILS_USE_PEP517=setuptools 9 PYTHON_COMPAT=( python3_{11..14} pypy3_11 ) 10 11 inherit bash-completion-r1 desktop distutils-r1 elisp-common flag-o-matic pax-utils toolchain-funcs xdg-utils 12 13 DESCRIPTION="Thread-based e-mail indexer, supporting quick search and tagging" 14 HOMEPAGE="https://notmuchmail.org/" 15 SRC_URI=" 16 https://notmuchmail.org/releases/${P}.tar.xz 17 test? ( https://notmuchmail.org/releases/test-databases/database-v1.tar.xz ) 18 " 19 20 LICENSE="GPL-3" 21 # Sub-slot corresponds to major wersion of libnotmuch.so.X.Y. Bump of Y is 22 # meant to be binary backward compatible. 23 SLOT="0/5" 24 KEYWORDS="~alpha amd64 arm arm64 ~ppc64 ~riscv x86 ~x64-macos" 25 REQUIRED_USE=" 26 ${PYTHON_REQUIRED_USE} 27 nmbug? ( python ) 28 test? ( crypt emacs python ) 29 " 30 IUSE="apidoc crypt doc emacs mutt nmbug python test" 31 RESTRICT="!test? ( test )" 32 33 BDEPEND=" 34 app-arch/xz-utils[extra-filters(+)] 35 doc? ( dev-python/sphinx[${PYTHON_USEDEP}] ) 36 sys-apps/texinfo 37 virtual/pkgconfig 38 apidoc? ( 39 app-text/doxygen 40 dev-lang/perl 41 ) 42 python? ( 43 ${DISTUTILS_DEPS} 44 test? ( dev-python/pytest[${PYTHON_USEDEP}] ) 45 ) 46 test? ( 47 app-shells/bash 48 sys-process/parallel 49 ) 50 " 51 COMMON_DEPEND=" 52 dev-libs/glib 53 dev-libs/gmime:3.0[crypt] 54 >=dev-libs/xapian-1.4.0:= 55 sys-libs/talloc 56 sys-libs/zlib:= 57 emacs? ( >=app-editors/emacs-${NEED_EMACS}:* ) 58 python? ( 59 ${PYTHON_DEPS} 60 $(python_gen_cond_dep ' 61 dev-python/cffi[${PYTHON_USEDEP}] 62 ' 'python*') 63 ) 64 " 65 DEPEND=" 66 ${COMMON_DEPEND} 67 test? ( 68 >=app-editors/emacs-${NEED_EMACS}:*[libxml2] 69 app-misc/dtach 70 dev-debug/gdb[python] 71 crypt? ( 72 app-crypt/gnupg 73 dev-libs/openssl 74 ) 75 ) 76 " 77 78 RDEPEND=" 79 ${COMMON_DEPEND} 80 crypt? ( app-crypt/gnupg ) 81 mutt? ( 82 dev-perl/File-Which 83 dev-perl/Mail-Box 84 dev-perl/MailTools 85 dev-perl/Term-ReadLine-Gnu 86 virtual/perl-Digest-SHA 87 virtual/perl-File-Path 88 virtual/perl-Getopt-Long 89 dev-perl/Pod-Parser 90 ) 91 nmbug? ( dev-vcs/git ) 92 " 93 94 SITEFILE="50${PN}-gentoo.el" 95 96 PATCHES=( 97 "${FILESDIR}"/${PN}-0.39-no-compress-man-pages.patch 98 "${FILESDIR}"/${PN}-0.39-test-skip-debug-symbols.patch 99 ) 100 101 pkg_setup() { 102 use emacs && elisp-check-emacs-version 103 } 104 105 src_unpack() { 106 unpack "${P}".tar.xz 107 108 if use test; then 109 mkdir -p "${S}"/test/test-databases || die 110 cp "${DISTDIR}"/database-v1.tar.xz "${S}"/test/test-databases/ || die 111 fi 112 } 113 114 src_prepare() { 115 default 116 117 use python && distutils-r1_src_prepare 118 119 rm bindings/python-cffi/tox.ini || die 120 mv contrib/notmuch-mutt/README contrib/notmuch-mutt/README-mutt || die 121 122 # Non-autoconf configure 123 [[ ${CHOST} == *-solaris* ]] && append-ldflags '-lnsl' '-lsocket' 124 } 125 126 src_configure() { 127 python_setup # For sphinx 128 129 tc-export CC CXX 130 131 local myconf=( 132 --bashcompletiondir="$(get_bashcompdir)" 133 --emacslispdir="${EPREFIX}/${SITELISP}/${PN}" 134 --emacsetcdir="${EPREFIX}/${SITEETC}/${PN}" 135 --without-desktop 136 --without-ruby 137 --zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions" 138 $(use_with doc docs) # man pages, info pages 139 $(use_with apidoc api-docs) 140 $(use_with emacs) 141 ) 142 143 # FIXME: 144 # Checking for GMime session key extraction support... * ACCESS DENIED: open_wr: /dev/bus/usb/001/011 145 # notmuch configure compiles a program _check_session_keys.c, inline in ./configure script 146 # gmime/gpg/scdaemon tries to open usb devices in GMime test 147 # we pretend to allow it, without actually allowing it to read or write. 148 # https://bugs.gentoo.org/821328 149 addpredict /dev/bus/usb 150 151 econf "${myconf[@]}" 152 } 153 154 python_compile() { 155 pushd bindings/python-cffi > /dev/null || die 156 distutils-r1_python_compile 157 popd > /dev/null || die 158 } 159 160 src_compile() { 161 emake V=1 162 use python && distutils-r1_src_compile 163 use mutt && emake -C contrib/notmuch-mutt notmuch-mutt.1 164 } 165 166 python_test() { 167 pushd bindings/python-cffi > /dev/null || die 168 rm -rf notmuch2 || die 169 epytest tests || die -n 170 popd > /dev/null || die 171 } 172 173 src_test() { 174 local test_failures=() 175 176 # We run pytest via eclass phasefunc, so delete upstream launcher 177 rm test/T391-python-cffi.sh || die 178 179 # These both fail because of line wrapping in the output 180 rm test/T315-emacs-tagging.sh test/T310-emacs.sh || die 181 182 pax-mark -m notmuch 183 LD_LIBRARY_PATH="${S}/lib" nonfatal emake test \ 184 V=1 \ 185 OPTIONS="--verbose --tee" || test_failures+=( "'emake tests'" ) 186 pax-mark -ze notmuch 187 188 # Both lib and bin needed for testsuite 189 if use python; then 190 LD_LIBRARY_PATH="${S}/lib" \ 191 PATH="${S}:${PATH}" \ 192 nonfatal distutils-r1_src_test || test_failures+=( "'python tests'" ) 193 fi 194 195 [[ ${test_failures} ]] && die "Tests failed: ${test_failures[*]}" 196 } 197 198 python_install() { 199 pushd bindings/python-cffi > /dev/null || die 200 distutils-r1_python_install 201 popd > /dev/null || die 202 } 203 204 src_install() { 205 default 206 207 use python && distutils-r1_src_install 208 209 if use apidoc; then 210 # Rename overly generic manpage to avoid clashes 211 mv doc/_build/man/man3/deprecated.3 \ 212 doc/_build/man/man3/notmuch-deprecated.3 || die 213 fi 214 215 if use emacs; then 216 elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die 217 domenu emacs/notmuch-emacs-mua.desktop 218 fi 219 220 if use nmbug; then 221 # TODO: those guys need proper deps 222 python_fix_shebang devel/nmbug/notmuch-report 223 dobin devel/nmbug/notmuch-report 224 fi 225 226 if use mutt; then 227 pushd contrib/notmuch-mutt > /dev/null || die 228 dobin notmuch-mutt 229 # This manpage is built by pod2man 230 doman notmuch-mutt.1 231 insinto /etc/mutt 232 doins notmuch-mutt.rc 233 dodoc README-mutt 234 popd > /dev/null || die 235 fi 236 237 local DOCS=( README{,.rst} INSTALL NEWS ) 238 einstalldocs 239 } 240 241 pkg_preinst() { 242 local _rcfile="/etc/mutt/notmuch-mutt.rc" 243 if use mutt && ! [[ -e "${EROOT}"${_rcfile} ]]; then 244 elog "To enable notmuch support in mutt, add the following line" 245 elog "to your mutt config file:" 246 elog "" 247 elog " source ${_rcfile}" 248 fi 249 } 250 251 pkg_postinst() { 252 if use emacs; then 253 elisp-site-regen 254 xdg_desktop_database_update 255 fi 256 } 257 258 pkg_postrm() { 259 if use emacs; then 260 elisp-site-regen 261 xdg_desktop_database_update 262 fi 263 }