summaryrefslogtreecommitdiffstats
path: root/external/libgpg-error
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/libgpg-error
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/libgpg-error')
-rw-r--r--external/libgpg-error/ExternalPackage_libgpg-error.mk28
-rw-r--r--external/libgpg-error/ExternalProject_libgpg-error.mk53
-rw-r--r--external/libgpg-error/Makefile14
-rw-r--r--external/libgpg-error/Module_libgpg-error.mk18
-rw-r--r--external/libgpg-error/README2
-rw-r--r--external/libgpg-error/UnpackedTarball_libgpg-error.mk27
-rw-r--r--external/libgpg-error/clang-cl.patch11
-rw-r--r--external/libgpg-error/libgpgerror-bundled-soname.patch.122
-rw-r--r--external/libgpg-error/w32-build-fixes-2.patch.131
-rw-r--r--external/libgpg-error/w32-build-fixes-3.patch.157
-rw-r--r--external/libgpg-error/w32-build-fixes-4.patch13
-rw-r--r--external/libgpg-error/w32-build-fixes-5.patch145
-rw-r--r--external/libgpg-error/w32-build-fixes.patch121
-rw-r--r--external/libgpg-error/w32-disable-dllinit.patch.155
14 files changed, 597 insertions, 0 deletions
diff --git a/external/libgpg-error/ExternalPackage_libgpg-error.mk b/external/libgpg-error/ExternalPackage_libgpg-error.mk
new file mode 100644
index 000000000..7ee849d23
--- /dev/null
+++ b/external/libgpg-error/ExternalPackage_libgpg-error.mk
@@ -0,0 +1,28 @@
+# -*- 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,libgpg-error,libgpg-error))
+
+$(eval $(call gb_ExternalPackage_use_external_project,libgpg-error,libgpg-error))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+
+ifeq ($(OS),LINUX)
+
+$(eval $(call gb_ExternalPackage_add_file,libgpg-error,$(LIBO_LIB_FOLDER)/libgpg-error-lo.so.0,src/.libs/libgpg-error-lo.so.0.32.1))
+
+else ifeq ($(OS),MACOSX)
+
+$(eval $(call gb_ExternalPackage_add_file,libgpg-error,$(LIBO_LIB_FOLDER)/libgpg-error.0.dylib,src/.libs/libgpg-error.0.dylib))
+
+endif
+
+endif # $(DISABLE_DYNLOADING)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgpg-error/ExternalProject_libgpg-error.mk b/external/libgpg-error/ExternalProject_libgpg-error.mk
new file mode 100644
index 000000000..055cd3cbe
--- /dev/null
+++ b/external/libgpg-error/ExternalProject_libgpg-error.mk
@@ -0,0 +1,53 @@
+# -*- 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,libgpg-error))
+
+$(eval $(call gb_ExternalProject_register_targets,libgpg-error,\
+ build \
+))
+
+$(eval $(call gb_ExternalProject_use_autoconf,libgpg-error,build))
+
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,libgpg-error,build): $(call gb_Executable_get_target_for_build,cpp)
+ $(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(gb_WIN_GPG_cross_setup_exports) \
+ && MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
+ --enable-static \
+ --disable-shared \
+ --disable-rpath \
+ --disable-languages \
+ --disable-doc \
+ --disable-tests \
+ $(gb_WIN_GPG_platform_switches) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,libgpg-error,EXTERNAL)
+else
+$(call gb_ExternalProject_get_state_target,libgpg-error,build):
+ $(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
+ --disable-rpath \
+ --disable-languages \
+ --disable-doc \
+ CFLAGS=" $(CFLAGS) $(call gb_ExternalProject_get_build_flags,libgpg-error)" \
+ CPPFLAGS=" $(SOLARINC)" \
+ $(if $(filter MSC,$(COM)),--force_use_syscfg=true) \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,libgpg-error,EXTERNAL)
+
+endif
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgpg-error/Makefile b/external/libgpg-error/Makefile
new file mode 100644
index 000000000..569ad8a0b
--- /dev/null
+++ b/external/libgpg-error/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/libgpg-error/Module_libgpg-error.mk b/external/libgpg-error/Module_libgpg-error.mk
new file mode 100644
index 000000000..0079dcba9
--- /dev/null
+++ b/external/libgpg-error/Module_libgpg-error.mk
@@ -0,0 +1,18 @@
+# -*- 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,libgpg-error))
+
+$(eval $(call gb_Module_add_targets,libgpg-error,\
+ ExternalProject_libgpg-error \
+ ExternalPackage_libgpg-error \
+ UnpackedTarball_libgpg-error \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgpg-error/README b/external/libgpg-error/README
new file mode 100644
index 000000000..84288267a
--- /dev/null
+++ b/external/libgpg-error/README
@@ -0,0 +1,2 @@
+A small library that defines common error values for GnuPG components
+[https://www.gnupg.org/related_software/libgpg-error/index.html]
diff --git a/external/libgpg-error/UnpackedTarball_libgpg-error.mk b/external/libgpg-error/UnpackedTarball_libgpg-error.mk
new file mode 100644
index 000000000..72ff13069
--- /dev/null
+++ b/external/libgpg-error/UnpackedTarball_libgpg-error.mk
@@ -0,0 +1,27 @@
+# -*- 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,libgpg-error))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libgpg-error,$(LIBGPGERROR_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libgpg-error,0))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libgpg-error, \
+ $(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes.patch) \
+ $(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes-2.patch.1) \
+ $(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes-3.patch.1) \
+ $(if $(filter MSC,$(COM)),external/libgpg-error/w32-disable-dllinit.patch.1) \
+ external/libgpg-error/w32-build-fixes-4.patch \
+ $(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes-5.patch) \
+ $(if $(filter LINUX,$(OS)),external/libgpg-error/libgpgerror-bundled-soname.patch.1) \
+ external/libgpg-error/clang-cl.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgpg-error/clang-cl.patch b/external/libgpg-error/clang-cl.patch
new file mode 100644
index 000000000..3a635c5d8
--- /dev/null
+++ b/external/libgpg-error/clang-cl.patch
@@ -0,0 +1,11 @@
+--- src/gpg-error.h.in
++++ src/gpg-error.h.in
+@@ -152,7 +152,7 @@
+ /*
+ * GCC feature test.
+ */
+-#if __GNUC__
++#ifdef __GNUC__
+ # define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
diff --git a/external/libgpg-error/libgpgerror-bundled-soname.patch.1 b/external/libgpg-error/libgpgerror-bundled-soname.patch.1
new file mode 100644
index 000000000..6b5c47b4c
--- /dev/null
+++ b/external/libgpg-error/libgpgerror-bundled-soname.patch.1
@@ -0,0 +1,22 @@
+--- libgpg-error/src/Makefile.in.orig 2019-01-28 14:11:10.518425440 +0100
++++ libgpg-error/src/Makefile.in 2019-01-28 14:11:16.901414229 +0100
+@@ -540,7 +540,7 @@
+ @HAVE_LD_VERSION_SCRIPT_TRUE@libgpg_error_vers_opt = -Wl,--version-script=$(srcdir)/gpg-error.vers
+ libgpg_error_la_LDFLAGS = \
+ -no-undefined $(export_symbols) $(libgpg_error_vers_opt) \
+- $(extra_ltoptions) -version-info \
++ $(extra_ltoptions) -release lo -version-info \
+ @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@
+
+ libgpg_error_la_SOURCES = gettext.h $(arch_sources) \
+--- libgpg-error/src/gpg-error.vers.orig 2019-01-28 14:08:11.413740011 +0100
++++ libgpg-error/src/gpg-error.vers 2019-01-28 14:08:34.172700037 +0100
+@@ -20,7 +20,7 @@
+ # visibility.h and gpg-error.def.in as well.
+
+
+-GPG_ERROR_1.0 {
++GPG_ERROR_LIBREOFFICE {
+ global:
+ gpg_strerror;
+ gpg_strerror_r;
diff --git a/external/libgpg-error/w32-build-fixes-2.patch.1 b/external/libgpg-error/w32-build-fixes-2.patch.1
new file mode 100644
index 000000000..0f8a8b36e
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes-2.patch.1
@@ -0,0 +1,31 @@
+diff -ru libgpg-error.orig/src/Makefile.in libgpg-error/src/Makefile.in
+--- libgpg-error.orig/src/Makefile.in 2017-09-12 08:18:29.376536700 +0200
++++ libgpg-error/src/Makefile.in 2017-09-12 08:57:11.648083800 +0200
+@@ -512,8 +512,7 @@
+ @HAVE_W32_SYSTEM_TRUE@arch_sources = w32-gettext.c w32-lock.c w32-lock-obj.h w32-thread.c \
+ @HAVE_W32_SYSTEM_TRUE@ w32-iconv.c w32-estream.c w32-reg.c spawn-w32.c
+
+-@HAVE_W32_SYSTEM_TRUE@RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+-@HAVE_W32_SYSTEM_TRUE@ -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS)
++@HAVE_W32_SYSTEM_TRUE@RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) -DLOCALEDIR=$(localedir) $(AM_CPPFLAGS)
+
+ @HAVE_W32_SYSTEM_TRUE@LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
+ @HAVE_W32_SYSTEM_TRUE@SUFFIXES = .rc .lo
+@@ -1242,7 +1241,7 @@
+
+
+ @HAVE_W32_SYSTEM_TRUE@.rc.lo:
+-@HAVE_W32_SYSTEM_TRUE@ $(LTRCCOMPILE) -i "$<" -o "$@"
++@HAVE_W32_SYSTEM_TRUE@ $(LTRCCOMPILE) -i $< -o $@
+
+ @HAVE_W32_SYSTEM_TRUE@versioninfo.lo : gpg-error.w32-manifest
+
+@@ -1283,7 +1282,7 @@
+ # It is correct to use $(CPP). We want the host's idea of the error codes.
+ mkerrcodes.h: Makefile mkerrcodes.awk $(gpg_extra_headers)
+ $(AWK) -f $(srcdir)/mkerrcodes1.awk $(srcdir)/errnos.in >_$@
+- $(CPP) $(CPPFLAGS) $(extra_cppflags) -P _$@ | grep GPG_ERR_ | \
++ $(CPP) $(CPPFLAGS) $(extra_cppflags) _$@ | grep GPG_ERR_ | \
+ $(AWK) -f $(srcdir)/mkerrcodes.awk >$@
+ -rm _$@
+
diff --git a/external/libgpg-error/w32-build-fixes-3.patch.1 b/external/libgpg-error/w32-build-fixes-3.patch.1
new file mode 100644
index 000000000..5883211f9
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes-3.patch.1
@@ -0,0 +1,57 @@
+diff -ru libgpg-error.orig/src/gpg-error.c libgpg-error/src/gpg-error.c
+--- libgpg-error.orig/src/gpg-error.c 2016-12-02 22:55:32.000000000 +0100
++++ libgpg-error/src/gpg-error.c 2017-09-13 22:25:10.040113800 +0200
+@@ -206,7 +206,7 @@
+ static const char src_prefix[] = "GPG_ERR_SOURCE_";
+ static const char code_prefix[] = "GPG_ERR_";
+
+- if (!strncasecmp (src_prefix, str, sizeof (src_prefix) - 1))
++ if (!_strnicmp (src_prefix, str, sizeof (src_prefix) - 1))
+ {
+ gpg_err_source_t src;
+
+@@ -220,14 +220,14 @@
+ const char *src_sym;
+
+ src_sym = gpg_strsource_sym (src << GPG_ERR_SOURCE_SHIFT);
+- if (src_sym && !strcasecmp (str, src_sym + sizeof (src_prefix) - 1))
++ if (src_sym && !_stricmp (str, src_sym + sizeof (src_prefix) - 1))
+ {
+ *err |= src << GPG_ERR_SOURCE_SHIFT;
+ return 1;
+ }
+ }
+ }
+- else if (!strncasecmp (code_prefix, str, sizeof (code_prefix) - 1))
++ else if (!_strnicmp (code_prefix, str, sizeof (code_prefix) - 1))
+ {
+ gpg_err_code_t code;
+
+@@ -240,7 +240,7 @@
+ {
+ const char *code_sym = gpg_strerror_sym (code);
+ if (code_sym
+- && !strcasecmp (str, code_sym + sizeof (code_prefix) - 1))
++ && !_stricmp (str, code_sym + sizeof (code_prefix) - 1))
+ {
+ *err |= code;
+ return 1;
+@@ -296,7 +296,7 @@
+ for (src = 0; src < GPG_ERR_SOURCE_DIM; src++)
+ {
+ const char *src_str = gpg_strsource (src << GPG_ERR_SOURCE_SHIFT);
+- if (src_str && !strcasecmp (str, src_str))
++ if (src_str && !_stricmp (str, src_str))
+ {
+ if (*have_source)
+ return 0;
+@@ -310,7 +310,7 @@
+ for (code = 0; code < GPG_ERR_CODE_DIM; code++)
+ {
+ const char *code_str = gpg_strerror (code);
+- if (code_str && !strcasecmp (str, code_str))
++ if (code_str && !_stricmp (str, code_str))
+ {
+ if (*have_code)
+ return 0;
+Nur in libgpg-error/src: gpg-error.c~.
diff --git a/external/libgpg-error/w32-build-fixes-4.patch b/external/libgpg-error/w32-build-fixes-4.patch
new file mode 100644
index 000000000..1d4e052a5
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes-4.patch
@@ -0,0 +1,13 @@
+Avoid MFC dependency - can go with very basic includes instead
+
+--- src/versioninfo.rc.in~ 2017-02-28 14:48:38.000000000 +0100
++++ src/versioninfo.rc.in 2017-11-29 01:41:47.549804600 +0100
+@@ -14,8 +14,6 @@
+
+ #line __LINE__ "versioninfo.rc.in"
+
+-#include <afxres.h>
+-
+
+ VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @BUILD_FILEVERSION@
diff --git a/external/libgpg-error/w32-build-fixes-5.patch b/external/libgpg-error/w32-build-fixes-5.patch
new file mode 100644
index 000000000..4e04e47a3
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes-5.patch
@@ -0,0 +1,145 @@
+--- src/argparse.c 2021-11-03 13:44:56.000000000 +0100
++++ src/argparse.c~ 2022-01-03 17:05:23.418077200 +0100
+@@ -33,8 +33,12 @@
+ #include <stdarg.h>
+ #include <limits.h>
+ #include <errno.h>
+-#include <unistd.h>
+ #include <time.h>
++#ifdef _WIN32
++# define R_OK 04
++# define strncasecmp _strnicmp
++# define strcasecmp _stricmp
++#endif
+
+ #include "gpgrt-int.h"
+
+--- src/gpg-error.c 2020-06-06 00:18:40.199791000 +0200
++++ src/gpg-error.c~ 2020-06-05 18:44:14.223182300 +0200
+@@ -61,6 +61,11 @@
+ #define drop_locale_dir(dir)
+ #endif
+
++#ifdef _WIN32
++# define strncasecmp _strnicmp
++# define strcasecmp _stricmp
++#endif
++
+ static void
+ i18n_init (void)
+ {
+
+--- src/spawn-w32.c~ 2022-01-03 16:33:24.000000000 +0100
++++ src/spawn-w32.c 2022-01-03 16:46:57.173841200 +0100
+@@ -56,7 +56,7 @@
+ * Previous versions interpreted X_OK as F_OK anyway, so we'll just
+ * use F_OK directly. */
+ #undef X_OK
++#define X_OK 0
+-#define X_OK F_OK
+
+ /* For HANDLE and the internal file descriptor (fd) of this module:
+ * HANDLE can be represented by an intptr_t which should be true for
+
+--- src/logging.c 2020-06-05 18:58:59.254413200 +0200
++++ src/logging.c~ 2019-12-12 15:23:37.000000000 +0100
+@@ -44,7 +44,12 @@
+ # include <netinet/in.h>
+ # include <arpa/inet.h>
+ #endif /*!HAVE_W32_SYSTEM*/
++#ifdef _WIN32
++# include <io.h>
++# include <process.h>
++#else
++# include <unistd.h>
++#endif
+-#include <unistd.h>
+ #include <fcntl.h>
+ /* #include <execinfo.h> */
+
+@@ -57,6 +53,15 @@
+
+
+ #ifdef HAVE_W32_SYSTEM
++# ifndef S_IRUSR
++# define S_IRUSR _S_IREAD
++# endif
++# ifndef S_IWUSR
++# define S_IWUSR _S_IWRITE
++# endif
++# ifndef S_IXUSR
++# define S_IXUSR 0x00400000
++# endif
+ # ifndef S_IRWXG
+ # define S_IRGRP S_IRUSR
+ # define S_IWGRP S_IWUSR
+--- src/Makefile.am 2020-06-06 01:01:31.931459300 +0200
++++ src/Makefile.am~ 2020-02-06 18:39:06.000000000 +0100
+@@ -213,7 +213,7 @@
+ # without the extra_cppflags because they may include am -idirafter
+ # which is not supported by the RC compiler.
+ libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags)
++libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) $(socklibs) -ladvapi32 $(LIBTHREAD)
+-libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) $(socklibs) $(LIBTHREAD)
+
+ gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c
+ gpg_error_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
+--- src/Makefile.in 2020-06-06 01:01:31.931459300 +0200
++++ src/Makefile.in~ 2020-02-06 18:39:06.000000000 +0100
+@@ -659,7 +659,7 @@
+ # without the extra_cppflags because they may include am -idirafter
+ # which is not supported by the RC compiler.
+ libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags)
++libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) $(socklibs) -ladvapi32 $(LIBTHREAD)
+-libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) $(socklibs) $(LIBTHREAD)
+ gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c
+ gpg_error_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
+ -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags)
+--- src/sysutils.c 2020-06-06 00:23:52.457265500 +0200
++++ src/sysutils.c~ 2019-12-12 15:23:37.000000000 +0100
+@@ -22,7 +22,11 @@
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <string.h>
++#ifdef _WIN32
++# include <io.h>
++#else
++# include <unistd.h>
++#endif
+-#include <unistd.h>
+ #include <errno.h>
+ #ifdef HAVE_W32_SYSTEM
+ # include <windows.h>
+--- src/visibility.c 2020-06-05 18:54:56.410442900 +0200
++++ src/visibility.c~ 2019-01-04 12:56:54.000000000 +0100
+@@ -1067,11 +1067,7 @@
+ _gpgrt_log_assert (const char *expr, const char *file,
+ int line, const char *func)
+ {
+-#ifdef GPGRT_HAVE_MACRO_FUNCTION
+ _gpgrt__log_assert (expr, file, line, func);
+-#else
+- _gpgrt__log_assert (expr, file, line);
+-#endif
+ }
+
+
+--- src/w32-add.h 2020-06-06 00:32:38.502203300 +0200
++++ src/w32-add.h~ 2018-12-07 14:48:19.000000000 +0100
+@@ -65,3 +65,5 @@
+ char *gpgrt_w32_reg_query_string (const char *root,
+ const char *dir,
+ const char *name);
++
++wchar_t *utf8_to_wchar (const char *string, size_t length, size_t *retlen);
+--- src/w32-gettext.c 2020-06-06 00:33:24.680341900 +0200
++++ src/w32-gettext.c~ 2020-06-05 18:44:14.254481700 +0200
+@@ -1355,7 +1355,7 @@
+ is not defined. If LENGTH is zero and RETLEN NULL the fucntion
+ assumes that STRING is a nul-terminated string and returns a
+ (wchar_t)0-terminated string. */
++wchar_t *
+-static wchar_t *
+ utf8_to_wchar (const char *string, size_t length, size_t *retlen)
+ {
+ int n;
diff --git a/external/libgpg-error/w32-build-fixes.patch b/external/libgpg-error/w32-build-fixes.patch
new file mode 100644
index 000000000..1de57e424
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes.patch
@@ -0,0 +1,121 @@
+diff -ur libgpg-error.org/src/estream.c libgpg-error/src/estream.c
+--- src/estream.c 2016-11-16 13:22:03.000000000 +0100
++++ src/estream.c~ 2017-02-19 17:53:15.010869000 +0100
+@@ -74,12 +74,16 @@
+ # include <sys/time.h>
+ #endif
+ #include <sys/types.h>
+-#include <sys/file.h>
++/*#include <sys/file.h>*/
+ #include <sys/stat.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <unistd.h>
++#ifdef _WIN32
++# include <io.h>
++#else
++# include <unistd.h>
++#endif
+ #include <stdarg.h>
+ #include <fcntl.h>
+ #include <errno.h>
+@@ -109,6 +113,15 @@
+
+
+ #ifdef HAVE_W32_SYSTEM
++# ifndef S_IRUSR
++# define S_IRUSR _S_IREAD
++# endif
++# ifndef S_IWUSR
++# define S_IWUSR _S_IWRITE
++# endif
++# ifndef S_IXUSR
++# define S_IXUSR 0x00400000
++# endif
+ # ifndef S_IRGRP
+ # define S_IRGRP S_IRUSR
+ # endif
+diff -ur libgpg-error.org/src/estream-printf.c libgpg-error/src/estream-printf.c
+--- src/estream-printf.c 2016-12-02 22:51:19.000000000 +0100
++++ src/estream-printf.c~ 2017-02-19 18:02:52.239383500 +0100
+@@ -85,7 +85,11 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <unistd.h>
++#ifdef _WIN32
++# include <io.h>
++#else
++# include <unistd.h>
++#endif
+ #include <stdarg.h>
+ #include <errno.h>
+ #include <stddef.h>
+--- src/mkheader.c 2016-11-16 13:22:03.000000000 +0100
++++ src/mkheader.c~ 2017-02-19 17:35:32.172009000 +0100
+@@ -16,7 +16,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+-#include <unistd.h>
++#ifdef _WIN32
++# include <io.h>
++#else
++# include <unistd.h>
++#endif
+
+ #define PGM "mkheader"
+
+@@ -402,12 +406,20 @@
+
+ repl_flag = !!strchr (name, '&');
+ incfname = mk_include_name (name, repl_flag? host_triplet : NULL);
++#ifdef _WIN32
++ rc = _access (incfname, 04);
++#else
+ rc = access (incfname, R_OK);
++#endif
+ if (rc && repl_flag)
+ {
+ free (incfname);
+ incfname = mk_include_name (name, host_os);
++#ifdef _WIN32
++ rc = _access (incfname, 04);
++#else
+ rc = access (incfname, R_OK);
++#endif
+ }
+ if (!rc)
+ include_file (fname, lnr, name, outf);
+diff -ur libgpg-error.org/src/w32-estream.c libgpg-error/src/w32-estream.c
+--- src/w32-estream.c 2016-11-16 13:22:03.000000000 +0100
++++ src/w32-estream.c~ 2017-02-19 17:37:35.879037500 +0100
+@@ -42,6 +42,11 @@
+
+ #include "gpgrt-int.h"
+
++#ifdef _WIN32
++/* no ssize_t in windows std headers, emulate for native build */
++typedef SSIZE_T ssize_t;
++#endif
++
+ /*
+ * In order to support es_poll on Windows, we create a proxy shim that
+ * we use as the estream I/O functions. This shim creates reader and
+--- src/spawn-w32.c 2019-08-22 12:30:38.000000000 +0200
++++ src/spawn-w32.c~ 2020-05-26 01:37:17.759077700 +0200
+@@ -34,7 +34,11 @@
+ #ifdef HAVE_SIGNAL_H
+ # include <signal.h>
+ #endif
+-#include <unistd.h>
++#ifdef _WIN32
++# include <io.h>
++#else
++# include <unistd.h>
++#endif
+ #include <fcntl.h>
+ #ifdef HAVE_STAT
+ # include <sys/stat.h>
+
diff --git a/external/libgpg-error/w32-disable-dllinit.patch.1 b/external/libgpg-error/w32-disable-dllinit.patch.1
new file mode 100644
index 000000000..96abb3bbd
--- /dev/null
+++ b/external/libgpg-error/w32-disable-dllinit.patch.1
@@ -0,0 +1,55 @@
+Disable all DLL init functions in libgpg-error, since they're
+not actually run in statically linked libs. And libtool seems
+to unconditionally set that flag on all Windows builds.
+
+diff -ur libgpg-error.org/src/init.c libgpg-error/src/init.c
+--- libgpg-error.org/src/init.c 2017-02-28 10:11:05.000000000 +0100
++++ libgpg-error/src/init.c 2017-11-23 16:44:56.850797400 +0100
+@@ -88,7 +88,7 @@
+ _gpg_err_init (void)
+ {
+ #ifdef HAVE_W32_SYSTEM
+-# ifdef DLL_EXPORT
++# ifdef HAVE_DLL_INIT
+ /* We always have a constructor and thus this function is called
+ automatically. Due to the way the C init code of mingw works,
+ the constructors are called before our DllMain function is
+@@ -130,7 +130,7 @@
+ void
+ _gpg_err_deinit (int mode)
+ {
+-#if defined (HAVE_W32_SYSTEM) && !defined(DLL_EXPORT)
++#if defined (HAVE_W32_SYSTEM) && !defined(HAVE_DLL_INIT)
+ struct tls_space_s *tls;
+
+ tls = TlsGetValue (tls_index);
+@@ -473,7 +473,7 @@
+
+
+ /* Entry point called by the DLL loader. */
+-#ifdef DLL_EXPORT
++#ifdef HAVE_DLL_INIT
+ int WINAPI
+ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
+ {
+diff -ur libgpg-error.org/src/w32-gettext.c libgpg-error/src/w32-gettext.c
+--- libgpg-error.org/src/w32-gettext.c 2016-12-02 22:51:19.000000000 +0100
++++ libgpg-error/src/w32-gettext.c 2017-11-23 16:43:28.450453000 +0100
+@@ -1180,7 +1180,7 @@
+ DLL. If used as a static lib we can't control the process set; for
+ example it might be used with a main module which is not build with
+ mingw and thus does not know how to call the constructors. */
+-#ifdef DLL_EXPORT
++#ifdef HAVE_DLL_INIT
+ static void module_init (void) _GPG_ERR_CONSTRUCTOR;
+ #endif
+ static void
+@@ -1195,7 +1195,7 @@
+ }
+ }
+
+-#if !defined(DLL_EXPORT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
++#if !defined(HAVE_DLL_INIT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
+ void
+ _gpg_w32__init_gettext_module (void)
+ {