]> sigrok.org Git - sigrok-util.git/blame - cross-compile/mingw/mxe_fixes.patch
sigrok-cross-mingw: Also build PV manual
[sigrok-util.git] / cross-compile / mingw / mxe_fixes.patch
CommitLineData
b9d1ce76
UH
1These patches are currently required to get a properly working
2MXE setup for sigrok usage.
3
4e20cf8f
UH
4 - libsigrok currently requires a special libusb branch.
5
8cf06ef3
UH
6 - We're reverting to glib 2.44.1 for now since more recent
7 versions (e.g. 2.50.2) seem to have a bug. Details:
8 https://sigrok.org/bugzilla/show_bug.cgi?id=1232
9 https://github.com/mxe/mxe/issues/2168
10
ef311ddb
UH
11 - We're patching glib to fix various MinGW compiler warnings. Details:
12 https://sigrok.org/bugzilla/show_bug.cgi?id=986
13 https://gitlab.gnome.org/GNOME/glib/commit/3d7cde654c4c6f3bdad32f5521f28f5802a7c377
14
4e20cf8f 15diff --git a/src/libusb1.mk b/src/libusb1.mk
ef311ddb 16index 358d0f3c..2f97246e 100644
4e20cf8f
UH
17--- a/src/libusb1.mk
18+++ b/src/libusb1.mk
ef311ddb 19@@ -5,10 +5,10 @@ $(PKG)_WEBSITE := https://libusb.info/
4e20cf8f
UH
20 $(PKG)_DESCR := LibUsb-1.0
21 $(PKG)_IGNORE :=
22 $(PKG)_VERSION := 1.0.21
23-$(PKG)_CHECKSUM := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b
24-$(PKG)_SUBDIR := libusb-$($(PKG)_VERSION)
25-$(PKG)_FILE := libusb-$($(PKG)_VERSION).tar.bz2
26-$(PKG)_URL := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE)
27+$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
28+$(PKG)_SUBDIR := libusb-event-abstraction-v4
29+$(PKG)_FILE := libusb-event-abstraction-v4.zip
30+$(PKG)_URL := https://github.com/dickens/libusb/archive/event-abstraction-v4.zip
31 $(PKG)_DEPS := cc
32
33 define $(PKG)_UPDATE
34@@ -19,7 +19,7 @@ define $(PKG)_UPDATE
35 endef
36
37 define $(PKG)_BUILD
38- cd '$(1)' && ./configure \
39+ cd '$(1)' && autoreconf -i && ./configure \
40 $(MXE_CONFIGURE_OPTS) \
41 CFLAGS=-D_WIN32_WINNT=0x0500
42 $(MAKE) -C '$(1)' -j '$(JOBS)' install
8cf06ef3
UH
43diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch
44index 021a5cac..428cc6a9 100644
45--- a/src/glib-1-fixes.patch
46+++ b/src/glib-1-fixes.patch
47@@ -5,7 +5,7 @@ Contains ad hoc patches for cross building.
48 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
49 From: Mark Brand <mabrand@mabrand.nl>
50 Date: Thu, 23 Sep 2010 21:42:46 +0200
51-Subject: [PATCH 1/9] fix tool paths
52+Subject: [PATCH] fix tool paths
53
54
55 diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
56@@ -29,17 +29,14 @@ index 1111111..2222222 100644
57 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
58 From: Hans Petter Jansson <hpj@cl.no>
59 Date: Fri, 15 Jun 2012 15:25:01 +0200
60-Subject: [PATCH 2/9] Avoid DllMain symbol conflict when linking statically
61+Subject: [PATCH] Avoid DllMain symbol conflict when linking statically
62
63-Adjusted by Boris Nagaev on 29-Jan-2017 to fix
64-https://gist.github.com/starius/f4fc85939352cb50122ba29e0f5b140d
65-when updating to glib-2.50.2.
66
67 diff --git a/gio/giomodule.c b/gio/giomodule.c
68 index 1111111..2222222 100644
69 --- a/gio/giomodule.c
70 +++ b/gio/giomodule.c
71-@@ -928,14 +928,12 @@ extern GType g_cocoa_notification_backend_get_type (void);
72+@@ -918,14 +918,12 @@ extern GType g_gtk_notification_backend_get_type (void);
73
74 static HMODULE gio_dll = NULL;
75
76@@ -56,7 +53,7 @@ index 1111111..2222222 100644
77 DWORD fdwReason,
78 LPVOID lpvReserved)
79 {
80-@@ -945,8 +943,6 @@ DllMain (HINSTANCE hinstDLL,
81+@@ -935,8 +933,6 @@ DllMain (HINSTANCE hinstDLL,
82 return TRUE;
83 }
84
85@@ -69,7 +66,7 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c
86 index 1111111..2222222 100644
87 --- a/glib/glib-init.c
88 +++ b/glib/glib-init.c
89-@@ -245,14 +245,14 @@ glib_init (void)
90+@@ -237,14 +237,14 @@ glib_init (void)
91
92 #if defined (G_OS_WIN32)
93
94@@ -86,31 +83,18 @@ index 1111111..2222222 100644
95 DWORD fdwReason,
96 LPVOID lpvReserved)
97 {
98-diff --git a/gobject/gtype.c b/gobject/gtype.c
99-index 1111111..2222222 100644
100---- a/gobject/gtype.c
101-+++ b/gobject/gtype.c
102-@@ -4450,7 +4450,7 @@ gobject_init (void)
103- _g_signal_init ();
104- }
105-
106--#if defined (G_OS_WIN32)
107-+#if 0
108-
109- BOOL WINAPI DllMain (HINSTANCE hinstDLL,
110- DWORD fdwReason,
111
112 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
113 From: Hans Petter Jansson <hpj@cl.no>
114 Date: Fri, 15 Jun 2012 15:27:22 +0200
115-Subject: [PATCH 3/9] Allow building without inotify support
116+Subject: [PATCH] Allow building without inotify support
117
118
119 diff --git a/configure.ac b/configure.ac
120 index 1111111..2222222 100644
121 --- a/configure.ac
122 +++ b/configure.ac
123-@@ -1599,10 +1599,16 @@ dnl *****************************
124+@@ -1659,10 +1659,16 @@ dnl *****************************
125 dnl ** Check for inotify (GIO) **
126 dnl *****************************
127 inotify_support=no
128@@ -131,7 +115,7 @@ index 1111111..2222222 100644
129 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
130 From: Hans Petter Jansson <hpj@cl.no>
131 Date: Fri, 15 Jun 2012 15:28:14 +0200
132-Subject: [PATCH 4/9] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
133+Subject: [PATCH] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
134 Backported from upstream
135
136
137@@ -139,7 +123,7 @@ diff --git a/configure.ac b/configure.ac
138 index 1111111..2222222 100644
139 --- a/configure.ac
140 +++ b/configure.ac
141-@@ -511,6 +511,8 @@ LT_INIT([disable-static win32-dll])
142+@@ -499,6 +499,8 @@ LT_INIT([disable-static win32-dll])
143 dnl when using libtool 2.x create libtool early, because it's used in configure
144 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
145
146@@ -152,7 +136,7 @@ index 1111111..2222222 100644
147 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
148 From: Hans Petter Jansson <hpj@cl.no>
149 Date: Fri, 15 Jun 2012 15:29:06 +0200
150-Subject: [PATCH 5/9] Link with dnsapi
151+Subject: [PATCH] Link with dnsapi
152
153
154 diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
155@@ -171,15 +155,15 @@ index 1111111..2222222 100644
156 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
157 From: Hans Petter Jansson <hpj@cl.no>
158 Date: Fri, 15 Jun 2012 15:29:38 +0200
159-Subject: [PATCH 6/9] Ensure globals are initialized even when DllMain is not
160- being run
161+Subject: [PATCH] Ensure globals are initialized even when DllMain is not being
162+ run
163
164
165 diff --git a/glib/gmain.c b/glib/gmain.c
166 index 1111111..2222222 100644
167 --- a/glib/gmain.c
168 +++ b/glib/gmain.c
169-@@ -2657,12 +2657,15 @@ g_get_real_time (void)
170+@@ -2577,12 +2577,15 @@ g_get_real_time (void)
171 #if defined (G_OS_WIN32)
172 static ULONGLONG (*g_GetTickCount64) (void) = NULL;
173 static guint32 g_win32_tick_epoch = 0;
174@@ -195,7 +179,7 @@ index 1111111..2222222 100644
175 g_GetTickCount64 = NULL;
176 kernel32 = GetModuleHandle ("KERNEL32.DLL");
177 if (kernel32 != NULL)
178-@@ -2721,6 +2724,9 @@ g_get_monotonic_time (void)
179+@@ -2641,6 +2644,9 @@ g_get_monotonic_time (void)
180 * timeBeginPeriod() to increase it as much as they want
181 */
182
183@@ -535,7 +519,7 @@ index 1111111..2222222 100644
184 win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
185 }
186
187-@@ -1041,6 +1145,8 @@ g_thread_lookup_native_funcs (void)
188+@@ -984,6 +1088,8 @@ g_thread_lookup_native_funcs (void)
189 void
190 g_thread_win32_init (void)
191 {
192@@ -548,7 +532,7 @@ index 1111111..2222222 100644
193 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
194 From: Gerardo Ballabio <gerardo.ballabio@gmail.com>
195 Date: Sun, 16 Aug 2015 13:18:24 +0200
196-Subject: [PATCH 7/9] Remove an annoying runtime warning
197+Subject: [PATCH] Remove an annoying runtime warning
198
199 that pops up when using GtkApplication in Gtk+ 3 programs.
200
201@@ -556,7 +540,7 @@ diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
202 index 1111111..2222222 100644
203 --- a/gio/gdbusaddress.c
204 +++ b/gio/gdbusaddress.c
205-@@ -1387,6 +1387,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
206+@@ -1325,6 +1325,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
207 __declspec(dllexport) void CALLBACK
208 g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow)
209 {
210@@ -564,7 +548,7 @@ index 1111111..2222222 100644
211 GDBusDaemon *daemon;
212 GMainLoop *loop;
213 const char *address;
214-@@ -1418,6 +1419,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
215+@@ -1354,6 +1355,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
216
217 g_main_loop_unref (loop);
218 g_object_unref (daemon);
219@@ -576,7 +560,7 @@ index 1111111..2222222 100644
220 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
221 From: aquiles2k <aj@elane2k.com>
222 Date: Wed, 6 Apr 2016 22:39:53 +0300
223-Subject: [PATCH 8/9] fix error "won't overwrite defined macro" on OSX
224+Subject: [PATCH] fix error "won't overwrite defined macro" on OSX
225
226 See https://github.com/mxe/mxe/issues/1281
227
228@@ -596,48 +580,22 @@ index 1111111..2222222 100644
229 dnl At the end, if we're not within glib, we'll define the public
230 dnl definitions in terms of our private definitions.
231
232-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
233-From: Tony Theodore <tonyt@logyst.com>
234-Date: Mon, 26 Feb 2018 16:09:53 +1100
235-Subject: [PATCH 9/9] darwin: disable g_cocoa_notification_backend
236
237+From: Boris Pek <tehnick-8@mail.ru>
238+Date: Thu, 28 Apr 2016 16:48:12 +0300
239+Subject: [PATCH] fix build with GCC >= 6.x
240
241-diff --git a/gio/Makefile.am b/gio/Makefile.am
242-index 1111111..2222222 100644
243---- a/gio/Makefile.am
244-+++ b/gio/Makefile.am
245-@@ -279,10 +279,6 @@ unix_sources = \
246-
247- appinfo_sources += $(unix_appinfo_sources)
248-
249--if OS_COCOA
250--unix_sources += gcocoanotificationbackend.c
251--endif
252--
253- giounixincludedir=$(includedir)/gio-unix-2.0/gio
254- giounixinclude_HEADERS = \
255- gdesktopappinfo.h \
256-diff --git a/gio/giomodule.c b/gio/giomodule.c
257-index 1111111..2222222 100644
258---- a/gio/giomodule.c
259-+++ b/gio/giomodule.c
260-@@ -918,9 +918,6 @@ extern GType g_proxy_resolver_portal_get_type (void);
261- extern GType g_network_monitor_portal_get_type (void);
262- #endif
263-
264--#ifdef HAVE_COCOA
265--extern GType g_cocoa_notification_backend_get_type (void);
266--#endif
267+See plugins/gcc6/README.md
268+
269+diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
270+--- a/gio/gregistrysettingsbackend.c
271++++ b/gio/gregistrysettingsbackend.c
272+@@ -228,7 +228,7 @@
273+ if (result_code == ERROR_KEY_DELETED)
274+ trace ("(%s)", win32_message);
275+ else
276+- g_message (win32_message);
277++ g_message ("%s", win32_message);
278+ };
279
280- #ifdef G_PLATFORM_WIN32
281
282-@@ -1117,9 +1114,6 @@ _g_io_modules_ensure_loaded (void)
283- g_type_ensure (g_network_monitor_portal_get_type ());
284- g_type_ensure (g_proxy_resolver_portal_get_type ());
285- #endif
286--#ifdef HAVE_COCOA
287-- g_type_ensure (g_cocoa_notification_backend_get_type ());
288--#endif
289- #ifdef G_OS_WIN32
290- g_type_ensure (_g_winhttp_vfs_get_type ());
291- #endif
ef311ddb
UH
292diff --git a/src/glib-2-format.patch b/src/glib-2-format.patch
293new file mode 100644
294index 00000000..3d594af0
295--- /dev/null
296+++ b/src/glib-2-format.patch
297@@ -0,0 +1,77 @@
298+--- a/configure.ac.orig 2018-10-03 16:23:45.065890113 +0200
299++++ b/configure.ac 2018-10-03 16:28:04.378188119 +0200
300+@@ -562,7 +562,7 @@ AS_IF([test x$glib_native_win32 != xyes
301+ # long long is a 64 bit integer.
302+ AC_MSG_CHECKING(for format to printf and scanf a guint64)
303+ AC_CACHE_VAL(glib_cv_long_long_format,[
304+- for format in ll q I64; do
305++ for format in ll q; do
306+ AC_TRY_RUN([#include <stdio.h>
307+ int main()
308+ {
309+@@ -588,7 +588,7 @@ AS_IF([test x$glib_native_win32 != xyes
310+ # __int64 is a 64 bit integer.
311+ AC_MSG_CHECKING(for format to printf and scanf a guint64)
312+ # We know this is MSVCRT.DLL, and what the formats are
313+- glib_cv_long_long_format=I64
314++ glib_cv_long_long_format=ll
315+ AC_MSG_RESULT(%${glib_cv_long_long_format}u)
316+ AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
317+ AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
318+@@ -3176,8 +3176,8 @@ $ac_cv_sizeof___int64)
319+ guint64_format='"'$glib_cv_long_long_format'u"'
320+ fi
321+ glib_extension=
322+- gint64_constant='(val##i64)'
323+- guint64_constant='(val##ui64)'
324++ gint64_constant='(val##ll)'
325++ guint64_constant='(val##ull)'
326+ ;;
327+ esac
328+ glib_size_t=$ac_cv_sizeof_size_t
329+@@ -3204,8 +3204,8 @@ long)
330+ glib_msize_type='LONG'
331+ ;;
332+ "long long"|__int64)
333+- gsize_modifier='"I64"'
334+- gsize_format='"I64u"'
335++ gsize_modifier='"ll"'
336++ gsize_format='"llu"'
337+ glib_msize_type='INT64'
338+ ;;
339+ esac
340+@@ -3227,8 +3227,8 @@ long)
341+ glib_mssize_type='LONG'
342+ ;;
343+ "long long"|__int64)
344+- gssize_modifier='"I64"'
345+- gssize_format='"I64i"'
346++ gssize_modifier='"ll"'
347++ gssize_format='"lli"'
348+ glib_mssize_type='INT64'
349+ ;;
350+ esac
351+@@ -3257,17 +3257,17 @@ $ac_cv_sizeof_long)
352+ ;;
353+ $ac_cv_sizeof_long_long)
354+ glib_intptr_type_define='long long'
355+- gintptr_modifier='"I64"'
356+- gintptr_format='"I64i"'
357+- guintptr_format='"I64u"'
358++ gintptr_modifier='"ll"'
359++ gintptr_format='"lli"'
360++ guintptr_format='"llu"'
361+ glib_gpi_cast='(gint64)'
362+ glib_gpui_cast='(guint64)'
363+ ;;
364+ $ac_cv_sizeof___int64)
365+ glib_intptr_type_define=__int64
366+- gintptr_modifier='"I64"'
367+- gintptr_format='"I64i"'
368+- guintptr_format='"I64u"'
369++ gintptr_modifier='"ll"'
370++ gintptr_format='"lli"'
371++ guintptr_format='"llu"'
372+ glib_gpi_cast='(gint64)'
373+ glib_gpui_cast='(guint64)'
374+ ;;
8cf06ef3
UH
375diff --git a/src/glib.mk b/src/glib.mk
376index 825b86bb..499a45b8 100644
377--- a/src/glib.mk
378+++ b/src/glib.mk
379@@ -3,9 +3,9 @@
380 PKG := glib
381 $(PKG)_WEBSITE := https://gtk.org/
382 $(PKG)_DESCR := GLib
383-$(PKG)_IGNORE :=
384-$(PKG)_VERSION := 2.50.2
385-$(PKG)_CHECKSUM := be68737c1f268c05493e503b3b654d2b7f43d7d0b8c5556f7e4651b870acfbf5
386+$(PKG)_IGNORE :=
387+$(PKG)_VERSION := 2.44.1
388+$(PKG)_CHECKSUM := 8811deacaf8a503d0a9b701777ea079ca6a4277be10e3d730d2112735d5eca07
389 $(PKG)_SUBDIR := glib-$($(PKG)_VERSION)
390 $(PKG)_FILE := glib-$($(PKG)_VERSION).tar.xz
391 $(PKG)_URL := https://download.gnome.org/sources/glib/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE)
392@@ -27,6 +27,7 @@ define $(PKG)_BUILD_DARWIN
393 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
394 $(MXE_CONFIGURE_OPTS) \
395 --enable-regex \
396+ --disable-compile-warnings \
397 --disable-threads \
398 --disable-selinux \
399 --disable-inotify \
400@@ -55,6 +56,7 @@ define $(PKG)_BUILD_NATIVE
401 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
402 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
403 $(MXE_CONFIGURE_OPTS) \
404+ --disable-compile-warnings \
405 --enable-regex \
406 --disable-threads \
407 --disable-selinux \
408@@ -97,6 +99,7 @@ define $(PKG)_BUILD
409 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
410 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
411 $(MXE_CONFIGURE_OPTS) \
412+ --disable-compile-warnings \
413 --with-threads=win32 \
414 --with-pcre=system \
415 --with-libiconv=gnu \