Bump version to 6.4.7.2.M8
[LibreOffice.git] / external / libgpg-error / w32-build-fixes.patch
blob96a62e32042ca25c9b50782ee386dc96e33eefff
1 diff -ur libgpg-error.org/src/estream.c libgpg-error/src/estream.c
2 --- src/estream.c 2016-11-16 13:22:03.000000000 +0100
3 +++ src/estream.c~ 2017-02-19 17:53:15.010869000 +0100
4 @@ -74,12 +74,16 @@
5 # include <sys/time.h>
6 #endif
7 #include <sys/types.h>
8 -#include <sys/file.h>
9 +/*#include <sys/file.h>*/
10 #include <sys/stat.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 -#include <unistd.h>
15 +#ifdef _WIN32
16 +# include <io.h>
17 +#else
18 +# include <unistd.h>
19 +#endif
20 #include <stdarg.h>
21 #include <fcntl.h>
22 #include <errno.h>
23 @@ -109,6 +113,15 @@
26 #ifdef HAVE_W32_SYSTEM
27 +# ifndef S_IRUSR
28 +# define S_IRUSR _S_IREAD
29 +# endif
30 +# ifndef S_IWUSR
31 +# define S_IWUSR _S_IWRITE
32 +# endif
33 +# ifndef S_IXUSR
34 +# define S_IXUSR 0x00400000
35 +# endif
36 # ifndef S_IRGRP
37 # define S_IRGRP S_IRUSR
38 # endif
39 diff -ur libgpg-error.org/src/estream-printf.c libgpg-error/src/estream-printf.c
40 --- src/estream-printf.c 2016-12-02 22:51:19.000000000 +0100
41 +++ src/estream-printf.c~ 2017-02-19 18:02:52.239383500 +0100
42 @@ -85,7 +85,11 @@
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 -#include <unistd.h>
47 +#ifdef _WIN32
48 +# include <io.h>
49 +#else
50 +# include <unistd.h>
51 +#endif
52 #include <stdarg.h>
53 #include <errno.h>
54 #include <stddef.h>
55 --- src/Makefile.am 2017-02-28 13:33:38.000000000 +0100
56 +++ src/Makefile.am~ 2017-09-10 21:52:19.739988146 +0200
57 @@ -99,9 +99,9 @@
59 CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
60 gpg-error.h gpgrt.h \
61 - mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
62 + mkerrcodes.exe mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
63 mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
64 - gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
65 + gpg-extra/errno.h mkheader.exe $(tmp_files) lock-obj-pub.native.h
69 @@ -251,7 +251,7 @@
71 # It is correct to use $(CC_FOR_BUILD) here. We want to run the
72 # program at build time.
73 -mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
74 +mkerrcodes.exe: mkerrcodes.c mkerrcodes.h Makefile
75 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
77 if HAVE_W32CE_SYSTEM
78 @@ -261,7 +261,7 @@
79 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
80 endif
82 -code-from-errno.h: mkerrcodes Makefile
83 +code-from-errno.h: mkerrcodes.exe Makefile
84 ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
86 errnos-sym.h: Makefile mkstrtable.awk errnos.in
87 @@ -270,7 +270,7 @@
88 $(srcdir)/errnos.in >$@
91 -mkheader: mkheader.c Makefile
92 +mkheader.exe: mkheader.c Makefile
93 $(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
95 parts_of_gpg_error_h = \
96 @@ -297,7 +297,7 @@
98 # We also depend on versioninfo.rc because that is build by
99 # config.status and thus has up-to-date version numbers.
100 -gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
101 +gpg-error.h: Makefile mkheader.exe $(parts_of_gpg_error_h) \
102 versioninfo.rc ../config.h
103 $(pre_mkheader_cmds)
104 ./mkheader $(host_os) $(host_triplet) $(srcdir)/gpg-error.h.in \
105 diff -ru libgpg-error.orig/src/Makefile.in libgpg-error/src/Makefile.in
106 --- src/Makefile.in 2017-02-28 15:03:41.000000000 +0100
107 +++ src/Makefile.in~ 2017-09-10 21:53:48.447987149 +0200
108 @@ -493,9 +493,9 @@
109 tmp_files = _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c
110 CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
111 gpg-error.h gpgrt.h \
112 - mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
113 + mkerrcodes.exe mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
114 mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
115 - gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
116 + gpg-extra/errno.h mkheader.exe $(tmp_files) lock-obj-pub.native.h
120 @@ -1309,7 +1309,7 @@
122 # It is correct to use $(CC_FOR_BUILD) here. We want to run the
123 # program at build time.
124 -mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
125 +mkerrcodes.exe: mkerrcodes.c mkerrcodes.h Makefile
126 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
128 # It is correct to use $(CC_FOR_BUILD) here. We want to run the
129 @@ -1317,7 +1317,7 @@
130 @HAVE_W32CE_SYSTEM_TRUE@mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile
131 @HAVE_W32CE_SYSTEM_TRUE@ $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
133 -code-from-errno.h: mkerrcodes Makefile
134 +code-from-errno.h: mkerrcodes.exe Makefile
135 ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
137 errnos-sym.h: Makefile mkstrtable.awk errnos.in
138 @@ -1325,7 +1325,7 @@
139 -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
140 $(srcdir)/errnos.in >$@
142 -mkheader: mkheader.c Makefile
143 +mkheader.exe: mkheader.c Makefile
144 $(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
146 @FORCE_USE_SYSCFG_FALSE@./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h
147 @@ -1333,7 +1333,7 @@
149 # We also depend on versioninfo.rc because that is build by
150 # config.status and thus has up-to-date version numbers.
151 -gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
152 +gpg-error.h: Makefile mkheader.exe $(parts_of_gpg_error_h) \
153 versioninfo.rc ../config.h
154 $(pre_mkheader_cmds)
155 ./mkheader $(host_os) $(host_triplet) $(srcdir)/gpg-error.h.in \
156 --- src/mkheader.c 2016-11-16 13:22:03.000000000 +0100
157 +++ src/mkheader.c~ 2017-02-19 17:35:32.172009000 +0100
158 @@ -16,7 +16,11 @@
159 #include <stdlib.h>
160 #include <string.h>
161 #include <errno.h>
162 -#include <unistd.h>
163 +#ifdef _WIN32
164 +# include <io.h>
165 +#else
166 +# include <unistd.h>
167 +#endif
169 #define PGM "mkheader"
171 @@ -402,12 +406,20 @@
173 repl_flag = !!strchr (name, '&');
174 incfname = mk_include_name (name, repl_flag? host_triplet : NULL);
175 +#ifdef _WIN32
176 + rc = _access (incfname, 04);
177 +#else
178 rc = access (incfname, R_OK);
179 +#endif
180 if (rc && repl_flag)
182 free (incfname);
183 incfname = mk_include_name (name, host_os);
184 +#ifdef _WIN32
185 + rc = _access (incfname, 04);
186 +#else
187 rc = access (incfname, R_OK);
188 +#endif
190 if (!rc)
191 include_file (fname, lnr, name, outf);
192 diff -ur libgpg-error.org/src/w32-estream.c libgpg-error/src/w32-estream.c
193 --- src/w32-estream.c 2016-11-16 13:22:03.000000000 +0100
194 +++ src/w32-estream.c~ 2017-02-19 17:37:35.879037500 +0100
195 @@ -42,6 +42,11 @@
197 #include "gpgrt-int.h"
199 +#ifdef _WIN32
200 +/* no ssize_t in windows std headers, emulate for native build */
201 +typedef SSIZE_T ssize_t;
202 +#endif
205 * In order to support es_poll on Windows, we create a proxy shim that
206 * we use as the estream I/O functions. This shim creates reader and