summaryrefslogtreecommitdiffstats
path: root/external/gpgmepp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/gpgmepp
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/gpgmepp/ExternalPackage_gpgmepp.mk40
-rw-r--r--external/gpgmepp/ExternalProject_gpgmepp.mk85
-rw-r--r--external/gpgmepp/Library_gpgmepp.mk87
-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.mk37
-rw-r--r--external/gpgmepp/add-gpgme_set_global_flag-wrapper.patch27
-rw-r--r--external/gpgmepp/add-minimal-keyexport.patch68
-rw-r--r--external/gpgmepp/asan.patch12
-rw-r--r--external/gpgmepp/find-libgpg-error-libassuan.patch59
-rw-r--r--external/gpgmepp/fix-autoconf-macros.patch39
-rw-r--r--external/gpgmepp/gcc9.patch10
-rw-r--r--external/gpgmepp/rpath.patch12
-rw-r--r--external/gpgmepp/ubsan.patch52
-rw-r--r--external/gpgmepp/version.patch4
-rw-r--r--external/gpgmepp/w32-add-initializer.patch.116
-rw-r--r--external/gpgmepp/w32-build-fixes-2.patch12
-rw-r--r--external/gpgmepp/w32-build-fixes.patch.1133
-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.1175
22 files changed, 968 insertions, 0 deletions
diff --git a/external/gpgmepp/ExternalPackage_gpgmepp.mk b/external/gpgmepp/ExternalPackage_gpgmepp.mk
new file mode 100644
index 000000000..67c3dc64f
--- /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.4.0))
+$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgme.so.11,src/.libs/libgpgme.so.11.18.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..989844465
--- /dev/null
+++ b/external/gpgmepp/ExternalProject_gpgmepp.mk
@@ -0,0 +1,85 @@
+# -*- 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)
+gb_ExternalProject_gpgmepp_host := $(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32)
+gb_ExternalProject_gpgmepp_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
+$(call gb_ExternalProject_get_state_target,gpgmepp,build): $(call gb_Executable_get_target,cpp)
+ $(call gb_Trace_StartRange,gpgmepp,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ autoreconf \
+ && ./configure \
+ --disable-shared \
+ --disable-languages \
+ --disable-gpgconf-test \
+ --disable-gpg-test \
+ --disable-gpgsm-test \
+ --disable-g13-test \
+ --disable-glibtest \
+ CFLAGS='$(CFLAGS) \
+ $(if $(ENABLE_OPTIMIZED), \
+ $(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
+ $(if $(call gb_Module__symbols_enabled,gpgmepp),$(gb_DEBUGINFO_FLAGS))' \
+ --host=$(gb_ExternalProject_gpgmepp_host) \
+ RC='windres -O COFF --target=$(gb_ExternalProject_gpgmepp_target) --preprocessor='\''$(call gb_Executable_get_target,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\' \
+ 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 \
+ && ./configure \
+ --disable-gpg-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) \
+ $(if $(ENABLE_OPTIMIZED), \
+ $(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
+ $(if $(call gb_Module__symbols_enabled,gpgmepp),$(gb_DEBUGINFO_FLAGS))' \
+ CXXFLAGS='$(CXXFLAGS) \
+ $(if $(ENABLE_OPTIMIZED), \
+ $(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
+ $(if $(ENABLE_DBGUTIL),-D_GLIBCXX_DEBUG) \
+ $(if $(call gb_Module__symbols_enabled,gpgmepp),$(gb_DEBUGINFO_FLAGS))' \
+ $(if $(filter LINUX,$(OS)), \
+ 'LDFLAGS=-Wl$(COMMA)-z$(COMMA)origin \
+ -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN') \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(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..a7d0ba349
--- /dev/null
+++ b/external/gpgmepp/Library_gpgmepp.mk
@@ -0,0 +1,87 @@
+# -*- 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,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/gpgadduserideditinteractor \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpgagentgetinfoassuantransaction \
+ UnpackedTarball/gpgmepp/lang/cpp/src/gpggencardkeyinteractor \
+ 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/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..1b0468fc6
--- /dev/null
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -0,0 +1,37 @@
+# -*- 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/add-gpgme_set_global_flag-wrapper.patch upstreamed at
+# <https://dev.gnupg.org/T4471> "No gpgmepp API to call gpgme_set_global_flag"
+# * external/gpgmepp/version.patch upstream at <https://dev.gnupg.org/T4168> "gpgme: `make dist`
+# introduced VERSION can clash with new C++ <version>":
+$(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
+ external/gpgmepp/find-libgpg-error-libassuan.patch \
+ external/gpgmepp/fix-autoconf-macros.patch \
+ external/gpgmepp/add-minimal-keyexport.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 \
+ external/gpgmepp/add-gpgme_set_global_flag-wrapper.patch \
+ $(if $(filter LINUX,$(OS)),external/gpgmepp/asan.patch) \
+ $(if $(filter LINUX,$(OS)),external/gpgmepp/rpath.patch) \
+ external/gpgmepp/gcc9.patch \
+ external/gpgmepp/version.patch \
+ external/gpgmepp/ubsan.patch \
+))
+# vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/add-gpgme_set_global_flag-wrapper.patch b/external/gpgmepp/add-gpgme_set_global_flag-wrapper.patch
new file mode 100644
index 000000000..fade88a3e
--- /dev/null
+++ b/external/gpgmepp/add-gpgme_set_global_flag-wrapper.patch
@@ -0,0 +1,27 @@
+diff -ur lang/cpp/src/context.cpp.old lang/cpp/src/context.cpp
+--- lang/cpp/src/context.cpp.old 2019-04-20 16:03:09.575605300 +0300
++++ lang/cpp/src/context.cpp 2019-04-20 16:06:43.078419700 +0300
+@@ -1656,6 +1656,11 @@
+ return Error(gpgme_engine_check_version(p));
+ }
+
++int GpgME::setGlobalFlag(const char *name, const char *value)
++{
++ return gpgme_set_global_flag(name, value);
++}
++
+ static const unsigned long supported_features = 0
+ | GpgME::ValidatingKeylistModeFeature
+ | GpgME::CancelOperationFeature
+diff -ur lang/cpp/src/global.h lang/cpp/src/global.h
+--- lang/cpp/src/global.h.old 2016-09-07 09:48:44.000000000 +0300
++++ lang/cpp/src/global.h 2019-04-20 16:06:41.918912600 +0300
+@@ -95,6 +95,8 @@
+ GPGMEPP_EXPORT Error checkEngine(Protocol proto);
+ GPGMEPP_EXPORT Error checkEngine(Engine engine);
+
++GPGMEPP_EXPORT int setGlobalFlag(const char *name, const char *value);
++
+ GPGMEPP_EXPORT GIOChannel *getGIOChannel(int fd);
+ GPGMEPP_EXPORT QIODevice *getQIODevice(int fd);
+
diff --git a/external/gpgmepp/add-minimal-keyexport.patch b/external/gpgmepp/add-minimal-keyexport.patch
new file mode 100644
index 000000000..abaeb1589
--- /dev/null
+++ b/external/gpgmepp/add-minimal-keyexport.patch
@@ -0,0 +1,68 @@
+--- lang/cpp/src/context.h.bak 2017-10-18 12:28:00.898945587 +0200
++++ lang/cpp/src/context.h 2017-10-18 12:28:35.794832395 +0200
+@@ -178,10 +178,10 @@
+ // Key Export
+ //
+
+- GpgME::Error exportPublicKeys(const char *pattern, Data &keyData);
+- GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData);
+- GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData);
+- GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData);
++ GpgME::Error exportPublicKeys(const char *pattern, Data &keyData, bool minimal=false);
++ GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData, bool minimal=false);
++ GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData, bool minimal=false);
++ GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData, bool minimal=false);
+
+ //
+ // Key Import
+--- lang/cpp/src/context.cpp.bak 2017-10-18 12:27:50.830978224 +0200
++++ lang/cpp/src/context.cpp 2017-10-18 12:30:13.278515603 +0200
+@@ -557,14 +557,14 @@
+ }
+ }
+
+-Error Context::exportPublicKeys(const char *pattern, Data &keyData)
++Error Context::exportPublicKeys(const char *pattern, Data &keyData, bool minimal)
+ {
+ d->lastop = Private::Export;
+ Data::Private *const dp = keyData.impl();
+- return Error(d->lasterr = gpgme_op_export(d->ctx, pattern, 0, dp ? dp->data : 0));
++ return Error(d->lasterr = gpgme_op_export(d->ctx, pattern, minimal ? GPGME_EXPORT_MODE_MINIMAL : 0, dp ? dp->data : 0));
+ }
+
+-Error Context::exportPublicKeys(const char *patterns[], Data &keyData)
++Error Context::exportPublicKeys(const char *patterns[], Data &keyData, bool minimal)
+ {
+ d->lastop = Private::Export;
+ #ifndef HAVE_GPGME_EXT_KEYLIST_MODE_EXTERNAL_NONBROKEN
+@@ -574,17 +574,17 @@
+ }
+ #endif
+ Data::Private *const dp = keyData.impl();
+- return Error(d->lasterr = gpgme_op_export_ext(d->ctx, patterns, 0, dp ? dp->data : 0));
++ return Error(d->lasterr = gpgme_op_export_ext(d->ctx, patterns, minimal ? GPGME_EXPORT_MODE_MINIMAL : 0, dp ? dp->data : 0));
+ }
+
+-Error Context::startPublicKeyExport(const char *pattern, Data &keyData)
++Error Context::startPublicKeyExport(const char *pattern, Data &keyData, bool minimal)
+ {
+ d->lastop = Private::Export;
+ Data::Private *const dp = keyData.impl();
+- return Error(d->lasterr = gpgme_op_export_start(d->ctx, pattern, 0, dp ? dp->data : 0));
++ return Error(d->lasterr = gpgme_op_export_start(d->ctx, pattern, minimal ? GPGME_EXPORT_MODE_MINIMAL : 0, dp ? dp->data : 0));
+ }
+
+-Error Context::startPublicKeyExport(const char *patterns[], Data &keyData)
++Error Context::startPublicKeyExport(const char *patterns[], Data &keyData, bool minimal)
+ {
+ d->lastop = Private::Export;
+ #ifndef HAVE_GPGME_EXT_KEYLIST_MODE_EXTERNAL_NONBROKEN
+@@ -594,7 +594,7 @@
+ }
+ #endif
+ Data::Private *const dp = keyData.impl();
+- return Error(d->lasterr = gpgme_op_export_ext_start(d->ctx, patterns, 0, dp ? dp->data : 0));
++ return Error(d->lasterr = gpgme_op_export_ext_start(d->ctx, patterns, minimal ? GPGME_EXPORT_MODE_MINIMAL : 0, dp ? dp->data : 0));
+ }
+
+ ImportResult Context::importKeys(const Data &data)
diff --git a/external/gpgmepp/asan.patch b/external/gpgmepp/asan.patch
new file mode 100644
index 000000000..16d97f6ff
--- /dev/null
+++ b/external/gpgmepp/asan.patch
@@ -0,0 +1,12 @@
+--- src/posix-io.c
++++ src/posix-io.c
+@@ -468,6 +468,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/find-libgpg-error-libassuan.patch b/external/gpgmepp/find-libgpg-error-libassuan.patch
new file mode 100644
index 000000000..2ddd4d2f2
--- /dev/null
+++ b/external/gpgmepp/find-libgpg-error-libassuan.patch
@@ -0,0 +1,59 @@
+diff --git a/configure.ac b/configure.ac
+index f28480b..92a3e85 100644
+--- configure.ac
++++ configure.ac
+@@ -674,15 +674,34 @@ AC_CHECK_FUNCS(setlocale)
+
+ # 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.])
+
+ # 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])
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ce6f1d4..6b1d835 100644
+--- src/Makefile.am
++++ src/Makefile.am
+@@ -97,10 +97,10 @@ endif
+
+ # We use a global CFLAGS setting for all library
+ # versions, because then every object file is only compiled once.
+-AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GLIB_CFLAGS@
++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@
++gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@
+
+
+ if HAVE_W32_SYSTEM
diff --git a/external/gpgmepp/fix-autoconf-macros.patch b/external/gpgmepp/fix-autoconf-macros.patch
new file mode 100644
index 000000000..627c7b152
--- /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
+@@ -35,6 +35,11 @@
+ # decimalized short revision number, a beta version string, and a flag
+ # indicating a development version (mym4_isgit). 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_version,
+ [mym4_version_major.mym4_version_minor.mym4_version_micro])
+ m4_define([mym4_revision],
+@@ -90,7 +90,22 @@
+ AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_SRCDIR(src/gpgme.h.in)
+ AC_CONFIG_HEADER(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..c2a9fd444
--- /dev/null
+++ b/external/gpgmepp/gcc9.patch
@@ -0,0 +1,10 @@
+--- lang/cpp/src/key.h
++++ lang/cpp/src/key.h
+@@ -62,6 +62,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/rpath.patch b/external/gpgmepp/rpath.patch
new file mode 100644
index 000000000..e83dcf276
--- /dev/null
+++ b/external/gpgmepp/rpath.patch
@@ -0,0 +1,12 @@
+--- configure.ac
++++ configure.ac
+@@ -176,6 +176,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..5a6e6dcdc
--- /dev/null
+++ b/external/gpgmepp/ubsan.patch
@@ -0,0 +1,52 @@
+--- src/engine-gpg.c
++++ src/engine-gpg.c
+@@ -60,6 +60,15 @@
+ building command line to this location. */
+ char arg[1]; /* 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
+@@ -299,23 +308,24 @@
+ a = malloc (sizeof *a - 1);
+ 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/version.patch b/external/gpgmepp/version.patch
new file mode 100644
index 000000000..21d3b680c
--- /dev/null
+++ b/external/gpgmepp/version.patch
@@ -0,0 +1,4 @@
+--- VERSION
++++ /dev/null
+@@ -1,1 +0,0 @@
+-1.9.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..062c14409
--- /dev/null
+++ b/external/gpgmepp/w32-build-fixes-2.patch
@@ -0,0 +1,12 @@
+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
diff --git a/external/gpgmepp/w32-build-fixes.patch.1 b/external/gpgmepp/w32-build-fixes.patch.1
new file mode 100644
index 000000000..9bc8f52b4
--- /dev/null
+++ b/external/gpgmepp/w32-build-fixes.patch.1
@@ -0,0 +1,133 @@
+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
+@@ -33,6 +33,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
+@@ -28,7 +28,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
+@@ -36,6 +36,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
+@@ -39,6 +39,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
+@@ -721,7 +721,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
+@@ -26,7 +26,7 @@
+ m4data_DATA = gpgme.m4
+ nodist_include_HEADERS = gpgme.h
+
+-bin_PROGRAMS = gpgme-tool
++bin_PROGRAMS =
+
+ if BUILD_W32_GLIB
+ ltlib_gpgme_glib = libgpgme-glib.la
+@@ -99,8 +99,8 @@
+ # 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 =
+
+
+ if HAVE_W32_SYSTEM
+@@ -120,7 +120,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..603122131
--- /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
+@@ -33,7 +33,7 @@
+ tests =
+ endif
+
+-SUBDIRS = src ${tests} doc lang
++SUBDIRS = src ${tests} lang
+
+ # Fix the version of the spec file and create a file named VERSION
+ # to be used for patch's Prereq: feature.
diff --git a/external/gpgmepp/w32-fix-libtool.patch.1 b/external/gpgmepp/w32-fix-libtool.patch.1
new file mode 100644
index 000000000..9a7adf713
--- /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
+@@ -3209,24 +3209,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..70a8b5ffe
--- /dev/null
+++ b/external/gpgmepp/w32-fix-win32-macro.patch.1
@@ -0,0 +1,175 @@
+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
+@@ -38,7 +38,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
+@@ -30,9 +30,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
+@@ -29,14 +29,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")))
+@@ -45,7 +45,7 @@
+ # endif
+
+ # ifndef GPGMEPP_NO_EXPORT
+-# ifdef WIN32
++# ifdef _MSC_VER
+ # define GPGMEPP_NO_EXPORT
+ # else
+ # define GPGMEPP_NO_EXPORT __attribute__((visibility("hidden")))
+@@ -54,7 +54,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
+@@ -29,6 +29,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
+@@ -33,10 +33,16 @@
+ #include <gpgme.h>
+
+ #include <string.h>
++#if HAVE_STRINGS_H
+ #include <strings.h>
++#endif
+ #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
+@@ -39,14 +39,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")))
+@@ -55,7 +55,7 @@
+ # endif
+
+ # ifndef QGPGME_NO_EXPORT
+-# ifdef WIN32
++# ifdef _WIN32
+ # define QGPGME_NO_EXPORT
+ # else
+ # define QGPGME_NO_EXPORT __attribute__((visibility("hidden")))
+@@ -64,7 +64,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