summaryrefslogtreecommitdiffstats
path: root/external/gpgmepp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xexternal/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.172
-rw-r--r--external/gpgmepp/ExternalPackage_gpgmepp.mk40
-rw-r--r--external/gpgmepp/ExternalProject_gpgmepp.mk81
-rw-r--r--external/gpgmepp/Library_gpgmepp.mk91
-rw-r--r--external/gpgmepp/Makefile14
-rw-r--r--external/gpgmepp/Module_gpgmepp.mk26
-rw-r--r--external/gpgmepp/README7
-rw-r--r--external/gpgmepp/UnpackedTarball_gpgmepp.mk40
-rwxr-xr-xexternal/gpgmepp/Wincompatible-function-pointer-types.patch31
-rw-r--r--external/gpgmepp/asan.patch12
-rw-r--r--external/gpgmepp/c++20.patch11
-rw-r--r--external/gpgmepp/clang-cl.patch20
-rw-r--r--external/gpgmepp/configure.patch34
-rw-r--r--external/gpgmepp/find-libgpg-error-libassuan.patch66
-rw-r--r--external/gpgmepp/fix-autoconf-macros.patch39
-rw-r--r--external/gpgmepp/gcc9.patch10
-rw-r--r--external/gpgmepp/macos-include.patch10
-rw-r--r--external/gpgmepp/rpath.patch12
-rw-r--r--external/gpgmepp/ubsan.patch52
-rw-r--r--external/gpgmepp/w32-add-initializer.patch.116
-rw-r--r--external/gpgmepp/w32-build-fixes-2.patch22
-rw-r--r--external/gpgmepp/w32-build-fixes.patch.1138
-rw-r--r--external/gpgmepp/w32-disable-docs.patch.115
-rw-r--r--external/gpgmepp/w32-fix-libtool.patch.138
-rw-r--r--external/gpgmepp/w32-fix-win32-macro.patch.1176
-rw-r--r--external/gpgmepp/w32-include.patch42
26 files changed, 1115 insertions, 0 deletions
diff --git a/external/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.1 b/external/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.1
new file mode 100755
index 000000000..c7b288d72
--- /dev/null
+++ b/external/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.1
@@ -0,0 +1,72 @@
+From f02c20cc9c5756690b07abfd02a43533547ba2ef Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
+Date: Fri, 19 Aug 2022 11:05:37 +0200
+Subject: [PATCH] cpp: Fix building with C++11
+
+* lang/cpp/src/importresult.cpp (ImportResult::mergeWith): Replace
+'auto' in lambdas with the actual type.
+--
+
+Generic lambdas require C++14.
+
+GnuPG-bug-id: 6141
+---
+ lang/cpp/src/importresult.cpp | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
+index 06258729..0a7ad03d 100644
+--- a/lang/cpp/src/importresult.cpp
++++ b/lang/cpp/src/importresult.cpp
+@@ -152,17 +152,17 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
+ }
+ // was this key also considered during the first import
+ const auto consideredInFirstImports =
+- std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
++ std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr);
+ });
+ // did we see this key already in the list of keys of the other import
+ const auto consideredInPreviousOtherImports =
+- std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
++ std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr);
+ });
+ // was anything added to this key during the other import
+ const auto changedInOtherImports =
+- std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
++ std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status != 0);
+ });
+ if (consideredInFirstImports && !consideredInPreviousOtherImports) {
+@@ -177,15 +177,15 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
+
+ // now do the same for the secret key counts
+ const auto secretKeyConsideredInFirstImports =
+- std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
++ std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
+ });
+ const auto secretKeyConsideredInPreviousOtherImports =
+- std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
++ std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
+ });
+ const auto secretKeyChangedInOtherImports =
+- std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
++ std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET) && (i->status != GPGME_IMPORT_SECRET);
+ });
+ if (secretKeyConsideredInFirstImports && !secretKeyConsideredInPreviousOtherImports) {
+@@ -204,7 +204,7 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
+ d->imports.reserve(d->imports.size() + other.d->imports.size());
+ std::transform(std::begin(other.d->imports), std::end(other.d->imports),
+ std::back_inserter(d->imports),
+- [](const auto import) {
++ [](const gpgme_import_status_t import) {
+ gpgme_import_status_t copy = new _gpgme_import_status{*import};
+ if (import->fpr) {
+ copy->fpr = strdup(import->fpr);
+--
+2.34.1
+
diff --git a/external/gpgmepp/ExternalPackage_gpgmepp.mk b/external/gpgmepp/ExternalPackage_gpgmepp.mk
new file mode 100644
index 000000000..2b8530872
--- /dev/null
+++ b/external/gpgmepp/ExternalPackage_gpgmepp.mk
@@ -0,0 +1,40 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,gpgmepp,gpgmepp))
+
+$(eval $(call gb_ExternalPackage_use_external_project,gpgmepp,gpgmepp))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+
+ifeq ($(OS),LINUX)
+
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgmepp.so.6,lang/cpp/src/.libs/libgpgmepp.so.6.15.0))
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgme.so.11,src/.libs/libgpgme.so.11.27.0))
+
+else ifeq ($(OS),MACOSX)
+
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgmepp.6.dylib,lang/cpp/src/.libs/libgpgmepp.6.dylib))
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgme.11.dylib,src/.libs/libgpgme.11.dylib))
+
+else ifeq ($(OS),WNT)
+
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/gpgme-w32spawn.exe,src/gpgme-w32spawn.exe))
+
+endif
+
+# If a tool executed during the build (like svidl) requires these gpgmepp libraries, it will also
+# require those libassuan and libgpg-error libraries that these gpgmepp libraries link against:
+$(call gb_Package_get_target_for_build,gpgmepp): \
+ $(call gb_Helper_optional,LIBASSUAN,$(call gb_Package_get_target_for_build,libassuan)) \
+ $(call gb_Helper_optional,LIBGPGERROR,$(call gb_Package_get_target_for_build,libgpg-error))
+
+endif # $(DISABLE_DYNLOADING)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/ExternalProject_gpgmepp.mk b/external/gpgmepp/ExternalProject_gpgmepp.mk
new file mode 100644
index 000000000..a58717fe3
--- /dev/null
+++ b/external/gpgmepp/ExternalProject_gpgmepp.mk
@@ -0,0 +1,81 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,gpgmepp))
+
+$(eval $(call gb_ExternalProject_register_targets,gpgmepp,\
+ build \
+))
+
+$(eval $(call gb_ExternalProject_use_autoconf,gpgmepp,build))
+
+$(eval $(call gb_ExternalProject_use_externals,gpgmepp,\
+ libgpg-error \
+ libassuan \
+))
+
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_get_target_for_build,cpp)
+ $(call gb_Trace_StartRange,gpgmepp,EXTERNAL)
+ $(call gb_ExternalProject_run,build, \
+ $(gb_WIN_GPG_cross_setup_exports) \
+ && autoreconf \
+ && $(gb_RUN_CONFIGURE) ./configure \
+ $(gb_CONFIGURE_PLATFORMS) \
+ --disable-shared \
+ --disable-languages \
+ --disable-gpgconf-test \
+ --disable-gpg-test \
+ --disable-gpgsm-test \
+ --disable-g13-test \
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+ CFLAGS='$(CFLAGS) \
+ $(call gb_ExternalProject_get_build_flags,gpgmepp)' \
+ $(gb_WIN_GPG_platform_switches) \
+ MAKE=$(MAKE) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,gpgmepp,EXTERNAL)
+else
+$(call gb_ExternalProject_get_state_target,gpgmepp,build):
+ $(call gb_Trace_StartRange,gpgmepp,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ autoreconf \
+ && $(gb_RUN_CONFIGURE) ./configure \
+ --disable-gpgconf-test \
+ --disable-gpg-test \
+ --disable-gpgsm-test \
+ --disable-g13-test \
+ --enable-languages="cpp" \
+ GPG_ERROR_CFLAGS="$(GPG_ERROR_CFLAGS)" \
+ GPG_ERROR_LIBS="$(GPG_ERROR_LIBS)" \
+ LIBASSUAN_CFLAGS="$(LIBASSUAN_CFLAGS)" \
+ LIBASSUAN_LIBS="$(LIBASSUAN_LIBS)" \
+ CFLAGS='$(CFLAGS) \
+ $(call gb_ExternalProject_get_build_flags,gpgmepp)' \
+ CXXFLAGS='$(CXXFLAGS) \
+ $(call gb_ExternalProject_get_build_flags,gpgmepp) \
+ $(gb_COMPILERDEFS_STDLIB_DEBUG)' \
+ $(if $(filter LINUX,$(OS)), \
+ 'LDFLAGS=-Wl$(COMMA)-z$(COMMA)origin \
+ -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN') \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
+ && $(MAKE) \
+ $(if $(filter MACOSX,$(OS)),\
+ && $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
+ $(EXTERNAL_WORKDIR)/lang/cpp/src/.libs/libgpgmepp.6.dylib \
+ $(EXTERNAL_WORKDIR)/src/.libs/libgpgme.11.dylib \
+ ) \
+ )
+ $(call gb_Trace_EndRange,gpgmepp,EXTERNAL)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/Library_gpgmepp.mk b/external/gpgmepp/Library_gpgmepp.mk
new file mode 100644
index 000000000..ac71cf8b9
--- /dev/null
+++ b/external/gpgmepp/Library_gpgmepp.mk
@@ -0,0 +1,91 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,gpgmepp))
+
+$(eval $(call gb_Library_use_unpacked,gpgmepp,gpgmepp))
+
+$(eval $(call gb_Library_use_externals,gpgmepp,\
+ libgpg-error \
+ libassuan \
+))
+
+$(eval $(call gb_LinkTarget_use_external_project,\
+ $(call gb_Library_get_linktarget,gpgmepp),gpgmepp,full))
+
+$(eval $(call gb_Library_set_warnings_disabled,gpgmepp))
+
+$(eval $(call gb_Library_set_include,gpgmepp,\
+ -I$(call gb_UnpackedTarball_get_dir,gpgmepp)/lang/cpp/src \
+ -I$(call gb_UnpackedTarball_get_dir,gpgmepp)/lang/cpp/src/interfaces \
+ -I$(call gb_UnpackedTarball_get_dir,gpgmepp) \
+ -I$(call gb_UnpackedTarball_get_dir,gpgmepp)/src \
+ -I$(call gb_UnpackedTarball_get_dir,gpgmepp)/conf \
+ -I$(call gb_UnpackedTarball_get_dir,libgpg-error)/src \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_add_libs,gpgmepp,\
+ ws2_32.lib shell32.lib \
+ -LIBPATH:$(call gb_UnpackedTarball_get_dir,gpgmepp)/src/.libs libgpgme.lib \
+))
+
+$(eval $(call gb_Library_add_defs,gpgmepp,\
+ -DHAVE_CONFIG_H \
+ -DBUILDING_GPGMEPP \
+ -DDLL_EXPORT \
+ -DPIC \
+))
+
+$(eval $(call gb_Library_set_generated_cxx_suffix,gpgmepp,cpp))
+
+$(eval $(call gb_Library_add_generated_exception_objects,gpgmepp,\
+ UnpackedTarball/gpgmepp/lang/cpp/src/callbacks \
+ UnpackedTarball/gpgmepp/lang/cpp/src/configuration \
+ UnpackedTarball/gpgmepp/lang/cpp/src/context \
+ UnpackedTarball/gpgmepp/lang/cpp/src/context_vanilla \
+ UnpackedTarball/gpgmepp/lang/cpp/src/data \
+ UnpackedTarball/gpgmepp/lang/cpp/src/decryptionresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/defaultassuantransaction \
+ UnpackedTarball/gpgmepp/lang/cpp/src/editinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/encryptionresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/engineinfo \
+ UnpackedTarball/gpgmepp/lang/cpp/src/eventloopinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/exception \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgaddexistingsubkeyeditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgadduserideditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgagentgetinfoassuantransaction \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpggencardkeyinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgrevokekeyeditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgsetexpirytimeeditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgsetownertrusteditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgsignkeyeditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/importresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/key \
+ UnpackedTarball/gpgmepp/lang/cpp/src/keygenerationresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/keylistresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/scdgetinfoassuantransaction \
+ UnpackedTarball/gpgmepp/lang/cpp/src/signingresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/swdbresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/tofuinfo \
+ UnpackedTarball/gpgmepp/lang/cpp/src/trustitem \
+ UnpackedTarball/gpgmepp/lang/cpp/src/util \
+ UnpackedTarball/gpgmepp/lang/cpp/src/verificationresult \
+ UnpackedTarball/gpgmepp/lang/cpp/src/vfsmountresult \
+))
+
+ifeq ($(COM),MSC)
+ifeq ($(COM_IS_CLANG),TRUE)
+$(eval $(call gb_Library_add_cxxflags,gpgmepp, \
+ -Wno-c++11-narrowing \
+))
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/Makefile b/external/gpgmepp/Makefile
new file mode 100644
index 000000000..569ad8a0b
--- /dev/null
+++ b/external/gpgmepp/Makefile
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/Module_gpgmepp.mk b/external/gpgmepp/Module_gpgmepp.mk
new file mode 100644
index 000000000..5763ccedb
--- /dev/null
+++ b/external/gpgmepp/Module_gpgmepp.mk
@@ -0,0 +1,26 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,gpgmepp))
+
+$(eval $(call gb_Module_add_targets,gpgmepp,\
+ UnpackedTarball_gpgmepp \
+ ExternalProject_gpgmepp \
+ ExternalPackage_gpgmepp \
+))
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Module_add_targets,gpgmepp,\
+ Library_gpgmepp \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/README b/external/gpgmepp/README
new file mode 100644
index 000000000..149ca3b5e
--- /dev/null
+++ b/external/gpgmepp/README
@@ -0,0 +1,7 @@
+A library for easy access to GnuPG (GnuPG Made Easy)
+[https://www.gnupg.org/related_software/gpgme/index.html]
+
+(The upstream project and its git repo at <https://dev.gnupg.org/source/gpgme/> are called "gpgme",
+not "gpgmepp". This external module was renamed from external/gpgme to external/gpgmepp with
+50a55d862034b7a06510c014332236f44e306831 "gpg4libre: cleanup gpgme & add gbuild lib for gpgmepp":
+"This moves the external to gpgmepp, since that's what we _actually_ link against [...]")
diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
new file mode 100644
index 000000000..be2b616d1
--- /dev/null
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -0,0 +1,40 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,gpgmepp))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,gpgmepp,$(GPGME_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,gpgmepp,0))
+
+# * external/gpgmepp/configure.patch: see
+# <https://lists.gnu.org/archive/html/autoconf/2020-11/msg00004.html> "Fallout from
+# _AC_UNDECLARED_WARNING in autoconf 2.70beta" for upstream discussion
+$(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
+ external/gpgmepp/find-libgpg-error-libassuan.patch \
+ external/gpgmepp/fix-autoconf-macros.patch \
+ $(if $(filter MSC,$(COM)),external/gpgmepp/w32-build-fixes.patch.1) \
+ $(if $(filter MSC,$(COM)),external/gpgmepp/w32-disable-docs.patch.1) \
+ $(if $(filter MSC,$(COM)),external/gpgmepp/w32-fix-win32-macro.patch.1) \
+ $(if $(filter MSC,$(COM)),external/gpgmepp/w32-fix-libtool.patch.1) \
+ $(if $(filter MSC,$(COM)),external/gpgmepp/w32-add-initializer.patch.1) \
+ external/gpgmepp/w32-build-fixes-2.patch \
+ $(if $(filter LINUX,$(OS)),external/gpgmepp/asan.patch) \
+ $(if $(filter LINUX,$(OS)),external/gpgmepp/rpath.patch) \
+ external/gpgmepp/gcc9.patch \
+ external/gpgmepp/ubsan.patch \
+ external/gpgmepp/c++20.patch \
+ external/gpgmepp/clang-cl.patch \
+ external/gpgmepp/configure.patch \
+ external/gpgmepp/w32-include.patch \
+ external/gpgmepp/Wincompatible-function-pointer-types.patch \
+ external/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.1 \
+ external/gpgmepp/macos-include.patch \
+))
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/Wincompatible-function-pointer-types.patch b/external/gpgmepp/Wincompatible-function-pointer-types.patch
new file mode 100755
index 000000000..050d2e55c
--- /dev/null
+++ b/external/gpgmepp/Wincompatible-function-pointer-types.patch
@@ -0,0 +1,31 @@
+--- src/assuan-support.c
++++ src/assuan-support.c
+@@ -126,7 +126,7 @@
+ }
+
+
+-static gpgme_ssize_t
++static ssize_t
+ my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
+ {
+ (void)ctx;
+@@ -134,7 +134,7 @@
+ }
+
+
+-static gpgme_ssize_t
++static ssize_t
+ my_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size)
+ {
+ (void)ctx;
+--- src/gpgme-w32spawn.c
++++ src/gpgme-w32spawn.c
+@@ -243,7 +243,7 @@
+ handle = LoadLibrary ("user32.dll");
+ if (handle)
+ {
+- func = GetProcAddress (handle, "AllowSetForegroundWindow");
++ func = (BOOL (WINAPI *)(DWORD)) GetProcAddress (handle, "AllowSetForegroundWindow");
+ if (!func)
+ FreeLibrary (handle);
+ }
diff --git a/external/gpgmepp/asan.patch b/external/gpgmepp/asan.patch
new file mode 100644
index 000000000..e0b1c85fe
--- /dev/null
+++ b/external/gpgmepp/asan.patch
@@ -0,0 +1,12 @@
+--- src/posix-io.c
++++ src/posix-io.c
+@@ -563,6 +563,9 @@
+
+ if (atfork)
+ atfork (atforkvalue, 0);
++ char const * ld_path = getenv("LIBO_LD_PATH");
++ if (ld_path && setenv("LD_LIBRARY_PATH", ld_path, 1) != 0)
++ abort();
+
+ /* First close all fds which will not be inherited. If we
+ * have closefrom(2) we first figure out the highest fd we
diff --git a/external/gpgmepp/c++20.patch b/external/gpgmepp/c++20.patch
new file mode 100644
index 000000000..3141dca1e
--- /dev/null
+++ b/external/gpgmepp/c++20.patch
@@ -0,0 +1,11 @@
+--- lang/cpp/src/keylistresult.cpp
++++ lang/cpp/src/keylistresult.cpp
+@@ -77,7 +77,7 @@
+
+ void GpgME::KeyListResult::detach()
+ {
+- if (!d || d.unique()) {
++ if (!d || d.use_count() == 1) {
+ return;
+ }
+ d.reset(new Private(*d));
diff --git a/external/gpgmepp/clang-cl.patch b/external/gpgmepp/clang-cl.patch
new file mode 100644
index 000000000..3f63d0bc6
--- /dev/null
+++ b/external/gpgmepp/clang-cl.patch
@@ -0,0 +1,20 @@
+--- src/w32-util.c
++++ src/w32-util.c
+@@ -173,7 +173,7 @@
+ NULL; caller may use GetLastError to get the actual error number.
+ Calling this function with STRING set to NULL is not defined. */
+ static wchar_t *
+-utf8_to_wchar (const char *string)
++utf8_to_wchar_ (const char *string)
+ {
+ int n;
+ wchar_t *result;
+@@ -206,7 +206,7 @@
+ if (!string)
+ return NULL;
+
+- return utf8_to_wchar (string);
++ return utf8_to_wchar_ (string);
+ }
+
+
diff --git a/external/gpgmepp/configure.patch b/external/gpgmepp/configure.patch
new file mode 100644
index 000000000..ad3f97e63
--- /dev/null
+++ b/external/gpgmepp/configure.patch
@@ -0,0 +1,34 @@
+--- configure.ac
++++ configure.ac
+@@ -617,6 +617,15 @@
+ AC_SUBST(API__SSIZE_T)
+ AM_SUBST_NOTMAKE(API__SSIZE_T)
+
++# Try to find a thread-safe version of ttyname().
++gnupg_REPLACE_TTYNAME_R
++if test "$ac_cv_func_ttyname_r" != yes; then
++ AC_MSG_WARN([
++***
++*** ttyname() is not thread-safe and ttyname_r() does not exist
++***])
++fi
++
+ # Checks for compiler features.
+ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
+@@ -677,15 +686,6 @@
+
+ AC_FUNC_FSEEKO
+
+-# Try to find a thread-safe version of ttyname().
+-gnupg_REPLACE_TTYNAME_R
+-if test "$ac_cv_func_ttyname_r" != yes; then
+- AC_MSG_WARN([
+-***
+-*** ttyname() is not thread-safe and ttyname_r() does not exist
+-***])
+-fi
+-
+ # Try to find a thread-safe version of getenv().
+ have_thread_safe_getenv=no
+ jm_GLIBC21
diff --git a/external/gpgmepp/find-libgpg-error-libassuan.patch b/external/gpgmepp/find-libgpg-error-libassuan.patch
new file mode 100644
index 000000000..a98a7d845
--- /dev/null
+++ b/external/gpgmepp/find-libgpg-error-libassuan.patch
@@ -0,0 +1,66 @@
+diff --git a/configure.ac b/configure.ac
+index f28480b..92a3e85 100644
+--- configure.ac
++++ configure.ac
+@@ -719,8 +719,18 @@
+
+ # Checking for libgpg-error.
+ have_gpg_error=no
+-AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
+- have_gpg_error=yes, have_gpg_error=no)
++if test "x${GPG_ERROR_CFLAGS}" = x; then
++ AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
++ have_gpg_error=yes, have_gpg_error=no)
++else
++ have_gpg_error=yes
++ GPG_ERROR_CFLAGS="$GPG_ERROR_CFLAGS"
++ GPG_ERROR_LIBS="$GPG_ERROR_LIBS"
++ AC_SUBST(GPG_ERROR_CFLAGS)
++ AC_SUBST(GPG_ERROR_LIBS)
++
++fi
++
+ AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
+ [The default error source for GPGME.])
+
+@@ -729,8 +739,17 @@
+
+ # And for libassuan.
+ have_libassuan=no
+-AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
++if test "x${LIBASSUAN_CFLAGS}" = x; then
++ AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
+ have_libassuan=yes, have_libassuan=no)
++else
++ have_libassuan=yes
++ LIBASSUAN_CFLAGS="$LIBASSUAN_CFLAGS"
++ LIBASSUAN_LIBS="$LIBASSUAN_LIBS"
++ AC_SUBST(LIBASSUAN_CFLAGS)
++ AC_SUBST(LIBASSUAN_LIBS)
++fi
++
+ if test "$have_libassuan" = "yes"; then
+ AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
+ [version of the libassuan library])
+--- lang/cpp/tests/Makefile.am 2020-06-20 00:43:49.213657887 +0200
++++ lang/cpp/tests/Makefile.am~ 2019-01-25 13:27:34.000000000 +0100
+@@ -21,7 +21,7 @@
+ AM_LDFLAGS = -no-install
+
+ LDADD = ../../cpp/src/libgpgmepp.la \
++ ../../../src/libgpgme.la @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ \
+- ../../../src/libgpgme.la @GPG_ERROR_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
+
+ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
+--- lang/cpp/tests/Makefile.in 2020-06-20 00:44:49.542344510 +0200
++++ lang/cpp/tests/Makefile.in~ 2020-06-13 00:55:19.021212970 +0200
+@@ -427,7 +427,7 @@
+ top_srcdir = @top_srcdir@
+ AM_LDFLAGS = -no-install
+ LDADD = ../../cpp/src/libgpgmepp.la \
++ ../../../src/libgpgme.la @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ \
+- ../../../src/libgpgme.la @GPG_ERROR_LIBS@ \
+ @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
+
+ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
diff --git a/external/gpgmepp/fix-autoconf-macros.patch b/external/gpgmepp/fix-autoconf-macros.patch
new file mode 100644
index 000000000..265703b00
--- /dev/null
+++ b/external/gpgmepp/fix-autoconf-macros.patch
@@ -0,0 +1,39 @@
+diff -ur gpgme.org/configure.ac gpgme/configure.ac
+--- configure.ac 2017-02-16 15:18:45.051417378 +0100
++++ configure.ac~ 2017-02-16 15:20:03.635059285 +0100
+@@ -38,6 +38,11 @@
+ # the decimalized short revision number, a beta version string and a
+ # flag indicating a development version (mym4_isbeta). Note that the
+ # m4 processing is done by autoconf and not during the configure run.
++m4_define([m4_chomp_all],
++[m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [
++/], [/ ]), [/*$]), [$1])])
++
++m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])
+ m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
+ mym4_package mym4_major mym4_minor mym4_micro),[:]))
+ m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
+@@ -98,7 +103,22 @@
+ AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_SRCDIR([src/gpgme.h.in])
+ AC_CONFIG_HEADERS([conf/config.h])
+-AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
++
++dnl Initialize automake. automake < 1.12 didn't have serial-tests and
++dnl gives an error if it sees this, but for automake >= 1.13
++dnl serial-tests is required so we have to include it. Solution is to
++dnl test for the version of automake (by running an external command)
++dnl and provide it if necessary. Note we have to do this entirely using
++dnl m4 macros since automake queries this macro by running
++dnl 'autoconf --trace ...'.
++m4_define([serial_tests], [
++ m4_esyscmd([automake --version |
++ head -1 |
++ awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
++ ])
++])
++AM_INIT_AUTOMAKE(foreign serial_tests dist-bzip2 no-dist-gzip) dnl NB: Do not [quote] this parameter.
++
+ AM_MAINTAINER_MODE
+ AC_CANONICAL_HOST
+ AM_SILENT_RULES
diff --git a/external/gpgmepp/gcc9.patch b/external/gpgmepp/gcc9.patch
new file mode 100644
index 000000000..709154ec1
--- /dev/null
+++ b/external/gpgmepp/gcc9.patch
@@ -0,0 +1,10 @@
+--- lang/cpp/src/key.h
++++ lang/cpp/src/key.h
+@@ -68,6 +68,7 @@
+ /* implicit */ Key(const Null &);
+ Key(const shared_gpgme_key_t &key);
+ Key(gpgme_key_t key, bool acquireRef);
++ Key(Key const &) = default;
+
+ static const Null null;
+
diff --git a/external/gpgmepp/macos-include.patch b/external/gpgmepp/macos-include.patch
new file mode 100644
index 000000000..93dd297c7
--- /dev/null
+++ b/external/gpgmepp/macos-include.patch
@@ -0,0 +1,10 @@
+--- lang/cpp/src/importresult.cpp 2022-08-10 18:17:33.000000000 +0900
++++ lang/cpp/src/importresult.cpp 2022-11-29 01:37:44.786604882 +0900
+@@ -31,6 +31,7 @@
+ #include "result_p.h"
+
+ #include <gpgme.h>
++#include <algorithm>
+ #include <cstdlib>
+ #include <cstring>
+
diff --git a/external/gpgmepp/rpath.patch b/external/gpgmepp/rpath.patch
new file mode 100644
index 000000000..6e6c46105
--- /dev/null
+++ b/external/gpgmepp/rpath.patch
@@ -0,0 +1,12 @@
+--- configure.ac
++++ configure.ac
+@@ -187,6 +187,9 @@
+ LT_INIT([win32-dll disable-static])
+ LT_LANG([Windows Resource])
+
++hardcode_libdir_flag_spec=
++hardcode_libdir_flag_spec_CXX=
++
+ # For now we hardcode the use of version scripts. It would be better
+ # to write a test for this or even implement this within libtool.
+ have_ld_version_script=no
diff --git a/external/gpgmepp/ubsan.patch b/external/gpgmepp/ubsan.patch
new file mode 100644
index 000000000..2262291cd
--- /dev/null
+++ b/external/gpgmepp/ubsan.patch
@@ -0,0 +1,52 @@
+--- src/engine-gpg.c
++++ src/engine-gpg.c
+@@ -61,6 +61,15 @@
+ building command line to this location. */
+ char arg[FLEXIBLE_ARRAY_MEMBER]; /* Used if data above is not used. */
+ };
++struct arg_without_data_s
++{
++ struct arg_and_data_s *next;
++ gpgme_data_t data;
++ int inbound;
++ int dup_to;
++ int print_fd;
++ int *arg_locp;
++};
+
+
+ struct fd_data_map_s
+@@ -310,23 +319,24 @@
+ a = malloc (offsetof (struct arg_and_data_s, arg));
+ if (!a)
+ return gpg_error_from_syserror ();
+- a->next = NULL;
+- a->data = data;
+- a->inbound = inbound;
+- a->arg_locp = NULL;
++ struct arg_without_data_s *a2 = (struct arg_without_data_s *)a;
++ a2->next = NULL;
++ a2->data = data;
++ a2->inbound = inbound;
++ a2->arg_locp = NULL;
+
+ if (dup_to == -2)
+ {
+- a->print_fd = 1;
+- a->dup_to = -1;
++ a2->print_fd = 1;
++ a2->dup_to = -1;
+ }
+ else
+ {
+- a->print_fd = 0;
+- a->dup_to = dup_to;
++ a2->print_fd = 0;
++ a2->dup_to = dup_to;
+ }
+ *gpg->argtail = a;
+- gpg->argtail = &a->next;
++ gpg->argtail = &a2->next;
+ return 0;
+ }
+
diff --git a/external/gpgmepp/w32-add-initializer.patch.1 b/external/gpgmepp/w32-add-initializer.patch.1
new file mode 100644
index 000000000..b33f0d42a
--- /dev/null
+++ b/external/gpgmepp/w32-add-initializer.patch.1
@@ -0,0 +1,16 @@
+Make sure the gpgrt_lock_init gets called in libgpg-error, otherwise
+several critical section statics are uninitialized
+
+diff -ur gpgmepp.org/src/version.c gpgmepp/src/version.c
+--- gpgmepp.org/src/version.c 2016-11-16 13:22:41.000000000 +0100
++++ gpgmepp/src/version.c 2017-11-23 17:16:35.218735200 +0100
+@@ -66,6 +66,9 @@
+ return;
+
+ #ifdef HAVE_W32_SYSTEM
++ // initialize libgpg-error stuff
++ gpg_err_init();
++
+ /* We need to make sure that the sockets are initialized. */
+ {
+ WSADATA wsadat;
diff --git a/external/gpgmepp/w32-build-fixes-2.patch b/external/gpgmepp/w32-build-fixes-2.patch
new file mode 100644
index 000000000..09c23c064
--- /dev/null
+++ b/external/gpgmepp/w32-build-fixes-2.patch
@@ -0,0 +1,22 @@
+Avoid MFC dependency - can go with very basic includes instead
+
+--- src/versioninfo.rc.in~ 2017-03-28 15:12:30.000000000 +0200
++++ src/versioninfo.rc.in 2017-11-29 04:22:18.607421900 +0100
+@@ -14,7 +14,6 @@
+
+ #line __LINE__ "versioninfo.rc.in"
+
+-#include <afxres.h>
+
+
+ VS_VERSION_INFO VERSIONINFO
+--- lang/cpp/src/importresult.cpp~ 2020-06-11 16:00:46.410830500 +0200
++++ lang/cpp/src/importresult.cpp 2020-06-11 16:00:25.987900000 +0200
+@@ -35,7 +35,6 @@
+ #include <cstring>
+
+ #include <string.h>
+-#include <strings.h>
+ #include <istream>
+ #include <iterator>
+
diff --git a/external/gpgmepp/w32-build-fixes.patch.1 b/external/gpgmepp/w32-build-fixes.patch.1
new file mode 100644
index 000000000..d6d8af601
--- /dev/null
+++ b/external/gpgmepp/w32-build-fixes.patch.1
@@ -0,0 +1,138 @@
+diff -ru gpgme.orig/m4/ax_cxx_compile_stdcxx.m4 gpgme/m4/ax_cxx_compile_stdcxx.m4
+--- gpgme.orig/m4/ax_cxx_compile_stdcxx.m4 2016-05-27 22:04:36.000000000 +0200
++++ gpgme/m4/ax_cxx_compile_stdcxx.m4 2017-09-29 17:34:49.795243600 +0200
+@@ -156,7 +156,7 @@
+
+ #error "This is not a C++ compiler"
+
+-#elif __cplusplus < 201103L
++#elif __cplusplus < 201103L && !(defined _MSC_VER)
+
+ #error "This is not a C++11 compiler"
+
+diff -ru gpgme.orig/src/dirinfo.c gpgme/src/dirinfo.c
+--- gpgme.orig/src/dirinfo.c 2017-03-21 11:09:41.000000000 +0100
++++ gpgme/src/dirinfo.c 2017-09-30 08:36:13.239279300 +0200
+@@ -34,6 +34,10 @@
+
+ DEFINE_STATIC_LOCK (dirinfo_lock);
+
++#ifndef F_OK
++#define F_OK 0
++#endif
++
+ /* Constants used internally to select the data. */
+ enum
+ {
+diff -ru gpgme.orig/src/mbox-util.c gpgme/src/mbox-util.c
+--- gpgme.orig/src/mbox-util.c 2016-11-16 13:22:41.000000000 +0100
++++ gpgme/src/mbox-util.c 2017-09-30 08:18:29.270567500 +0200
+@@ -29,7 +29,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#if HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
+ #include <errno.h>
+
+ #include "mbox-util.h"
+diff -ru gpgme.orig/src/priv-io.h gpgme/src/priv-io.h
+--- gpgme.orig/src/priv-io.h 2016-11-16 13:23:14.000000000 +0100
++++ gpgme/src/priv-io.h 2017-09-30 08:20:38.770562400 +0200
+@@ -33,6 +33,9 @@
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
++#if _MSC_VER
++typedef int pid_t;
++#endif
+
+
+ /* A single file descriptor passed to spawn. For child fds, dup_to
+diff -ru gpgme.orig/src/util.h gpgme/src/util.h
+--- gpgme.orig/src/util.h 2017-03-28 11:41:30.000000000 +0200
++++ gpgme/src/util.h 2017-09-30 08:10:54.194049100 +0200
+@@ -35,6 +35,9 @@
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
++#ifdef _MSC_VER
++typedef int pid_t;
++#endif
+
+ #include "gpgme.h"
+
+diff -ru gpgme.orig/src/w32-util.c gpgme/src/w32-util.c
+--- gpgme.orig/src/w32-util.c 2017-03-09 09:01:10.000000000 +0100
++++ gpgme/src/w32-util.c 2017-09-30 08:32:02.114330500 +0200
+@@ -772,7 +772,8 @@
+ v /= 62;
+ XXXXXX[5] = letters[v % 62];
+
+- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
++ //fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
++ fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL);
+ if (fd >= 0)
+ {
+ gpg_err_set_errno (save_errno);
+diff -ru gpgme.orig/src/Makefile.am gpgme/src/Makefile.am
+--- gpgme.orig/src/Makefile.am 2017-09-30 11:50:07.456960000 +0200
++++ gpgme/src/Makefile.am 2017-09-30 11:51:29.609649400 +0200
+@@ -35,7 +35,7 @@
+ m4data_DATA = gpgme.m4
+ nodist_include_HEADERS = gpgme.h
+
+-bin_PROGRAMS = gpgme-tool gpgme-json
++bin_PROGRAMS =
+
+ if BUILD_W32_GLIB
+ ltlib_gpgme_glib = libgpgme-glib.la
+@@ -107,11 +107,11 @@
+ # versions, because then every object file is only compiled once.
+ AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GPG_ERROR_CFLAGS@ @GLIB_CFLAGS@
+
+-gpgme_tool_SOURCES = gpgme-tool.c argparse.c argparse.h
+-gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@
++gpgme_tool_SOURCES =
++gpgme_tool_LDADD =
+
+-gpgme_json_SOURCES = gpgme-json.c cJSON.c cJSON.h
+-gpgme_json_LDADD = -lm libgpgme.la $(GPG_ERROR_LIBS)
++gpgme_json_SOURCES =
++gpgme_json_LDADD =
+
+
+ if HAVE_W32_SYSTEM
+@@ -126,7 +126,7 @@
+ SUFFIXES = .rc .lo
+
+ .rc.lo:
+- $(LTRCCOMPILE) -i "$<" -o "$@"
++ $(LTRCCOMPILE) -i $< -o $@
+
+ gpgme_res = versioninfo.lo
+ no_undefined = -no-undefined
+diff -ru gpgme.orig/src/vfs-mount.c gpgme/src/vfs-mount.c
+--- gpgme.orig/src/vfs-mount.c 2017-03-09 09:01:10.000000000 +0100
++++ gpgme/src/vfs-mount.c 2017-09-30 13:10:51.845807600 +0200
+@@ -68,7 +68,7 @@
+ if (err)
+ return err;
+
+- if (! strcasecmp ("MOUNTPOINT", code))
++ if (! _stricmp ("MOUNTPOINT", code))
+ {
+ if (opd->result.mount_dir)
+ free (opd->result.mount_dir);
+diff -ur gpgmepp.org/src/w32-glib-io.c gpgmepp/src/w32-glib-io.c
+--- gpgmepp.org/src/w32-glib-io.c 2016-11-16 13:22:41.000000000 +0100
++++ gpgmepp/src/w32-glib-io.c 2017-11-20 06:40:44.793945300 +0100
+@@ -37,6 +37,7 @@
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
++#include <winsock2.h>
+ #include <glib.h>
+ #include <windows.h>
+ #include <io.h>
diff --git a/external/gpgmepp/w32-disable-docs.patch.1 b/external/gpgmepp/w32-disable-docs.patch.1
new file mode 100644
index 000000000..1803ffa03
--- /dev/null
+++ b/external/gpgmepp/w32-disable-docs.patch.1
@@ -0,0 +1,15 @@
+Disable doc building the hard way - should rather be a config option
+like libgpg-error's --disable-doc
+
+diff -ur gpgmepp.org/Makefile.am gpgmepp/Makefile.am
+--- gpgmepp.org/Makefile.am 2016-11-16 13:20:18.000000000 +0100
++++ gpgmepp/Makefile.am 2017-11-20 15:34:49.086731000 +0100
+@@ -45,7 +45,7 @@
+ tests =
+ endif
+
+-SUBDIRS = src ${tests} doc lang
++SUBDIRS = src ${tests} lang
+
+ # Fix the version of the spec file.
+ dist-hook: gen-ChangeLog
diff --git a/external/gpgmepp/w32-fix-libtool.patch.1 b/external/gpgmepp/w32-fix-libtool.patch.1
new file mode 100644
index 000000000..40893908b
--- /dev/null
+++ b/external/gpgmepp/w32-fix-libtool.patch.1
@@ -0,0 +1,38 @@
+Gross hack to make libtool work with gcc-wrapper - frontended
+link.exe on Windows. Make libtool ignore all libs & simply pass
+them on as-is to the linker
+
+A proper fix would be to make gcc-wrapper behave like gcc during
+linking, by accepting cygwin path names, and correctly expanding
+-l<short_lib_name> to lib<short_lib_name>.lib
+
+diff -ur gpgmepp.org/m4/libtool.m4 gpgmepp/m4/libtool.m4
+--- gpgmepp.org/m4/libtool.m4 2016-11-16 13:20:16.000000000 +0100
++++ gpgmepp/m4/libtool.m4 2017-11-21 22:00:05.006587800 +0100
+@@ -3230,24 +3230,11 @@
+ ;;
+
+ cygwin*)
+- # func_win32_libid is a shell function defined in ltmain.sh
+- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+- lt_cv_file_magic_cmd='func_win32_libid'
++ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+ mingw* | pw32*)
+- # Base MSYS/MinGW do not provide the 'file' command needed by
+- # func_win32_libid shell function, so use a weaker test based on 'objdump',
+- # unless we find 'file', for example because we are cross-compiling.
+- # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+- if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+- lt_cv_file_magic_cmd='func_win32_libid'
+- else
+- # Keep this pattern in sync with the one in func_win32_libid.
+- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+- lt_cv_file_magic_cmd='$OBJDUMP -f'
+- fi
++ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+ cegcc*)
diff --git a/external/gpgmepp/w32-fix-win32-macro.patch.1 b/external/gpgmepp/w32-fix-win32-macro.patch.1
new file mode 100644
index 000000000..8ab7b0fab
--- /dev/null
+++ b/external/gpgmepp/w32-fix-win32-macro.patch.1
@@ -0,0 +1,176 @@
+diff -ur gpgmepp.org/lang/cpp/src/callbacks.cpp gpgmepp/lang/cpp/src/callbacks.cpp
+--- gpgmepp.org/lang/cpp/src/callbacks.cpp 2016-10-18 19:22:02.000000000 +0200
++++ gpgmepp/lang/cpp/src/callbacks.cpp 2017-11-20 18:03:04.290060900 +0100
+@@ -40,7 +40,9 @@
+ #include <cassert>
+ #include <cerrno>
+ #include <cstring>
++#if HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
+ #include <stdlib.h>
+
+ static inline gpgme_error_t make_err_from_syserror()
+diff -ur gpgmepp.org/lang/cpp/src/data.h gpgmepp/lang/cpp/src/data.h
+--- gpgmepp.org/lang/cpp/src/data.h 2017-03-24 15:20:32.000000000 +0100
++++ gpgmepp/lang/cpp/src/data.h 2017-11-20 17:23:24.802711200 +0100
+@@ -31,6 +31,11 @@
+ #include <algorithm>
+ #include <memory>
+
++#ifdef _MSC_VER
++# include <BaseTsd.h>
++typedef SSIZE_T ssize_t;
++#endif
++
+ namespace GpgME
+ {
+
+diff -ur gpgmepp.org/lang/cpp/src/editinteractor.cpp gpgmepp/lang/cpp/src/editinteractor.cpp
+--- gpgmepp.org/lang/cpp/src/editinteractor.cpp 2017-03-09 09:01:10.000000000 +0100
++++ gpgmepp/lang/cpp/src/editinteractor.cpp 2017-11-20 18:09:33.022674700 +0100
+@@ -33,9 +33,11 @@
+
+ #include <gpgme.h>
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+ # include <io.h>
+-#include <windows.h>
++# include <windows.h>
++# include <BaseTsd.h>
++ typedef SSIZE_T ssize_t;
+ #else
+ # include <unistd.h>
+ #endif
+diff -ur gpgmepp.org/lang/cpp/src/gpgmepp_export.h gpgmepp/lang/cpp/src/gpgmepp_export.h
+--- gpgmepp.org/lang/cpp/src/gpgmepp_export.h 2016-08-04 15:03:09.000000000 +0200
++++ gpgmepp/lang/cpp/src/gpgmepp_export.h 2017-11-20 16:57:47.805691100 +0100
+@@ -30,14 +30,14 @@
+ # ifndef GPGMEPP_EXPORT
+ # ifdef BUILDING_GPGMEPP
+ /* We are building this library */
+-# ifdef WIN32
++# ifdef _MSC_VER
+ # define GPGMEPP_EXPORT __declspec(dllexport)
+ # else
+ # define GPGMEPP_EXPORT __attribute__((visibility("default")))
+ # endif
+ # else
+ /* We are using this library */
+-# ifdef WIN32
++# ifdef _MSC_VER
+ # define GPGMEPP_EXPORT __declspec(dllimport)
+ # else
+ # define GPGMEPP_EXPORT __attribute__((visibility("default")))
+@@ -46,7 +46,7 @@
+ # endif
+
+ # ifndef GPGMEPP_NO_EXPORT
+-# ifdef WIN32
++# ifdef _MSC_VER
+ # define GPGMEPP_NO_EXPORT
+ # else
+ # define GPGMEPP_NO_EXPORT __attribute__((visibility("hidden")))
+@@ -55,7 +55,11 @@
+ #endif
+
+ #ifndef GPGMEPP_DEPRECATED
+-# define GPGMEPP_DEPRECATED __attribute__ ((__deprecated__))
++# ifdef _MSC_VER
++# define GPGMEPP_DEPRECATED __declspec(deprecated("deprecated"))
++# else
++# define GPGMEPP_DEPRECATED __attribute__ ((__deprecated__))
++# endif
+ #endif
+
+ #ifndef GPGMEPP_DEPRECATED_EXPORT
+diff -ur gpgmepp.org/lang/cpp/src/interfaces/dataprovider.h gpgmepp/lang/cpp/src/interfaces/dataprovider.h
+--- gpgmepp.org/lang/cpp/src/interfaces/dataprovider.h 2016-05-17 14:32:37.000000000 +0200
++++ gpgmepp/lang/cpp/src/interfaces/dataprovider.h 2017-11-20 18:03:11.332715700 +0100
+@@ -31,6 +31,11 @@
+
+ #include <gpg-error.h>
+
++#ifdef _MSC_VER
++# include <BaseTsd.h>
++typedef SSIZE_T ssize_t;
++#endif
++
+ namespace GpgME
+ {
+
+diff -ur gpgmepp.org/lang/cpp/src/key.cpp gpgmepp/lang/cpp/src/key.cpp
+--- gpgmepp.org/lang/cpp/src/key.cpp 2017-03-20 20:10:15.000000000 +0100
++++ gpgmepp/lang/cpp/src/key.cpp 2017-11-20 17:44:50.321858800 +0100
+@@ -34,11 +34,17 @@
+ #include <gpgme.h>
+
+ #include <string.h>
++#if HAVE_STRINGS_H
+ #include <strings.h>
++#endif
+ #include <cassert>
+ #include <istream>
+ #include <iterator>
+
++#ifdef _MSC_VER
++# define strcasecmp _stricmp
++#endif
++
+ const GpgME::Key::Null GpgME::Key::null;
+
+ namespace GpgME
+diff -ur gpgmepp.org/lang/cpp/src/key.h gpgmepp/lang/cpp/src/key.h
+--- gpgmepp.org/lang/cpp/src/key.h 2017-03-20 20:10:15.000000000 +0100
++++ gpgmepp/lang/cpp/src/key.h 2017-11-20 17:07:51.551632000 +0100
+@@ -30,7 +30,6 @@
+ #include "gpgmefw.h"
+
+ #include <memory>
+-#include <sys/time.h>
+
+ #include <vector>
+ #include <algorithm>
+diff -ur gpgmepp.org/lang/qt/src/qgpgme_export.h gpgmepp/lang/qt/src/qgpgme_export.h
+--- gpgmepp.org/lang/qt/src/qgpgme_export.h 2016-11-03 17:32:30.000000000 +0100
++++ gpgmepp/lang/qt/src/qgpgme_export.h 2017-11-20 16:58:27.395388000 +0100
+@@ -40,14 +40,14 @@
+ # ifndef QGPGME_EXPORT
+ # ifdef BUILDING_QGPGME
+ /* We are building this library */
+-# ifdef WIN32
++# ifdef _WIN32
+ # define QGPGME_EXPORT __declspec(dllexport)
+ # else
+ # define QGPGME_EXPORT __attribute__((visibility("default")))
+ # endif
+ # else
+ /* We are using this library */
+-# ifdef WIN32
++# ifdef _WIN32
+ # define QGPGME_EXPORT __declspec(dllimport)
+ # else
+ # define QGPGME_EXPORT __attribute__((visibility("default")))
+@@ -56,7 +56,7 @@
+ # endif
+
+ # ifndef QGPGME_NO_EXPORT
+-# ifdef WIN32
++# ifdef _WIN32
+ # define QGPGME_NO_EXPORT
+ # else
+ # define QGPGME_NO_EXPORT __attribute__((visibility("hidden")))
+@@ -65,7 +65,11 @@
+ #endif
+
+ #ifndef QGPGME_DEPRECATED
+-# define QGPGME_DEPRECATED __attribute__ ((__deprecated__))
++# ifdef _MSC_VER
++# define QGPGME_DEPRECATED __declspec(deprecated("deprecated"))
++# else
++# define QGPGME_DEPRECATED __attribute__ ((__deprecated__))
++# endif
+ #endif
+
+ #ifndef QGPGME_DEPRECATED_EXPORT
diff --git a/external/gpgmepp/w32-include.patch b/external/gpgmepp/w32-include.patch
new file mode 100644
index 000000000..0fda72c2b
--- /dev/null
+++ b/external/gpgmepp/w32-include.patch
@@ -0,0 +1,42 @@
+--- src/data-fd.c
++++ src/data-fd.c
+@@ -28,6 +28,9 @@
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
++#if defined HAVE_W32_SYSTEM
++#include <io.h>
++#endif
+
+ #include "debug.h"
+ #include "data.h"
+--- src/gpgme-w32spawn.c
++++ src/gpgme-w32spawn.c
+@@ -36,6 +36,7 @@
+ # include <sys/stat.h>
+ #endif
+ #include <stdint.h>
++#include <io.h>
+ #include <process.h>
+
+ #include "priv-io.h"
+--- lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h
++++ lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h
+@@ -27,6 +27,7 @@
+ #include "editinteractor.h"
+
+ #include <memory>
++#include <string>
+
+ namespace GpgME
+ {
+--- lang/cpp/src/gpgrevokekeyeditinteractor.h
++++ lang/cpp/src/gpgrevokekeyeditinteractor.h
+@@ -28,6 +28,7 @@
+ #include "global.h"
+
+ #include <memory>
++#include <string>
+ #include <vector>
+
+ namespace GpgME