commit fd8654fd2c47ba33ac7123e3cea0d733a5076888
parent 399a88f2c02d6d8ff5e37febb2f676a2e845ca9f
Author: vin <git@vineetk.net>
Date: Sun, 16 Nov 2025 00:19:37 -0500
add minimal gmime3 and gpg-less notmuch
Diffstat:
8 files changed, 379 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,3 +4,4 @@
*.partial
*~
.*~
+work/
diff --git a/gmime3/.footprint b/gmime3/.footprint
@@ -0,0 +1,74 @@
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/include/
+drwxr-xr-x root/root usr/include/gmime-3.0/
+drwxr-xr-x root/root usr/include/gmime-3.0/gmime/
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-application-pkcs7-mime.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-autocrypt.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-certificate.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-charset.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-content-type.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-crypto-context.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-data-wrapper.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-disposition.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-encodings.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-error.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-basic.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-best.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-charset.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-checksum.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-dos2unix.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-enriched.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-from.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-gzip.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-html.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-openpgp.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-smtp-data.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-strip.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-unix2dos.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-windows.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter-yenc.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-filter.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-format-options.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-gpg-context.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-header.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-iconv-utils.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-iconv.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-message-part.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-message-partial.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-message.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-multipart-encrypted.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-multipart-signed.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-multipart.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-object.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-param.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-parser-options.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-parser.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-part-iter.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-part.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-pkcs7-context.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-references.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-signature.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-buffer.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-cat.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-file.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-filter.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-fs.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-gio.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-mem.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-mmap.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-null.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream-pipe.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-stream.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-text-part.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-utils.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime-version.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/gmime.h
+-rw-r--r-- root/root usr/include/gmime-3.0/gmime/internet-address.h
+drwxr-xr-x root/root usr/lib/
+-rwxr-xr-x root/root usr/lib/libgmime-3.0.la
+lrwxrwxrwx root/root usr/lib/libgmime-3.0.so -> libgmime-3.0.so.0.214.1
+lrwxrwxrwx root/root usr/lib/libgmime-3.0.so.0 -> libgmime-3.0.so.0.214.1
+-rwxr-xr-x root/root usr/lib/libgmime-3.0.so.0.214.1
+drwxr-xr-x root/root usr/lib/pkgconfig/
+-rw-r--r-- root/root usr/lib/pkgconfig/gmime-3.0.pc
+drwxr-xr-x root/root usr/share/
diff --git a/gmime3/.md5sum b/gmime3/.md5sum
@@ -0,0 +1 @@
+f7d6b4ad3253e73c72237fde5bced617 gmime-3.2.15.tar.xz
diff --git a/gmime3/Pkgfile b/gmime3/Pkgfile
@@ -0,0 +1,29 @@
+# Description: A C/C++ MIME creation and parser library with support for Unix mbox spools
+# URL: https://github.com/jstedfast/gmime
+# Maintainer: Shokara Kou, kou at 13f0 dot net
+# Packager: Tim Biermann, tbier at posteo dot de
+# Depends on:
+
+name=gmime3
+version=3.2.15
+release=2
+source=(https://github.com/jstedfast/gmime/releases/download/$version/gmime-$version.tar.xz)
+
+build() {
+ cd gmime-$version
+
+ ./configure \
+ --prefix=/usr \
+ --program-prefix=gmime3 \
+ --disable-crypto \
+ --disable-introspection \
+ --disable-smime \
+ --disable-gtk-doc \
+ --disable-static \
+ --without-libidn
+ sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
+ make
+ make DESTDIR=$PKG install
+
+ rm -rf $PKG/usr/share/gtk-doc
+}
diff --git a/notmuch/.footprint b/notmuch/.footprint
@@ -0,0 +1,9 @@
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/bin/
+-rwxr-xr-x root/root usr/bin/notmuch
+drwxr-xr-x root/root usr/include/
+-rw-r--r-- root/root usr/include/notmuch.h
+drwxr-xr-x root/root usr/lib/
+lrwxrwxrwx root/root usr/lib/libnotmuch.so -> libnotmuch.so.5.6.0
+lrwxrwxrwx root/root usr/lib/libnotmuch.so.5 -> libnotmuch.so.5.6.0
+-rw-r--r-- root/root usr/lib/libnotmuch.so.5.6.0
diff --git a/notmuch/.md5sum b/notmuch/.md5sum
@@ -0,0 +1,2 @@
+1d59a34a265c867a816171d50e801139 gpgless_configure.diff
+edce1607f13ad8cb9ea6409b8e04c4d6 notmuch-0.39.tar.xz
diff --git a/notmuch/Pkgfile b/notmuch/Pkgfile
@@ -0,0 +1,29 @@
+# Description: a fast, global-search and tag-based email system
+# URL: https://notmuchmail.org/
+# Maintainer: Shokara Kou, kou at 13f0 dot net
+# Packager: Tim Biermann, tbier at posteo dot de
+# Depends on: gmime3 talloc xapian-core
+# Optional: emacs
+
+name=notmuch
+version=0.39
+release=1
+source=(https://notmuchmail.org/releases/$name-$version.tar.xz
+ gpgless_configure.diff)
+
+build() {
+ cd $name-$version
+
+ patch -Np1 <$SRC/gpgless_configure.diff
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --includedir=/usr/include \
+ --with-emacs \
+ --without-bash-completion \
+ --without-zsh-completion
+
+ prt-get isinst emacs >/dev/null 2>&1 && IS_EMACS=1 || IS_EMACS=0
+ make DESTDIR=$PKG LIBDIR_IN_LDCONFIG=0 WITH_EMACS=$IS_EMACS install
+ install -Dm755 notmuch-shared $PKG/usr/bin/notmuch
+}
diff --git a/notmuch/gpgless_configure.diff b/notmuch/gpgless_configure.diff
@@ -0,0 +1,234 @@
+--- a/configure 2025-11-15 20:31:24.176390211 -0500
++++ b/configure 2025-11-15 20:34:24.654376850 -0500
+@@ -501,231 +501,6 @@
+ have_gmime=1
+ gmime_cflags=$(pkg-config --cflags gmime-3.0)
+ gmime_ldflags=$(pkg-config --libs gmime-3.0)
+-
+- printf "Checking for GMime session key extraction support... "
+-
+- cat > _check_session_keys.c <<EOF
+-#include <gmime/gmime.h>
+-#include <stdio.h>
+-
+-int main () {
+- GError *error = NULL;
+- GMimeParser *parser = NULL;
+- GMimeMultipartEncrypted *body = NULL;
+- GMimeDecryptResult *decrypt_result = NULL;
+- GMimeObject *output = NULL;
+-
+- g_mime_init ();
+- parser = g_mime_parser_new ();
+- g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/basic-encrypted.eml", "r", &error));
+- if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n");
+-
+- body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
+- if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n");
+-
+- output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error);
+- if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n");
+-
+- if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n");
+- if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n");
+-
+- printf ("%s\n", decrypt_result->session_key);
+- return 0;
+-}
+-EOF
+- if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
+- printf 'No.\nCould not make tempdir for testing session-key support.\n'
+- errors=$((errors + 1))
+- elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \
+- && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/openpgp4-secret-key.asc \
+- && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
+- && [ $SESSION_KEY = 9:496A0B6D15A5E7BA762FB8E5FE6DEE421D4D9BBFCEAD1CDD0CCF636D07ADE621 ]
+- then
+- printf "OK.\n"
+- else
+- cat <<EOF
+-No.
+-*** Error: Could not extract session keys from encrypted message.
+-
+-This is likely due to your GMime having been built against a old
+-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
+- printf 'Your current GPGME development version is: %s\n' "$GPGME_VERS"
+- else
+- printf 'You do not have the GPGME development libraries installed.\n'
+- fi
+- errors=$((errors + 1))
+- fi
+- if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
+- rm -rf "$TEMP_GPG"
+- fi
+-
+- cat > _check_gmime_cert.c <<EOF
+-#include <stdio.h>
+-#include <gmime/gmime.h>
+-
+-int main () {
+- GError *error = NULL;
+- GMimeParser *parser = NULL;
+- GMimeApplicationPkcs7Mime *body = NULL;
+- GMimeSignatureList *sig_list = NULL;
+- GMimeSignature *sig = NULL;
+- GMimeCertificate *cert = NULL;
+- GMimeObject *output = NULL;
+- int len;
+-
+- g_mime_init ();
+- parser = g_mime_parser_new ();
+- g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/pkcs7/smime-onepart-signed.eml", "r", &error));
+- if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n");
+-
+- body = GMIME_APPLICATION_PKCS7_MIME(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
+- if (body == NULL) return !! fprintf (stderr, "did not find a application/pkcs7 message\n");
+-
+- sig_list = g_mime_application_pkcs7_mime_verify (body, GMIME_VERIFY_NONE, &output, &error);
+- if (error || output == NULL) return !! fprintf (stderr, "verify failed\n");
+-
+- if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n");
+- len = g_mime_signature_list_length (sig_list);
+- if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len);
+- sig = g_mime_signature_list_get_signature (sig_list, 0);
+- if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n");
+- cert = g_mime_signature_get_certificate (sig);
+- if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n");
+-#ifdef CHECK_VALIDITY
+- GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
+- if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
+-#endif
+-#ifdef CHECK_EMAIL
+- const char *email = g_mime_certificate_get_email (cert);
+- if (! email) return !! fprintf (stderr, "no email returned");
+- if (email[0] == '<') return 2;
+-#endif
+- return 0;
+-}
+-EOF
+-
+- # see https://github.com/jstedfast/gmime/pull/90
+- # should be fixed in GMime in 3.2.7, but some distros might patch
+- printf "Checking for GMime X.509 certificate validity... "
+-
+- if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
+- printf 'No.\nCould not make tempdir for testing X.509 certificate validity support.\n'
+- errors=$((errors + 1))
+- elif ${CC} -DCHECK_VALIDITY ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_x509_validity \
+- && echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \
+- && echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$TEMP_GPG/trustlist.txt" \
+- && GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < "$srcdir"/test/smime/ca.crt
+- then
+- if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then
+- gmime_x509_cert_validity=1
+- printf "Yes.\n"
+- else
+- gmime_x509_cert_validity=0
+- printf "No.\n"
+- 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.
+-
+-Please follow up on https://github.com/jstedfast/gmime/pull/90 with
+-more details.
+-EOF
+- errors=$((errors + 1))
+- fi
+- fi
+- printf "Checking whether GMime emits email addresses with angle brackets... "
+- if ${CC} -DCHECK_EMAIL ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_email &&
+- GNUPGHOME=${TEMP_GPG} ./_check_email; then
+- gmime_emits_angle_brackets=0
+- printf "No.\n"
+- else
+- gmime_emits_angle_brackets=1
+- printf "Yes.\n"
+- fi
+- else
+- printf 'No.\nFailed to set up gpgsm for testing X.509 certificate validity support.\n'
+- errors=$((errors + 1))
+- fi
+- if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
+- rm -rf "$TEMP_GPG"
+- fi
+-
+- # see https://dev.gnupg.org/T3464
+- # there are problems verifying signatures when decrypting with session keys with GPGME 1.13.0 and 1.13.1
+- printf "Checking signature verification when decrypting using session keys... "
+-
+- cat > _verify_sig_with_session_key.c <<EOF
+-#include <stdio.h>
+-#include <gmime/gmime.h>
+-
+-int main () {
+- GError *error = NULL;
+- GMimeParser *parser = NULL;
+- GMimeMultipartEncrypted *body = NULL;
+- GMimeDecryptResult *result = NULL;
+- GMimeSignatureList *sig_list = NULL;
+- GMimeSignature *sig = NULL;
+- GMimeObject *output = NULL;
+- GMimeSignatureStatus status;
+- int len;
+-
+- g_mime_init ();
+- parser = g_mime_parser_new ();
+- g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/encrypted-signed.eml", "r", &error));
+- if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n");
+-
+- body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
+- if (body == NULL) return !! fprintf (stderr, "did not find a multipart/encrypted message\n");
+-
+- output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_NONE, "9:9E1CDF53BBF794EA34F894B5B68E1E56FB015EA69F81D2A5EAB7F96C7B65783E", &result, &error);
+- if (error || output == NULL) return !! fprintf (stderr, "decrypt failed\n");
+-
+- sig_list = g_mime_decrypt_result_get_signatures (result);
+- if (sig_list == NULL) return !! fprintf (stderr, "sig_list is NULL\n");
+-
+- if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n");
+- len = g_mime_signature_list_length (sig_list);
+- if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len);
+- sig = g_mime_signature_list_get_signature (sig_list, 0);
+- if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n");
+- status = g_mime_signature_get_status (sig);
+- if (status & GMIME_SIGNATURE_STATUS_KEY_MISSING) return !! fprintf (stderr, "signature status contains KEY_MISSING (see https://dev.gnupg.org/T3464)\n");
+-
+- return 0;
+-}
+-EOF
+- if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
+- printf 'No.\nCould not make tempdir for testing signature verification when decrypting with session keys.\n'
+- errors=$((errors + 1))
+- elif ${CC} ${CFLAGS} ${gmime_cflags} _verify_sig_with_session_key.c ${gmime_ldflags} -o _verify_sig_with_session_key \
+- && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/openpgp4-secret-key.asc \
+- && rm -f ${TEMP_GPG}/private-keys-v1.d/*.key
+- then
+- if GNUPGHOME=${TEMP_GPG} ./_verify_sig_with_session_key; then
+- gmime_verify_with_session_key=1
+- printf "Yes.\n"
+- else
+- gmime_verify_with_session_key=0
+- printf "No.\n"
+- cat <<EOF
+-*** Error: GMime fails to verify signatures when decrypting with a session key.
+-
+-This is most likely due to a buggy version of GPGME, which should be fixed in 1.13.2 or later.
+-See https://dev.gnupg.org/T3464 for more details.
+-EOF
+- fi
+- else
+- printf 'No.\nFailed to set up gpg for testing signature verification while decrypting with a session key.\n'
+- errors=$((errors + 1))
+- fi
+- if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
+- rm -rf "$TEMP_GPG"
+- fi
+ else
+ have_gmime=0
+ printf "No.\n"