Control: tags 1023767 + patch

On Wed 2022-11-09 22:04:00 +0100, Timo Röhling wrote:
> neomutt fails to build with the recent libgpgme-dev update that dropped
> the gpgme-config executable.
>
> https://github.com/neomutt/neomutt/pull/3555 fixes the problem, but does
> not apply cleanly to the neomutt release in Debian, unfortunately.

The attached patch appears to fix things for me so that neomutt builds
successfully against libgpgme-dev 1.18.0-3, though i don't know enough
about how to adequately test neomutt to be confident in the results (i
don't use neomutt myself).

It's also on salsa at
https://salsa.debian.org/mutt-team/neomutt/-/merge_requests/8 if that's
useful.

Please let me know if you'd like me to NMU it.

       --dkg

From a9d3c0fe8c8e678311ad7a4810df6db519abc798 Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor <d...@fifthhorseman.net>
Date: Mon, 21 Nov 2022 19:10:20 -0500
Subject: [PATCH] find modern versions of gpgme (Closes: #1023767)

---
 debian/patches/series                         |   1 +
 .../upstream/Use-pkgconf-to-find-GPGMe.patch  | 121 ++++++++++++++++++
 2 files changed, 122 insertions(+)
 create mode 100644 debian/patches/upstream/Use-pkgconf-to-find-GPGMe.patch

diff --git a/debian/patches/series b/debian/patches/series
index 8c37cf1cc..b0cb4f4fc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ upstream/964416-manpages-fixes.patch
 upstream/1020414-gsasl-support-prereq.patch
 upstream/1020414-gsasl-support.patch
 upstream/use-pkgconfig-for-libgpg-error.patch
+upstream/Use-pkgconf-to-find-GPGMe.patch
diff --git a/debian/patches/upstream/Use-pkgconf-to-find-GPGMe.patch b/debian/patches/upstream/Use-pkgconf-to-find-GPGMe.patch
new file mode 100644
index 000000000..f4c583cdb
--- /dev/null
+++ b/debian/patches/upstream/Use-pkgconf-to-find-GPGMe.patch
@@ -0,0 +1,121 @@
+From: Pietro Cerutti <g...@gahr.ch>
+Date: Mon, 7 Nov 2022 08:41:07 +0000
+Subject: Use pkgconf to find GPGMe
+
+(cherry-picked from upstream 516568f3f0769fad1c006a6b3a70884e97092a2a)
+---
+ Makefile.autosetup |  2 +-
+ auto.def           | 85 ++++--------------------------------------------------
+ 2 files changed, 6 insertions(+), 81 deletions(-)
+
+diff --git a/Makefile.autosetup b/Makefile.autosetup
+index 3884704..24a2f17 100644
+--- a/Makefile.autosetup
++++ b/Makefile.autosetup
+@@ -572,7 +572,7 @@ $(PWD)/mutt:
+ LIBNCRYPT=	libncrypt.a
+ LIBNCRYPTOBJS=	ncrypt/config.o ncrypt/crypt.o ncrypt/cryptglue.o \
+ 		ncrypt/crypt_mod.o
+-@if HAVE_GPGME
++@if HAVE_PKG_GPGME
+ LIBNCRYPTOBJS+=	ncrypt/crypt_gpgme.o ncrypt/dlg_gpgme.o \
+ 		ncrypt/crypt_mod_pgp_gpgme.o ncrypt/crypt_mod_smime_gpgme.o
+ @endif
+diff --git a/auto.def b/auto.def
+index 12dc5d3..e0dcbb5 100644
+--- a/auto.def
++++ b/auto.def
+@@ -480,88 +480,13 @@ if {[get-define want-gpgme]} {
+     define-append CFLAGS -D_FILE_OFFSET_BITS=[get-define _FILE_OFFSET_BITS]
+   }
+ 
+-  msg-checking "Checking for GPGME..."
+-  if {1} {
+-    # Locate gpgme-config
+-    set gpgme_prefix [opt-val with-gpgme $prefix]
+-    set gpgme_config_guess [file join $gpgme_prefix bin gpgme-config]
+-    if {[file-isexec $gpgme_config_guess]} {
+-      define GPGME-CONFIG $gpgme_config_guess
+-    } else {
+-      if {![cc-check-progs gpgme-config]} {
+-        user-error "Unable to find gpgme-config"
+-      }
+-    }
+-    set gpgme_config [get-define GPGME-CONFIG]
+-
+-    # Version
+-    if {[catch {exec-with-stderr $gpgme_config --version} gpgme_version err]} {
+-      user-error "Could not derive --version from $gpgme_config"
+-    }
+-    if {[scan $gpgme_version "%d.%d.%d" gpgme_maj gpgme_min gpgme_patch] != 3} {
+-      user-error "Could not parse GPGME version $gpgme_version"
+-    }
+-    msg-result $gpgme_version
+-    if {[get-define want-autocrypt]} {
+-      if {$gpgme_maj < 1 || $gpgme_min < 8} {
+-        user-error "Found GPGME version $gpgme_version, need 1.8.0 for AutoCrypt"
+-      }
+-    } else {
+-      if {$gpgme_maj < 1 || $gpgme_min < 4} {
+-        user-error "Found GPGME version $gpgme_version, need 1.4.0"
+-      }
+-    }
+-    define GPGME_VERSION_NUMBER [format "0x%02x%02x%02x" $gpgme_maj $gpgme_min $gpgme_patch]
+-
+-    # RHEL6 doesn't have this function yet
+-    cc-check-function-in-lib gpgme_op_export_keys gpgme
+-
+-    # CFLAGS
+-    if {[catch {exec-with-stderr $gpgme_config --cflags} res err]} {
+-      user-error "Could not derive --cflags from $gpgme_config"
+-    }
+-    define-append CFLAGS $res
+-
+-    # LIBS
+-    if {[catch {exec-with-stderr $gpgme_config --libs} res err]} {
+-      user-error "Could not derive --libs from $gpgme_config"
+-    }
+-    define-append LIBS $res
+-  }
+-  define-feature gpgme
+-
+-  if {![get-define want-pkgconf] || ![pkgconf false gpg-error]} {
+-    # Locate gpg-error-config
+-    msg-checking "Checking for gpg-error..."
+-    set gpg_error_config_guess [file join $gpgme_prefix bin gpg-error-config]
+-    if {[file-isexec $gpg_error_config_guess]} {
+-      define GPG-ERROR-CONFIG $gpg_error_config_guess
+-    } else {
+-      if {![cc-check-progs gpg-error-config]} {
+-        user-error "Unable to find gpg-error-config: $gpg_error_config_guess - aaaa"
+-      }
+-    }
+-    set gpg_error_config [get-define GPG-ERROR-CONFIG]
+-
+-    # Version
+-    if {[catch {exec-with-stderr $gpg_error_config --version} gpg_error_version err]} {
+-      user-error "Could not derive --version from $gpg_error_config"
+-    }
++  pkgconf true gpgme
++  pkgconf true gpg-error
+ 
+-    # CFLAGS
+-    if {[catch {exec-with-stderr $gpg_error_config --cflags} res err]} {
+-      user-error "Could not derive --cflags from $gpg_error_config"
+-    }
+-    define-append CFLAGS $res
+-
+-    # LIBS
+-    if {[catch {exec-with-stderr $gpg_error_config --libs} res err]} {
+-      user-error "Could not derive --libs from $gpg_error_config"
+-    }
+-    define-append LIBS $res
+-    msg-result $gpg_error_version
+-  }
++  # Version might look like this: 1.13.1-unknown, so split on both '.' and '-'
++  lassign [split [get-define PKG_GPGME_VERSION] .-] gpgme_maj gpgme_min gpgme_patch
+ 
++  define GPGME_VERSION_NUMBER [format "0x%02x%02x%02x" $gpgme_maj $gpgme_min $gpgme_patch]
+   define CRYPT_BACKEND_GPGME
+ }
+ 
-- 
2.35.1

Attachment: signature.asc
Description: PGP signature

Reply via email to