1 These patches are currently required to get a properly working
2 MXE setup for sigrok usage.
4 - libsigrok currently requires a special libusb branch.
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
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
15 diff --git a/src/libusb1.mk b/src/libusb1.mk
16 index ab01bf69..53aed36e 100644
19 @@ -4,11 +4,11 @@ PKG := libusb1
20 $(PKG)_WEBSITE := https://libusb.info/
21 $(PKG)_DESCR := LibUsb-1.0
23 -$(PKG)_VERSION := 1.0.23
24 -$(PKG)_CHECKSUM := 4fc17b2ef3502757641bf8fe2c14ad86ec86302a2b785abcb0806fd03aa1201f
25 -$(PKG)_SUBDIR := libusb-$($(PKG)_VERSION)
26 -$(PKG)_FILE := libusb-$($(PKG)_VERSION).tar.bz2
27 -$(PKG)_URL := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE)
28 +$(PKG)_VERSION := 1.0.20-rc3-event-abstraction-v4
29 +$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
30 +$(PKG)_SUBDIR := libusb-event-abstraction-v4
31 +$(PKG)_FILE := libusb-event-abstraction-v4.zip
32 +$(PKG)_URL := https://github.com/dickens/libusb/archive/event-abstraction-v4.zip
36 @@ -19,7 +19,7 @@ define $(PKG)_UPDATE
40 - cd '$(1)' && ./configure \
41 + cd '$(1)' && autoreconf -i && ./configure \
42 $(MXE_CONFIGURE_OPTS) \
43 CFLAGS=-D_WIN32_WINNT=0x0500
44 $(MAKE) -C '$(1)' -j '$(JOBS)' install
45 diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch
46 index 764ece9e..428cc6a9 100644
47 --- a/src/glib-1-fixes.patch
48 +++ b/src/glib-1-fixes.patch
49 @@ -5,7 +5,7 @@ Contains ad hoc patches for cross building.
50 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
51 From: Mark Brand <mabrand@mabrand.nl>
52 Date: Thu, 23 Sep 2010 21:42:46 +0200
53 -Subject: [PATCH 01/10] fix tool paths
54 +Subject: [PATCH] fix tool paths
57 diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
58 @@ -29,17 +29,14 @@ index 1111111..2222222 100644
59 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
60 From: Hans Petter Jansson <hpj@cl.no>
61 Date: Fri, 15 Jun 2012 15:25:01 +0200
62 -Subject: [PATCH 02/10] Avoid DllMain symbol conflict when linking statically
63 +Subject: [PATCH] Avoid DllMain symbol conflict when linking statically
65 -Adjusted by Boris Nagaev on 29-Jan-2017 to fix
66 -https://gist.github.com/starius/f4fc85939352cb50122ba29e0f5b140d
67 -when updating to glib-2.50.2.
69 diff --git a/gio/giomodule.c b/gio/giomodule.c
70 index 1111111..2222222 100644
73 -@@ -928,14 +928,12 @@ extern GType g_cocoa_notification_backend_get_type (void);
74 +@@ -918,14 +918,12 @@ extern GType g_gtk_notification_backend_get_type (void);
76 static HMODULE gio_dll = NULL;
78 @@ -56,7 +53,7 @@ index 1111111..2222222 100644
82 -@@ -945,8 +943,6 @@ DllMain (HINSTANCE hinstDLL,
83 +@@ -935,8 +933,6 @@ DllMain (HINSTANCE hinstDLL,
87 @@ -69,7 +66,7 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c
88 index 1111111..2222222 100644
89 --- a/glib/glib-init.c
90 +++ b/glib/glib-init.c
91 -@@ -245,14 +245,14 @@ glib_init (void)
92 +@@ -237,14 +237,14 @@ glib_init (void)
94 #if defined (G_OS_WIN32)
96 @@ -86,31 +83,18 @@ index 1111111..2222222 100644
100 -diff --git a/gobject/gtype.c b/gobject/gtype.c
101 -index 1111111..2222222 100644
102 ---- a/gobject/gtype.c
103 -+++ b/gobject/gtype.c
104 -@@ -4450,7 +4450,7 @@ gobject_init (void)
108 --#if defined (G_OS_WIN32)
111 - BOOL WINAPI DllMain (HINSTANCE hinstDLL,
114 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
115 From: Hans Petter Jansson <hpj@cl.no>
116 Date: Fri, 15 Jun 2012 15:27:22 +0200
117 -Subject: [PATCH 03/10] Allow building without inotify support
118 +Subject: [PATCH] Allow building without inotify support
121 diff --git a/configure.ac b/configure.ac
122 index 1111111..2222222 100644
125 -@@ -1599,10 +1599,16 @@ dnl *****************************
126 +@@ -1659,10 +1659,16 @@ dnl *****************************
127 dnl ** Check for inotify (GIO) **
128 dnl *****************************
130 @@ -131,7 +115,7 @@ index 1111111..2222222 100644
131 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
132 From: Hans Petter Jansson <hpj@cl.no>
133 Date: Fri, 15 Jun 2012 15:28:14 +0200
134 -Subject: [PATCH 04/10] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
135 +Subject: [PATCH] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
136 Backported from upstream
139 @@ -139,7 +123,7 @@ diff --git a/configure.ac b/configure.ac
140 index 1111111..2222222 100644
143 -@@ -511,6 +511,8 @@ LT_INIT([disable-static win32-dll])
144 +@@ -499,6 +499,8 @@ LT_INIT([disable-static win32-dll])
145 dnl when using libtool 2.x create libtool early, because it's used in configure
146 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
148 @@ -152,7 +136,7 @@ index 1111111..2222222 100644
149 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
150 From: Hans Petter Jansson <hpj@cl.no>
151 Date: Fri, 15 Jun 2012 15:29:06 +0200
152 -Subject: [PATCH 05/10] Link with dnsapi
153 +Subject: [PATCH] Link with dnsapi
156 diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
157 @@ -171,15 +155,15 @@ index 1111111..2222222 100644
158 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
159 From: Hans Petter Jansson <hpj@cl.no>
160 Date: Fri, 15 Jun 2012 15:29:38 +0200
161 -Subject: [PATCH 06/10] Ensure globals are initialized even when DllMain is not
163 +Subject: [PATCH] Ensure globals are initialized even when DllMain is not being
167 diff --git a/glib/gmain.c b/glib/gmain.c
168 index 1111111..2222222 100644
171 -@@ -2657,12 +2657,15 @@ g_get_real_time (void)
172 +@@ -2577,12 +2577,15 @@ g_get_real_time (void)
173 #if defined (G_OS_WIN32)
174 static ULONGLONG (*g_GetTickCount64) (void) = NULL;
175 static guint32 g_win32_tick_epoch = 0;
176 @@ -195,7 +179,7 @@ index 1111111..2222222 100644
177 g_GetTickCount64 = NULL;
178 kernel32 = GetModuleHandle ("KERNEL32.DLL");
179 if (kernel32 != NULL)
180 -@@ -2721,6 +2724,9 @@ g_get_monotonic_time (void)
181 +@@ -2641,6 +2644,9 @@ g_get_monotonic_time (void)
182 * timeBeginPeriod() to increase it as much as they want
185 @@ -535,7 +519,7 @@ index 1111111..2222222 100644
186 win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
189 -@@ -1041,6 +1145,8 @@ g_thread_lookup_native_funcs (void)
190 +@@ -984,6 +1088,8 @@ g_thread_lookup_native_funcs (void)
192 g_thread_win32_init (void)
194 @@ -548,7 +532,7 @@ index 1111111..2222222 100644
195 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
196 From: Gerardo Ballabio <gerardo.ballabio@gmail.com>
197 Date: Sun, 16 Aug 2015 13:18:24 +0200
198 -Subject: [PATCH 07/10] Remove an annoying runtime warning
199 +Subject: [PATCH] Remove an annoying runtime warning
201 that pops up when using GtkApplication in Gtk+ 3 programs.
203 @@ -556,7 +540,7 @@ diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
204 index 1111111..2222222 100644
205 --- a/gio/gdbusaddress.c
206 +++ b/gio/gdbusaddress.c
207 -@@ -1387,6 +1387,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
208 +@@ -1325,6 +1325,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
209 __declspec(dllexport) void CALLBACK
210 g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow)
212 @@ -564,7 +548,7 @@ index 1111111..2222222 100644
216 -@@ -1418,6 +1419,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
217 +@@ -1354,6 +1355,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
219 g_main_loop_unref (loop);
220 g_object_unref (daemon);
221 @@ -576,7 +560,7 @@ index 1111111..2222222 100644
222 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
223 From: aquiles2k <aj@elane2k.com>
224 Date: Wed, 6 Apr 2016 22:39:53 +0300
225 -Subject: [PATCH 08/10] fix error "won't overwrite defined macro" on OSX
226 +Subject: [PATCH] fix error "won't overwrite defined macro" on OSX
228 See https://github.com/mxe/mxe/issues/1281
230 @@ -596,110 +580,22 @@ index 1111111..2222222 100644
231 dnl At the end, if we're not within glib, we'll define the public
232 dnl definitions in terms of our private definitions.
234 -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
235 -From: Tony Theodore <tonyt@logyst.com>
236 -Date: Mon, 26 Feb 2018 16:09:53 +1100
237 -Subject: [PATCH 09/10] darwin: disable g_cocoa_notification_backend
239 +From: Boris Pek <tehnick-8@mail.ru>
240 +Date: Thu, 28 Apr 2016 16:48:12 +0300
241 +Subject: [PATCH] fix build with GCC >= 6.x
243 -diff --git a/gio/Makefile.am b/gio/Makefile.am
244 -index 1111111..2222222 100644
245 ---- a/gio/Makefile.am
246 -+++ b/gio/Makefile.am
247 -@@ -279,10 +279,6 @@ unix_sources = \
249 - appinfo_sources += $(unix_appinfo_sources)
252 --unix_sources += gcocoanotificationbackend.c
255 - giounixincludedir=$(includedir)/gio-unix-2.0/gio
256 - giounixinclude_HEADERS = \
257 - gdesktopappinfo.h \
258 -diff --git a/gio/giomodule.c b/gio/giomodule.c
259 -index 1111111..2222222 100644
260 ---- a/gio/giomodule.c
261 -+++ b/gio/giomodule.c
262 -@@ -918,9 +918,6 @@ extern GType g_proxy_resolver_portal_get_type (void);
263 - extern GType g_network_monitor_portal_get_type (void);
267 --extern GType g_cocoa_notification_backend_get_type (void);
269 +See plugins/gcc6/README.md
271 +diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
272 +--- a/gio/gregistrysettingsbackend.c
273 ++++ b/gio/gregistrysettingsbackend.c
275 + if (result_code == ERROR_KEY_DELETED)
276 + trace ("(%s)", win32_message);
278 +- g_message (win32_message);
279 ++ g_message ("%s", win32_message);
282 - #ifdef G_PLATFORM_WIN32
284 -@@ -1117,9 +1114,6 @@ _g_io_modules_ensure_loaded (void)
285 - g_type_ensure (g_network_monitor_portal_get_type ());
286 - g_type_ensure (g_proxy_resolver_portal_get_type ());
289 -- g_type_ensure (g_cocoa_notification_backend_get_type ());
292 - g_type_ensure (_g_winhttp_vfs_get_type ());
295 -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
296 -From: Ernestas Kulik <ekulik@redhat.com>
297 -Date: Tue, 29 Jan 2019 09:50:46 +0100
298 -Subject: [PATCH 10/10] gdbus: Avoid printing null strings
300 -This mostly affects the 2.56 branch, but, given that GCC 9 is being
301 -stricter about passing null string pointers to printf-like functions, it
302 -might make sense to proactively fix such calls.
304 -gdbusauth.c: In function '_g_dbus_auth_run_server':
305 -gdbusauth.c:1302:11: error: '%s' directive argument is null
306 -[-Werror=format-overflow=]
307 - 1302 | debug_print ("SERVER: WaitingForBegin, read '%s'",
311 -gdbusmessage.c: In function ‘g_dbus_message_to_blob’:
312 -gdbusmessage.c:2730:30: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
313 - 2730 | tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
316 -diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c
317 -index 1111111..2222222 100644
318 ---- a/gio/gdbusauth.c
319 -+++ b/gio/gdbusauth.c
320 -@@ -1295,9 +1295,9 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
324 -- debug_print ("SERVER: WaitingForBegin, read '%s'", line);
327 -+ debug_print ("SERVER: WaitingForBegin, read '%s'", line);
328 - if (g_strcmp0 (line, "BEGIN") == 0)
331 -diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
332 -index 1111111..2222222 100644
333 ---- a/gio/gdbusmessage.c
334 -+++ b/gio/gdbusmessage.c
335 -@@ -2695,7 +2695,6 @@ g_dbus_message_to_blob (GDBusMessage *message,
336 - if (message->body != NULL)
338 - gchar *tupled_signature_str;
339 -- tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
340 - if (signature == NULL)
342 - g_set_error (error,
343 -@@ -2703,10 +2702,10 @@ g_dbus_message_to_blob (GDBusMessage *message,
344 - G_IO_ERROR_INVALID_ARGUMENT,
345 - _("Message body has signature '%s' but there is no signature header"),
347 -- g_free (tupled_signature_str);
350 -- else if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
351 -+ tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
352 -+ if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
354 - g_set_error (error,
356 diff --git a/src/glib-2-format.patch b/src/glib-2-format.patch
358 index 00000000..3d594af0
360 +++ b/src/glib-2-format.patch
362 +--- a/configure.ac.orig 2018-10-03 16:23:45.065890113 +0200
363 ++++ b/configure.ac 2018-10-03 16:28:04.378188119 +0200
364 +@@ -562,7 +562,7 @@ AS_IF([test x$glib_native_win32 != xyes
365 + # long long is a 64 bit integer.
366 + AC_MSG_CHECKING(for format to printf and scanf a guint64)
367 + AC_CACHE_VAL(glib_cv_long_long_format,[
368 +- for format in ll q I64; do
369 ++ for format in ll q; do
370 + AC_TRY_RUN([#include <stdio.h>
373 +@@ -588,7 +588,7 @@ AS_IF([test x$glib_native_win32 != xyes
374 + # __int64 is a 64 bit integer.
375 + AC_MSG_CHECKING(for format to printf and scanf a guint64)
376 + # We know this is MSVCRT.DLL, and what the formats are
377 +- glib_cv_long_long_format=I64
378 ++ glib_cv_long_long_format=ll
379 + AC_MSG_RESULT(%${glib_cv_long_long_format}u)
380 + AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
381 + AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
382 +@@ -3176,8 +3176,8 @@ $ac_cv_sizeof___int64)
383 + guint64_format='"'$glib_cv_long_long_format'u"'
386 +- gint64_constant='(val##i64)'
387 +- guint64_constant='(val##ui64)'
388 ++ gint64_constant='(val##ll)'
389 ++ guint64_constant='(val##ull)'
392 + glib_size_t=$ac_cv_sizeof_size_t
393 +@@ -3204,8 +3204,8 @@ long)
394 + glib_msize_type='LONG'
396 + "long long"|__int64)
397 +- gsize_modifier='"I64"'
398 +- gsize_format='"I64u"'
399 ++ gsize_modifier='"ll"'
400 ++ gsize_format='"llu"'
401 + glib_msize_type='INT64'
404 +@@ -3227,8 +3227,8 @@ long)
405 + glib_mssize_type='LONG'
407 + "long long"|__int64)
408 +- gssize_modifier='"I64"'
409 +- gssize_format='"I64i"'
410 ++ gssize_modifier='"ll"'
411 ++ gssize_format='"lli"'
412 + glib_mssize_type='INT64'
415 +@@ -3257,17 +3257,17 @@ $ac_cv_sizeof_long)
417 + $ac_cv_sizeof_long_long)
418 + glib_intptr_type_define='long long'
419 +- gintptr_modifier='"I64"'
420 +- gintptr_format='"I64i"'
421 +- guintptr_format='"I64u"'
422 ++ gintptr_modifier='"ll"'
423 ++ gintptr_format='"lli"'
424 ++ guintptr_format='"llu"'
425 + glib_gpi_cast='(gint64)'
426 + glib_gpui_cast='(guint64)'
428 + $ac_cv_sizeof___int64)
429 + glib_intptr_type_define=__int64
430 +- gintptr_modifier='"I64"'
431 +- gintptr_format='"I64i"'
432 +- guintptr_format='"I64u"'
433 ++ gintptr_modifier='"ll"'
434 ++ gintptr_format='"lli"'
435 ++ guintptr_format='"llu"'
436 + glib_gpi_cast='(gint64)'
437 + glib_gpui_cast='(guint64)'
439 diff --git a/src/glib.mk b/src/glib.mk
440 index 825b86bb..499a45b8 100644
445 $(PKG)_WEBSITE := https://gtk.org/
448 -$(PKG)_VERSION := 2.50.2
449 -$(PKG)_CHECKSUM := be68737c1f268c05493e503b3b654d2b7f43d7d0b8c5556f7e4651b870acfbf5
451 +$(PKG)_VERSION := 2.44.1
452 +$(PKG)_CHECKSUM := 8811deacaf8a503d0a9b701777ea079ca6a4277be10e3d730d2112735d5eca07
453 $(PKG)_SUBDIR := glib-$($(PKG)_VERSION)
454 $(PKG)_FILE := glib-$($(PKG)_VERSION).tar.xz
455 $(PKG)_URL := https://download.gnome.org/sources/glib/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE)
456 @@ -27,6 +27,7 @@ define $(PKG)_BUILD_DARWIN
457 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
458 $(MXE_CONFIGURE_OPTS) \
460 + --disable-compile-warnings \
464 @@ -55,6 +56,7 @@ define $(PKG)_BUILD_NATIVE
465 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
466 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
467 $(MXE_CONFIGURE_OPTS) \
468 + --disable-compile-warnings \
472 @@ -97,6 +99,7 @@ define $(PKG)_BUILD
473 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
474 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
475 $(MXE_CONFIGURE_OPTS) \
476 + --disable-compile-warnings \
477 --with-threads=win32 \
479 --with-libiconv=gnu \