summaryrefslogtreecommitdiffstats
path: root/external/libgpg-error
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/libgpg-error
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.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 'external/libgpg-error')
-rw-r--r--external/libgpg-error/ExternalPackage_libgpg-error.mk28
-rw-r--r--external/libgpg-error/ExternalProject_libgpg-error.mk54
-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.mk29
-rw-r--r--external/libgpg-error/clang-cl.patch22
-rw-r--r--external/libgpg-error/libgpg-error_gawk5.patch114
-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.patch206
-rw-r--r--external/libgpg-error/w32-disable-dllinit.patch.155
14 files changed, 665 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..3afd218ee
--- /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.22.0))
+
+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..cf0b594dc
--- /dev/null
+++ b/external/libgpg-error/ExternalProject_libgpg-error.mk
@@ -0,0 +1,54 @@
+# -*- 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)
+gb_ExternalProject_libgpg-error_host := $(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32)
+gb_ExternalProject_libgpg-error_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
+$(call gb_ExternalProject_get_state_target,libgpg-error,build): $(call gb_Executable_get_target,cpp)
+ $(call gb_Trace_StartRange,libgpg-error,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MAKE=$(MAKE) ./configure \
+ --enable-static \
+ --disable-shared \
+ --disable-rpath \
+ --disable-languages \
+ --disable-doc \
+ --disable-tests \
+ --host=$(gb_ExternalProject_libgpg-error_host) \
+ RC='windres -O COFF --target=$(gb_ExternalProject_libgpg-error_target) --preprocessor='\''$(call gb_Executable_get_target,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\' \
+ && $(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) ./configure \
+ --disable-rpath \
+ --disable-languages \
+ --disable-doc \
+ CPPFLAGS=" $(SOLARINC)" \
+ $(if $(filter MSC,$(COM)),--force_use_syscfg=true) \
+ $(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) \
+ )
+ $(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..485dc7374
--- /dev/null
+++ b/external/libgpg-error/UnpackedTarball_libgpg-error.mk
@@ -0,0 +1,29 @@
+# -*- 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))
+
+# clang-cl.patch src/gpgrt-int.h part upstream at <https://dev.gnupg.org/T4356> "Declaration of
+# _gpgrt_functions_w32_pollable in src/gpgrt-int.h should be extern"
+$(eval $(call gb_UnpackedTarball_add_patches,libgpg-error, \
+ external/libgpg-error/libgpg-error_gawk5.patch \
+ $(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 \
+ external/libgpg-error/clang-cl.patch \
+ $(if $(filter LINUX,$(OS)),external/libgpg-error/libgpgerror-bundled-soname.patch.1) \
+))
+
+# 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..ef1447fb6
--- /dev/null
+++ b/external/libgpg-error/clang-cl.patch
@@ -0,0 +1,22 @@
+--- src/gpg-error.h.in
++++ src/gpg-error.h.in
+@@ -141,7 +141,7 @@
+
+
+ /* GCC feature test. */
+-#if __GNUC__
++#if defined __GNUC__
+ # define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+--- src/gpgrt-int.h
++++ src/gpgrt-int.h
+@@ -359,7 +359,7 @@
+
+ #if _WIN32
+ /* Prototypes for w32-estream.c. */
+-struct cookie_io_functions_s _gpgrt_functions_w32_pollable;
++extern struct cookie_io_functions_s _gpgrt_functions_w32_pollable;
+ int _gpgrt_w32_pollable_create (void *_GPGRT__RESTRICT *_GPGRT__RESTRICT cookie,
+ unsigned int modeflags,
+ struct cookie_io_functions_s next_functions,
diff --git a/external/libgpg-error/libgpg-error_gawk5.patch b/external/libgpg-error/libgpg-error_gawk5.patch
new file mode 100644
index 000000000..3be76a453
--- /dev/null
+++ b/external/libgpg-error/libgpg-error_gawk5.patch
@@ -0,0 +1,114 @@
+--- src/Makefile.am
++++ src/Makefile.am~
+@@ -266,7 +266,7 @@
+
+ errnos-sym.h: Makefile mkstrtable.awk errnos.in
+ $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
+- -v prefix=GPG_ERR_ -v namespace=errnos_ \
++ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
+ $(srcdir)/errnos.in >$@
+
+
+--- src/mkerrcodes.awk
++++ src/mkerrcodes.awk~
+@@ -81,7 +81,7 @@
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+--- src/mkerrcodes1.awk
++++ src/mkerrcodes1.awk~
+@@ -81,7 +81,7 @@
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+--- src/mkerrcodes2.awk
++++ src/mkerrcodes2.awk~
+@@ -91,7 +91,7 @@
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+--- src/mkerrnos.awk
++++ src/mkerrnos.awk~
+@@ -83,7 +83,7 @@
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+--- src/mkstrtable.awk
++++ src/mkstrtable.awk~
+@@ -77,7 +77,7 @@
+ #
+ # The variable prefix can be used to prepend a string to each message.
+ #
+-# The variable namespace can be used to prepend a string to each
++# The variable pkg_namespace can be used to prepend a string to each
+ # variable and macro name.
+
+ BEGIN {
+@@ -102,7 +102,7 @@
+ print "/* The purpose of this complex string table is to produce";
+ print " optimal code with a minimum of relocations. */";
+ print "";
+- print "static const char " namespace "msgstr[] = ";
++ print "static const char " pkg_namespace "msgstr[] = ";
+ header = 0;
+ }
+ else
+@@ -110,7 +110,7 @@
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+@@ -150,7 +150,7 @@
+ else
+ print " gettext_noop (\"" last_msgstr "\");";
+ print "";
+- print "static const int " namespace "msgidx[] =";
++ print "static const int " pkg_namespace "msgidx[] =";
+ print " {";
+ for (i = 0; i < coded_msgs; i++)
+ print " " pos[i] ",";
+@@ -158,7 +158,7 @@
+ print " };";
+ print "";
+ print "static GPG_ERR_INLINE int";
+- print namespace "msgidxof (int code)";
++ print pkg_namespace "msgidxof (int code)";
+ print "{";
+ print " return (0 ? 0";
+
+--- src/Makefile.in
++++ src/Makefile.in~
+@@ -1321,7 +1321,7 @@
+
+ errnos-sym.h: Makefile mkstrtable.awk errnos.in
+ $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
+- -v prefix=GPG_ERR_ -v namespace=errnos_ \
++ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
+ $(srcdir)/errnos.in >$@
+
+ mkheader: mkheader.c Makefile
+
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..4f927def3
--- /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..3d9c4324a
--- /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
+
+-@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.patch b/external/libgpg-error/w32-build-fixes.patch
new file mode 100644
index 000000000..96a62e320
--- /dev/null
+++ b/external/libgpg-error/w32-build-fixes.patch
@@ -0,0 +1,206 @@
+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/Makefile.am 2017-02-28 13:33:38.000000000 +0100
++++ src/Makefile.am~ 2017-09-10 21:52:19.739988146 +0200
+@@ -99,9 +99,9 @@
+
+ CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
+ gpg-error.h gpgrt.h \
+- mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
++ mkerrcodes.exe mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
+ mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
+- gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
++ gpg-extra/errno.h mkheader.exe $(tmp_files) lock-obj-pub.native.h
+
+
+ #
+@@ -251,7 +251,7 @@
+
+ # It is correct to use $(CC_FOR_BUILD) here. We want to run the
+ # program at build time.
+-mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
++mkerrcodes.exe: mkerrcodes.c mkerrcodes.h Makefile
+ $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
+
+ if HAVE_W32CE_SYSTEM
+@@ -261,7 +261,7 @@
+ $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
+ endif
+
+-code-from-errno.h: mkerrcodes Makefile
++code-from-errno.h: mkerrcodes.exe Makefile
+ ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
+
+ errnos-sym.h: Makefile mkstrtable.awk errnos.in
+@@ -270,7 +270,7 @@
+ $(srcdir)/errnos.in >$@
+
+
+-mkheader: mkheader.c Makefile
++mkheader.exe: mkheader.c Makefile
+ $(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
+
+ parts_of_gpg_error_h = \
+@@ -297,7 +297,7 @@
+
+ # We also depend on versioninfo.rc because that is build by
+ # config.status and thus has up-to-date version numbers.
+-gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
++gpg-error.h: Makefile mkheader.exe $(parts_of_gpg_error_h) \
+ versioninfo.rc ../config.h
+ $(pre_mkheader_cmds)
+ ./mkheader $(host_os) $(host_triplet) $(srcdir)/gpg-error.h.in \
+diff -ru libgpg-error.orig/src/Makefile.in libgpg-error/src/Makefile.in
+--- src/Makefile.in 2017-02-28 15:03:41.000000000 +0100
++++ src/Makefile.in~ 2017-09-10 21:53:48.447987149 +0200
+@@ -493,9 +493,9 @@
+ tmp_files = _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c
+ CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
+ gpg-error.h gpgrt.h \
+- mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
++ mkerrcodes.exe mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
+ mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
+- gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
++ gpg-extra/errno.h mkheader.exe $(tmp_files) lock-obj-pub.native.h
+
+
+ #
+@@ -1309,7 +1309,7 @@
+
+ # It is correct to use $(CC_FOR_BUILD) here. We want to run the
+ # program at build time.
+-mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
++mkerrcodes.exe: mkerrcodes.c mkerrcodes.h Makefile
+ $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
+
+ # It is correct to use $(CC_FOR_BUILD) here. We want to run the
+@@ -1317,7 +1317,7 @@
+ @HAVE_W32CE_SYSTEM_TRUE@mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile
+ @HAVE_W32CE_SYSTEM_TRUE@ $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
+
+-code-from-errno.h: mkerrcodes Makefile
++code-from-errno.h: mkerrcodes.exe Makefile
+ ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
+
+ errnos-sym.h: Makefile mkstrtable.awk errnos.in
+@@ -1325,7 +1325,7 @@
+ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
+ $(srcdir)/errnos.in >$@
+
+-mkheader: mkheader.c Makefile
++mkheader.exe: mkheader.c Makefile
+ $(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
+
+ @FORCE_USE_SYSCFG_FALSE@./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h
+@@ -1333,7 +1333,7 @@
+
+ # We also depend on versioninfo.rc because that is build by
+ # config.status and thus has up-to-date version numbers.
+-gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
++gpg-error.h: Makefile mkheader.exe $(parts_of_gpg_error_h) \
+ versioninfo.rc ../config.h
+ $(pre_mkheader_cmds)
+ ./mkheader $(host_os) $(host_triplet) $(srcdir)/gpg-error.h.in \
+--- 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
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)
+ {