OS X build issues with gpgme

Just creating an issue out of my post on the mutt-users list, since this turned out to be an actual issue

Building latest mutt (2.2.10) on latest Ventura (13.5) (using homebrew for all the deps), and getting errors like this for gpg-error and a similar one for gpgme itself

configure: WARNING:
***
*** The config script "/opt/homebrew/bin/gpgrt-config --libdir=/opt/homebrew/lib
gpg-error" was
*** built for aarch64-apple-darwin22.3.0 and thus may not match the
*** used host aarch64-apple-darwin22.6.0.
*** You may want to use the configure option --with-libgpg-error-prefix
*** to specify a matching config script or use $SYSROOT.
***

I'm running:

% ./configure --disable-fcntl --disable-pop --enable-imap --enable-debug --disable-flock --enable-gpgme --enable-locales-fix --with-sasl=/usr/local --enable-smtp --without-gss --enable-hcache --without-gdbm --without-bdb --with-kyotocabinet=/opt/homebrew/opt/kyoto-cabinet --with-ssl=/opt/homebrew/opt/openssl@3.1

Also experimented with adding:

--includedir=/opt/homebrew/include --with-gpgme-prefix=/opt/homebrew/opt/gpgme --with-libgpg-error-prefix=/opt/homebrew/opt/libgpg-error

(which I don't usually use / need)

Rebuilding both packages from source in Homebrew (brew reinstall --build-from-source libgpg-error gpgme) silences those warnings about the mismatched version during the configure step, but make still fails on:

In file included from crypt-gpgme.c:47:
/opt/homebrew/Cellar/gpgme/1.21.0/include/gpgme.h:30:10: fatal error: 'gpg-error.h' file
not found
#include <gpg-error.h>
         ^~~~~~~~~~~~~
1 error generated.

@kevin8t8: the changes in your branch kevin/stable-gpgme-macos-fix appear to fix it for me from a quick test on a different machine.

Edited by William Yardley