]> sigrok.org Git - sigrok-util.git/blob - cross-compile/mingw/mxe_fixes.patch
sigrok-cross-mingw: Drop apparently obsolete libzip patch.
[sigrok-util.git] / cross-compile / mingw / mxe_fixes.patch
1 These patches are currently required to get a properly working
2 MXE setup for sigrok usage.
3
4  - libsigrok currently requires a special libusb branch.
5
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
11 diff --git a/src/libusb1.mk b/src/libusb1.mk
12 index 0b58dff3..281a1169 100644
13 --- a/src/libusb1.mk
14 +++ b/src/libusb1.mk
15 @@ -5,10 +5,10 @@ $(PKG)_WEBSITE  := http://libusb.org/
16  $(PKG)_DESCR    := LibUsb-1.0
17  $(PKG)_IGNORE   :=
18  $(PKG)_VERSION  := 1.0.21
19 -$(PKG)_CHECKSUM := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b
20 -$(PKG)_SUBDIR   := libusb-$($(PKG)_VERSION)
21 -$(PKG)_FILE     := libusb-$($(PKG)_VERSION).tar.bz2
22 -$(PKG)_URL      := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE)
23 +$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
24 +$(PKG)_SUBDIR   := libusb-event-abstraction-v4
25 +$(PKG)_FILE     := libusb-event-abstraction-v4.zip
26 +$(PKG)_URL      := https://github.com/dickens/libusb/archive/event-abstraction-v4.zip
27  $(PKG)_DEPS     := cc
28  
29  define $(PKG)_UPDATE
30 @@ -19,7 +19,7 @@ define $(PKG)_UPDATE
31  endef
32  
33  define $(PKG)_BUILD
34 -    cd '$(1)' && ./configure \
35 +    cd '$(1)' && autoreconf -i && ./configure \
36          $(MXE_CONFIGURE_OPTS) \
37          CFLAGS=-D_WIN32_WINNT=0x0500
38      $(MAKE) -C '$(1)' -j '$(JOBS)' install
39 diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch
40 index 021a5cac..428cc6a9 100644
41 --- a/src/glib-1-fixes.patch
42 +++ b/src/glib-1-fixes.patch
43 @@ -5,7 +5,7 @@ Contains ad hoc patches for cross building.
44  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
45  From: Mark Brand <mabrand@mabrand.nl>
46  Date: Thu, 23 Sep 2010 21:42:46 +0200
47 -Subject: [PATCH 1/9] fix tool paths
48 +Subject: [PATCH] fix tool paths
49  
50  
51  diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
52 @@ -29,17 +29,14 @@ index 1111111..2222222 100644
53  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
54  From: Hans Petter Jansson <hpj@cl.no>
55  Date: Fri, 15 Jun 2012 15:25:01 +0200
56 -Subject: [PATCH 2/9] Avoid DllMain symbol conflict when linking statically
57 +Subject: [PATCH] Avoid DllMain symbol conflict when linking statically
58  
59 -Adjusted by Boris Nagaev on 29-Jan-2017 to fix
60 -https://gist.github.com/starius/f4fc85939352cb50122ba29e0f5b140d
61 -when updating to glib-2.50.2.
62  
63  diff --git a/gio/giomodule.c b/gio/giomodule.c
64  index 1111111..2222222 100644
65  --- a/gio/giomodule.c
66  +++ b/gio/giomodule.c
67 -@@ -928,14 +928,12 @@ extern GType g_cocoa_notification_backend_get_type (void);
68 +@@ -918,14 +918,12 @@ extern GType g_gtk_notification_backend_get_type (void);
69   
70   static HMODULE gio_dll = NULL;
71   
72 @@ -56,7 +53,7 @@ index 1111111..2222222 100644
73          DWORD     fdwReason,
74          LPVOID    lpvReserved)
75   {
76 -@@ -945,8 +943,6 @@ DllMain (HINSTANCE hinstDLL,
77 +@@ -935,8 +933,6 @@ DllMain (HINSTANCE hinstDLL,
78     return TRUE;
79   }
80   
81 @@ -69,7 +66,7 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c
82  index 1111111..2222222 100644
83  --- a/glib/glib-init.c
84  +++ b/glib/glib-init.c
85 -@@ -245,14 +245,14 @@ glib_init (void)
86 +@@ -237,14 +237,14 @@ glib_init (void)
87   
88   #if defined (G_OS_WIN32)
89   
90 @@ -86,31 +83,18 @@ index 1111111..2222222 100644
91            DWORD     fdwReason,
92            LPVOID    lpvReserved)
93   {
94 -diff --git a/gobject/gtype.c b/gobject/gtype.c
95 -index 1111111..2222222 100644
96 ---- a/gobject/gtype.c
97 -+++ b/gobject/gtype.c
98 -@@ -4450,7 +4450,7 @@ gobject_init (void)
99 -   _g_signal_init ();
100 - }
101
102 --#if defined (G_OS_WIN32)
103 -+#if 0
104
105 - BOOL WINAPI DllMain (HINSTANCE hinstDLL,
106 -                      DWORD     fdwReason,
107  
108  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
109  From: Hans Petter Jansson <hpj@cl.no>
110  Date: Fri, 15 Jun 2012 15:27:22 +0200
111 -Subject: [PATCH 3/9] Allow building without inotify support
112 +Subject: [PATCH] Allow building without inotify support
113  
114  
115  diff --git a/configure.ac b/configure.ac
116  index 1111111..2222222 100644
117  --- a/configure.ac
118  +++ b/configure.ac
119 -@@ -1599,10 +1599,16 @@ dnl *****************************
120 +@@ -1659,10 +1659,16 @@ dnl *****************************
121   dnl ** Check for inotify (GIO) **
122   dnl *****************************
123   inotify_support=no
124 @@ -131,7 +115,7 @@ index 1111111..2222222 100644
125  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
126  From: Hans Petter Jansson <hpj@cl.no>
127  Date: Fri, 15 Jun 2012 15:28:14 +0200
128 -Subject: [PATCH 4/9] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
129 +Subject: [PATCH] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
130   Backported from upstream
131  
132  
133 @@ -139,7 +123,7 @@ diff --git a/configure.ac b/configure.ac
134  index 1111111..2222222 100644
135  --- a/configure.ac
136  +++ b/configure.ac
137 -@@ -511,6 +511,8 @@ LT_INIT([disable-static win32-dll])
138 +@@ -499,6 +499,8 @@ LT_INIT([disable-static win32-dll])
139   dnl when using libtool 2.x create libtool early, because it's used in configure
140   m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
141   
142 @@ -152,7 +136,7 @@ index 1111111..2222222 100644
143  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
144  From: Hans Petter Jansson <hpj@cl.no>
145  Date: Fri, 15 Jun 2012 15:29:06 +0200
146 -Subject: [PATCH 5/9] Link with dnsapi
147 +Subject: [PATCH] Link with dnsapi
148  
149  
150  diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
151 @@ -171,15 +155,15 @@ index 1111111..2222222 100644
152  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
153  From: Hans Petter Jansson <hpj@cl.no>
154  Date: Fri, 15 Jun 2012 15:29:38 +0200
155 -Subject: [PATCH 6/9] Ensure globals are initialized even when DllMain is not
156 - being run
157 +Subject: [PATCH] Ensure globals are initialized even when DllMain is not being
158 + run
159  
160  
161  diff --git a/glib/gmain.c b/glib/gmain.c
162  index 1111111..2222222 100644
163  --- a/glib/gmain.c
164  +++ b/glib/gmain.c
165 -@@ -2657,12 +2657,15 @@ g_get_real_time (void)
166 +@@ -2577,12 +2577,15 @@ g_get_real_time (void)
167   #if defined (G_OS_WIN32)
168   static ULONGLONG (*g_GetTickCount64) (void) = NULL;
169   static guint32 g_win32_tick_epoch = 0;
170 @@ -195,7 +179,7 @@ index 1111111..2222222 100644
171     g_GetTickCount64 = NULL;
172     kernel32 = GetModuleHandle ("KERNEL32.DLL");
173     if (kernel32 != NULL)
174 -@@ -2721,6 +2724,9 @@ g_get_monotonic_time (void)
175 +@@ -2641,6 +2644,9 @@ g_get_monotonic_time (void)
176      *    timeBeginPeriod() to increase it as much as they want
177      */
178   
179 @@ -535,7 +519,7 @@ index 1111111..2222222 100644
180     win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
181   }
182   
183 -@@ -1041,6 +1145,8 @@ g_thread_lookup_native_funcs (void)
184 +@@ -984,6 +1088,8 @@ g_thread_lookup_native_funcs (void)
185   void
186   g_thread_win32_init (void)
187   {
188 @@ -548,7 +532,7 @@ index 1111111..2222222 100644
189  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
190  From: Gerardo Ballabio <gerardo.ballabio@gmail.com>
191  Date: Sun, 16 Aug 2015 13:18:24 +0200
192 -Subject: [PATCH 7/9] Remove an annoying runtime warning
193 +Subject: [PATCH] Remove an annoying runtime warning
194  
195  that pops up when using GtkApplication in Gtk+ 3 programs.
196  
197 @@ -556,7 +540,7 @@ diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
198  index 1111111..2222222 100644
199  --- a/gio/gdbusaddress.c
200  +++ b/gio/gdbusaddress.c
201 -@@ -1387,6 +1387,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
202 +@@ -1325,6 +1325,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
203   __declspec(dllexport) void CALLBACK
204   g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow)
205   {
206 @@ -564,7 +548,7 @@ index 1111111..2222222 100644
207     GDBusDaemon *daemon;
208     GMainLoop *loop;
209     const char *address;
210 -@@ -1418,6 +1419,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
211 +@@ -1354,6 +1355,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
212   
213     g_main_loop_unref (loop);
214     g_object_unref (daemon);
215 @@ -576,7 +560,7 @@ index 1111111..2222222 100644
216  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
217  From: aquiles2k <aj@elane2k.com>
218  Date: Wed, 6 Apr 2016 22:39:53 +0300
219 -Subject: [PATCH 8/9] fix error "won't overwrite defined macro" on OSX
220 +Subject: [PATCH] fix error "won't overwrite defined macro" on OSX
221  
222  See https://github.com/mxe/mxe/issues/1281
223  
224 @@ -596,48 +580,22 @@ index 1111111..2222222 100644
225   dnl At the end, if we're not within glib, we'll define the public
226   dnl definitions in terms of our private definitions.
227  
228 -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
229 -From: Tony Theodore <tonyt@logyst.com>
230 -Date: Mon, 26 Feb 2018 16:09:53 +1100
231 -Subject: [PATCH 9/9] darwin: disable g_cocoa_notification_backend
232  
233 +From: Boris Pek <tehnick-8@mail.ru>
234 +Date: Thu, 28 Apr 2016 16:48:12 +0300
235 +Subject: [PATCH] fix build with GCC >= 6.x
236  
237 -diff --git a/gio/Makefile.am b/gio/Makefile.am
238 -index 1111111..2222222 100644
239 ---- a/gio/Makefile.am
240 -+++ b/gio/Makefile.am
241 -@@ -279,10 +279,6 @@ unix_sources = \
242
243 - appinfo_sources += $(unix_appinfo_sources)
244
245 --if OS_COCOA
246 --unix_sources += gcocoanotificationbackend.c
247 --endif
248 --
249 - giounixincludedir=$(includedir)/gio-unix-2.0/gio
250 - giounixinclude_HEADERS = \
251 -       gdesktopappinfo.h       \
252 -diff --git a/gio/giomodule.c b/gio/giomodule.c
253 -index 1111111..2222222 100644
254 ---- a/gio/giomodule.c
255 -+++ b/gio/giomodule.c
256 -@@ -918,9 +918,6 @@ extern GType g_proxy_resolver_portal_get_type (void);
257 - extern GType g_network_monitor_portal_get_type (void);
258 - #endif
259
260 --#ifdef HAVE_COCOA
261 --extern GType g_cocoa_notification_backend_get_type (void);
262 --#endif
263 +See plugins/gcc6/README.md
264 +
265 +diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
266 +--- a/gio/gregistrysettingsbackend.c
267 ++++ b/gio/gregistrysettingsbackend.c
268 +@@ -228,7 +228,7 @@
269 +   if (result_code == ERROR_KEY_DELETED)
270 +     trace ("(%s)", win32_message);
271 +   else
272 +-    g_message (win32_message);
273 ++    g_message ("%s", win32_message);
274 + };
275   
276 - #ifdef G_PLATFORM_WIN32
277   
278 -@@ -1117,9 +1114,6 @@ _g_io_modules_ensure_loaded (void)
279 -       g_type_ensure (g_network_monitor_portal_get_type ());
280 -       g_type_ensure (g_proxy_resolver_portal_get_type ());
281 - #endif
282 --#ifdef HAVE_COCOA
283 --      g_type_ensure (g_cocoa_notification_backend_get_type ());
284 --#endif
285 - #ifdef G_OS_WIN32
286 -       g_type_ensure (_g_winhttp_vfs_get_type ());
287 - #endif
288 diff --git a/src/glib.mk b/src/glib.mk
289 index 825b86bb..499a45b8 100644
290 --- a/src/glib.mk
291 +++ b/src/glib.mk
292 @@ -3,9 +3,9 @@
293  PKG             := glib
294  $(PKG)_WEBSITE  := https://gtk.org/
295  $(PKG)_DESCR    := GLib
296 -$(PKG)_IGNORE   :=
297 -$(PKG)_VERSION  := 2.50.2
298 -$(PKG)_CHECKSUM := be68737c1f268c05493e503b3b654d2b7f43d7d0b8c5556f7e4651b870acfbf5
299 +$(PKG)_IGNORE   := 
300 +$(PKG)_VERSION  := 2.44.1
301 +$(PKG)_CHECKSUM := 8811deacaf8a503d0a9b701777ea079ca6a4277be10e3d730d2112735d5eca07
302  $(PKG)_SUBDIR   := glib-$($(PKG)_VERSION)
303  $(PKG)_FILE     := glib-$($(PKG)_VERSION).tar.xz
304  $(PKG)_URL      := https://download.gnome.org/sources/glib/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE)
305 @@ -27,6 +27,7 @@ define $(PKG)_BUILD_DARWIN
306      cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
307          $(MXE_CONFIGURE_OPTS) \
308          --enable-regex \
309 +       --disable-compile-warnings \
310          --disable-threads \
311          --disable-selinux \
312          --disable-inotify \
313 @@ -55,6 +56,7 @@ define $(PKG)_BUILD_NATIVE
314      cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
315      cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
316          $(MXE_CONFIGURE_OPTS) \
317 +       --disable-compile-warnings \
318          --enable-regex \
319          --disable-threads \
320          --disable-selinux \
321 @@ -97,6 +99,7 @@ define $(PKG)_BUILD
322      cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh
323      cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
324          $(MXE_CONFIGURE_OPTS) \
325 +       --disable-compile-warnings \
326          --with-threads=win32 \
327          --with-pcre=system \
328          --with-libiconv=gnu \