net-mail/notmuch: add 0.40

upstream deprecated <emacs-27.1
make python optional

force gpg[reference] because freepg can't pass tests

rm gen_cond_dep for cffi because pypy is dropped
use gen_any_dep for sphinx and add dev-python/roman-numerals

test :
move deps for test in bdeps
make gdb optional
set CC/CFLAGS from env
use NOTMUCH_SKIP_TESTS to skip tests
unfilter T315-emacs, not reproduced in many env

Closes: https://bugs.gentoo.org/965637
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/45776
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-02-16 00:22:28 +00:00
committed by Sam James
parent ce37aaa293
commit e84672d896
4 changed files with 450 additions and 0 deletions
+1
View File
@@ -1,2 +1,3 @@
DIST database-v1.tar.xz 204876 BLAKE2B 846a8d2f17edb61ed1c3d3c655becd1f60b4046772058706f13d516f65421a5105593660f1c556907bb2bb9607a3c2521243d1be07bffb70817ad3b8461680ca SHA512 e2d87373e00b65756d7fea40c54fb236d7a37ce839145c3afd99ab26efdc17796e540c021e2c24e521df2d0a01ccbf918994f87a0d83235ff9b109a51555b3d0
DIST notmuch-0.39.tar.xz 811448 BLAKE2B 5d9a6fb28f17c45a8310f83c3ae70e63a5263b85565cfebae96f3054cb0b682164fced83d31176a6287cf9e18570dbeb114f50bc2cd4c0db41e744b8d7d1d15d SHA512 a9864a6a8423c723d36df269dcc73c2987be63c6e328b818235d0604cb594e0e91ee7639ee99a4b867be4387a605abc187a3b458aa7b0e4fc3a1744c0c2daa69
DIST notmuch-0.40.tar.xz 815476 BLAKE2B 298fd9ed9768441b372d8c9697d72f183dda71cbd5e2dfdadac31fc9df0d5a4be7b4916e4dedbf57227c2fc7d855c1e1743d240d24de1c5734396ed386aa8187 SHA512 937c72c05b00520cc3dbc7db6282ad65a621c8e102fbcbac3c9d99061ae510741b13ef9cf5c6476ba8e7fa15a6905631159477a938d1369db6d9885780b90867
@@ -0,0 +1,24 @@
fix incompatible pointers (glibc-2.43 / musl)
sent to ML
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -115,7 +115,7 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
{
struct stat st;
int r;
- char *parent = NULL, *slash;
+ const char *parent = NULL, *slash;
/* First check the common case: directory already exists. */
r = stat (path, &st);
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -183,7 +183,7 @@ int main (int argc, char** argv)
}
stat = notmuch_database_index_file (db, "./nonexistent", NULL, NULL);
if (stat) {
- char *status_string = notmuch_database_status_string (db);
+ const char *status_string = notmuch_database_status_string (db);
if (status_string) fputs (status_string, stderr);
}
}
@@ -0,0 +1,147 @@
https://git.notmuchmail.org/git?p=notmuch;a=commit;h=2ddff9923e09e379bce30cdb0f620b56fa7cea5e
use PKG_CONFIG from env
--- a/configure
+++ b/configure
@@ -95,6 +95,7 @@ CPPFLAGS=${CPPFLAGS:-}
CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
LDFLAGS=${LDFLAGS:-}
+PKG_CONFIG=${PKG_CONFIG:-pkg-config}
XAPIAN_CONFIG=${XAPIAN_CONFIG:-}
PYTHON=${PYTHON:-}
RUBY=${RUBY:-ruby}
@@ -463,7 +464,7 @@ EOF
exit 1
fi
-if pkg-config --version > /dev/null 2>&1; then
+if ${PKG_CONFIG} --version > /dev/null 2>&1; then
have_pkg_config=1
else
have_pkg_config=0
@@ -496,11 +497,11 @@ fi
GMIME_MINVER=3.0.3
printf "Checking for GMime development files (>= $GMIME_MINVER)... "
-if pkg-config --exists "gmime-3.0 >= $GMIME_MINVER"; then
+if ${PKG_CONFIG} --exists "gmime-3.0 >= $GMIME_MINVER"; then
printf "Yes.\n"
have_gmime=1
- gmime_cflags=$(pkg-config --cflags gmime-3.0)
- gmime_ldflags=$(pkg-config --libs gmime-3.0)
+ gmime_cflags=$(${PKG_CONFIG} --cflags gmime-3.0)
+ gmime_ldflags=$(${PKG_CONFIG} --libs gmime-3.0)
printf "Checking for GMime session key extraction support... "
@@ -553,7 +554,7 @@ version of GPGME.
Please try to rebuild your version of GMime against a more recent
version of GPGME (at least GPGME 1.8.0).
EOF
- if GPGME_VERS="$(pkg-config --modversion gpgme || gpgme-config --version)"; then
+ if GPGME_VERS="$(${PKG_CONFIG} --modversion gpgme || gpgme-config --version)"; then
printf 'Your current GPGME development version is: %s\n' "$GPGME_VERS"
else
printf 'You do not have the GPGME development libraries installed.\n'
@@ -627,7 +628,7 @@ EOF
else
gmime_x509_cert_validity=0
printf "No.\n"
- if pkg-config --exists "gmime-3.0 >= 3.2.7"; then
+ if ${PKG_CONFIG} --exists "gmime-3.0 >= 3.2.7"; then
cat <<EOF
*** Error: GMime fails to calculate X.509 certificate validity, and
is later than 3.2.7, which should have fixed this issue.
@@ -736,7 +737,7 @@ fi
# function that only exists as of 2.22, (g_array_unref)
printf "Checking for Glib development files (>= 2.22)... "
have_glib=0
-if pkg-config --exists 'glib-2.0 >= 2.22'; then
+if ${PKG_CONFIG} --exists 'glib-2.0 >= 2.22'; then
printf "Yes.\n"
have_glib=1
# these are included in gmime cflags and ldflags
@@ -747,7 +748,7 @@ else
errors=$((errors + 1))
fi
-if ! pkg-config --exists zlib; then
+if ! ${PKG_CONFIG} --exists zlib; then
${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 &&
compat/gen_zlib_pc > compat/zlib.pc &&
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}compat &&
@@ -757,22 +758,22 @@ fi
printf "Checking for zlib (>= 1.2.5.2)... "
have_zlib=0
-if pkg-config --atleast-version=1.2.5.2 zlib; then
+if ${PKG_CONFIG} --atleast-version=1.2.5.2 zlib; then
printf "Yes.\n"
have_zlib=1
- zlib_cflags=$(pkg-config --cflags zlib)
- zlib_ldflags=$(pkg-config --libs zlib)
+ zlib_cflags=$(${PKG_CONFIG} --cflags zlib)
+ zlib_ldflags=$(${PKG_CONFIG} --libs zlib)
else
printf "No.\n"
errors=$((errors + 1))
fi
printf "Checking for talloc development files... "
-if pkg-config --exists talloc; then
+if ${PKG_CONFIG} --exists talloc; then
printf "Yes.\n"
have_talloc=1
- talloc_cflags=$(pkg-config --cflags talloc)
- talloc_ldflags=$(pkg-config --libs talloc)
+ talloc_cflags=$(${PKG_CONFIG} --cflags talloc)
+ talloc_ldflags=$(${PKG_CONFIG} --libs talloc)
else
printf "No.\n"
have_talloc=0
@@ -837,7 +838,7 @@ if [ $have_python3 -eq 1 ]; then
printf "(%s)\n" $python3_version
printf "Checking for python $python3_version development files..."
- if pkg-config --exists "python-$python3_version"; then
+ if ${PKG_CONFIG} --exists "python-$python3_version"; then
have_python3_dev=1
printf "Yes.\n"
else
@@ -873,10 +874,10 @@ if [ $have_python3_dev -eq 1 ]; then
fi
printf "Checking for valgrind development files... "
-if pkg-config --exists valgrind; then
+if ${PKG_CONFIG} --exists valgrind; then
printf "Yes.\n"
have_valgrind=1
- valgrind_cflags=$(pkg-config --cflags valgrind)
+ valgrind_cflags=$(${PKG_CONFIG} --cflags valgrind)
else
printf "No (but that's fine).\n"
have_valgrind=0
@@ -884,7 +885,7 @@ else
fi
printf "Checking for bash-completion (>= 1.90)... "
-if pkg-config --atleast-version=1.90 bash-completion; then
+if ${PKG_CONFIG} --atleast-version=1.90 bash-completion; then
printf "Yes.\n"
else
printf "No (will not install bash completion).\n"
@@ -892,11 +893,11 @@ else
fi
printf "Checking for sfsexp... "
-if pkg-config --exists sfsexp; then
+if ${PKG_CONFIG} --exists sfsexp; then
printf "Yes.\n"
have_sfsexp=1
- sfsexp_cflags=$(pkg-config --cflags sfsexp)
- sfsexp_ldflags=$(pkg-config --libs sfsexp)
+ sfsexp_cflags=$(${PKG_CONFIG} --cflags sfsexp)
+ sfsexp_ldflags=$(${PKG_CONFIG} --libs sfsexp)
else
printf "No (will not enable s-expression queries).\n"
have_sfsexp=0
+278
View File
@@ -0,0 +1,278 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..14} )
NEED_EMACS=27.1
inherit bash-completion-r1 desktop distutils-r1 elisp-common flag-o-matic pax-utils toolchain-funcs xdg-utils
DESCRIPTION="Thread-based e-mail indexer, supporting quick search and tagging"
HOMEPAGE="https://notmuchmail.org/"
SRC_URI="
https://notmuchmail.org/releases/${P}.tar.xz
test? ( https://notmuchmail.org/releases/test-databases/database-v1.tar.xz )
"
LICENSE="GPL-3"
# Sub-slot corresponds to major wersion of libnotmuch.so.X.Y. Bump of Y is
# meant to be binary backward compatible.
SLOT="0/5"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~x64-macos"
IUSE="apidoc emacs mutt nmbug python test"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
nmbug? ( python )
test? ( emacs python )
"
RESTRICT="!test? ( test )"
BDEPEND="
app-arch/xz-utils[extra-filters(+)]
sys-apps/texinfo
virtual/pkgconfig
$(python_gen_any_dep '
dev-python/roman-numerals[${PYTHON_USEDEP}]
dev-python/sphinx[${PYTHON_USEDEP}]
')
apidoc? (
app-text/doxygen
dev-lang/perl
)
python? (
${PYTHON_DEPS}
${DISTUTILS_DEPS}
test? ( dev-python/pytest[${PYTHON_USEDEP}] )
)
test? (
app-misc/dtach
app-shells/bash
dev-libs/openssl
sys-process/parallel
debug? ( dev-debug/gdb[python] )
emacs? ( >=app-editors/emacs-${NEED_EMACS}:*[libxml2] )
)
"
DEPEND="
|| (
app-alternatives/gpg[reference]
app-alternatives/gpg[freepg(-)]
)
dev-libs/glib:2
>=dev-libs/gmime-3.2.7:3.0[crypt]
>=dev-libs/xapian-1.4.0:=
sys-libs/talloc
virtual/zlib:=
emacs? ( >=app-editors/emacs-${NEED_EMACS}:* )
python? (
${PYTHON_DEPS}
dev-python/cffi[${PYTHON_USEDEP}]
)
"
RDEPEND="
${DEPEND}
mutt? (
dev-perl/File-Which
dev-perl/Mail-Box
dev-perl/MailTools
dev-perl/Term-ReadLine-Gnu
virtual/perl-Digest-SHA
virtual/perl-File-Path
virtual/perl-Getopt-Long
dev-perl/Pod-Parser
)
nmbug? ( dev-vcs/git )
"
SITEFILE="50${PN}-gentoo.el"
PATCHES=(
"${FILESDIR}"/${PN}-0.39-no-compress-man-pages.patch
# sent to ML
"${FILESDIR}"/${PN}-0.40-fix_pointers.patch
# applied in master
"${FILESDIR}"/${P}-pkg_config.patch
)
python_check_deps() {
python_has_version "dev-python/roman-numerals[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
}
pkg_setup() {
use emacs && elisp-check-emacs-version
# always called for sphinx
python_setup
}
src_unpack() {
unpack "${P}".tar.xz
if use test; then
mkdir -p "${S}"/test/test-databases || die
cp "${DISTDIR}"/database-v1.tar.xz "${S}"/test/test-databases/ || die
fi
}
src_prepare() {
default
use python && distutils-r1_src_prepare
rm bindings/python-cffi/tox.ini || die
mv contrib/notmuch-mutt/README contrib/notmuch-mutt/README-mutt || die
# Non-autoconf configure
[[ ${CHOST} == *-solaris* ]] && append-ldflags '-lnsl' '-lsocket'
}
src_configure() {
tc-export CC CXX PKG_CONFIG
local myconf=(
--bashcompletiondir="$(get_bashcompdir)"
--emacslispdir="${EPREFIX}/${SITELISP}/${PN}"
--emacsetcdir="${EPREFIX}/${SITEETC}/${PN}"
--without-desktop
--without-ruby
--with-docs # man pages, info pages
--zshcompletiondir="${EPREFIX}/usr/share/zsh/site-functions"
$(use_with apidoc api-docs)
$(use_with emacs)
)
# FIXME:
# Checking for GMime session key extraction support... * ACCESS DENIED: open_wr: /dev/bus/usb/001/011
# notmuch configure compiles a program _check_session_keys.c, inline in ./configure script
# gmime/gpg/scdaemon tries to open usb devices in GMime test
# we pretend to allow it, without actually allowing it to read or write.
# https://bugs.gentoo.org/821328
addpredict /dev/bus/usb
econf "${myconf[@]}"
}
python_compile() {
pushd bindings/python-cffi > /dev/null || die
distutils-r1_python_compile
popd > /dev/null || die
}
src_compile() {
emake V=1
use python && distutils-r1_src_compile
use mutt && emake -C contrib/notmuch-mutt notmuch-mutt.1
}
python_test() {
pushd bindings/python-cffi > /dev/null || die
rm -rf notmuch2 || die
epytest tests
local ret=${?}
popd > /dev/null || die
return ${ret}
}
src_test() {
local skip_tests=(
# 953833, skip test for debugging symbols
T000-basic.12
# line wrapping in the output
T310-emacs.61
# make gdb optional
$(usev !debug T380-atomicity)
# We run pytest via eclass phasefunc, so delete upstream launcher
T391-python-cffi
# disabled
T395-ruby
)
local mytestargs=(
TEST_CC="${CC}"
TEST_CFLAGS="${CFLAGS}"
V=1
OPTIONS="--verbose --tee"
NOTMUCH_SKIP_TESTS="${skip_tests[*]}"
)
local test_failures=()
local -x LD_LIBRARY_PATH="${S}/lib"
pax-mark -m notmuch
nonfatal emake test "${mytestargs[@]}" || test_failures+=( "'emake tests'" )
pax-mark -ze notmuch
# Both lib and bin needed for testsuite
if use python; then
PATH="${S}:${PATH}" nonfatal distutils-r1_src_test || test_failures+=( "'python tests'" )
fi
[[ ${test_failures} ]] && die "Tests failed: ${test_failures[*]}"
}
python_install() {
pushd bindings/python-cffi > /dev/null || die
distutils-r1_python_install
popd > /dev/null || die
}
src_install() {
default
use python && distutils-r1_src_install
if use apidoc; then
# Rename overly generic manpage to avoid clashes
mv doc/_build/man/man3/{,notmuch-}deprecated.3 || die
fi
if use emacs; then
elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
domenu emacs/notmuch-emacs-mua.desktop
fi
if use nmbug; then
# TODO: those guys need proper deps
python_fix_shebang devel/nmbug/notmuch-report
dobin devel/nmbug/notmuch-report
fi
if use mutt; then
pushd contrib/notmuch-mutt > /dev/null || die
dobin notmuch-mutt
# This manpage is built by pod2man
doman notmuch-mutt.1
insinto /etc/mutt
doins notmuch-mutt.rc
dodoc README-mutt
popd > /dev/null || die
fi
local DOCS=( README{,.rst} INSTALL NEWS )
einstalldocs
}
pkg_preinst() {
local _rcfile="/etc/mutt/notmuch-mutt.rc"
if use mutt && ! [[ -e "${EROOT}"${_rcfile} ]]; then
elog "To enable notmuch support in mutt, add the following line"
elog "to your mutt config file:"
elog ""
elog " source ${_rcfile}"
fi
}
pkg_postinst() {
if use emacs; then
elisp-site-regen
xdg_desktop_database_update
fi
}
pkg_postrm() {
if use emacs; then
elisp-site-regen
xdg_desktop_database_update
fi
}