]> sigrok.org Git - sigrok-util.git/blobdiff - cross-compile/mingw/mxe_fixes.patch
sigrok-cross-mingw: Update MXE patch for libusb1.
[sigrok-util.git] / cross-compile / mingw / mxe_fixes.patch
index 798bf981716a57ffc475f5dbb286265bc35e9f3d..0b7700da082e89b9c40d5eaae6c41cb63e77fa6a 100644 (file)
@@ -3,26 +3,29 @@ MXE setup for sigrok usage.
 
  - libsigrok currently requires a special libusb branch.
 
- - Force libzip to use its own mkstemp() implementation.
-   http://sigrok.org/bugzilla/show_bug.cgi?id=570#c2
-
  - We're reverting to glib 2.44.1 for now since more recent
    versions (e.g. 2.50.2) seem to have a bug. Details:
    https://sigrok.org/bugzilla/show_bug.cgi?id=1232
    https://github.com/mxe/mxe/issues/2168
 
+ - We're patching glib to fix various MinGW compiler warnings. Details:
+   https://sigrok.org/bugzilla/show_bug.cgi?id=986
+   https://gitlab.gnome.org/GNOME/glib/commit/3d7cde654c4c6f3bdad32f5521f28f5802a7c377
+
 diff --git a/src/libusb1.mk b/src/libusb1.mk
-index 0b58dff3..281a1169 100644
+index ab01bf69..53aed36e 100644
 --- a/src/libusb1.mk
 +++ b/src/libusb1.mk
-@@ -5,10 +5,10 @@ $(PKG)_WEBSITE  := http://libusb.org/
+@@ -4,11 +4,11 @@ PKG             := libusb1
+ $(PKG)_WEBSITE  := https://libusb.info/
  $(PKG)_DESCR    := LibUsb-1.0
  $(PKG)_IGNORE   :=
- $(PKG)_VERSION  := 1.0.21
--$(PKG)_CHECKSUM := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b
+-$(PKG)_VERSION  := 1.0.23
+-$(PKG)_CHECKSUM := 4fc17b2ef3502757641bf8fe2c14ad86ec86302a2b785abcb0806fd03aa1201f
 -$(PKG)_SUBDIR   := libusb-$($(PKG)_VERSION)
 -$(PKG)_FILE     := libusb-$($(PKG)_VERSION).tar.bz2
 -$(PKG)_URL      := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE)
++$(PKG)_VERSION  := 1.0.20-rc3-event-abstraction-v4
 +$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
 +$(PKG)_SUBDIR   := libusb-event-abstraction-v4
 +$(PKG)_FILE     := libusb-event-abstraction-v4.zip
@@ -39,29 +42,15 @@ index 0b58dff3..281a1169 100644
          $(MXE_CONFIGURE_OPTS) \
          CFLAGS=-D_WIN32_WINNT=0x0500
      $(MAKE) -C '$(1)' -j '$(JOBS)' install
-diff --git a/src/libzip.mk b/src/libzip.mk
-index 28ea792c..ee1bcfbe 100644
---- a/src/libzip.mk
-+++ b/src/libzip.mk
-@@ -18,7 +18,8 @@ endef
- define $(PKG)_BUILD
-     cd '$(1)' && ./configure \
--        $(MXE_CONFIGURE_OPTS)
-+        $(MXE_CONFIGURE_OPTS) \
-+        ac_cv_func_mkstemp=no
-     $(MAKE) -C '$(1)' -j '$(JOBS)' install $(MXE_DISABLE_CRUFT) SUBDIRS=lib
-     '$(TARGET)-gcc' \
 diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch
-index 021a5cac..428cc6a9 100644
+index 764ece9e..428cc6a9 100644
 --- a/src/glib-1-fixes.patch
 +++ b/src/glib-1-fixes.patch
 @@ -5,7 +5,7 @@ Contains ad hoc patches for cross building.
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Mark Brand <mabrand@mabrand.nl>
  Date: Thu, 23 Sep 2010 21:42:46 +0200
--Subject: [PATCH 1/9] fix tool paths
+-Subject: [PATCH 01/10] fix tool paths
 +Subject: [PATCH] fix tool paths
  
  
@@ -70,7 +59,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Hans Petter Jansson <hpj@cl.no>
  Date: Fri, 15 Jun 2012 15:25:01 +0200
--Subject: [PATCH 2/9] Avoid DllMain symbol conflict when linking statically
+-Subject: [PATCH 02/10] Avoid DllMain symbol conflict when linking statically
 +Subject: [PATCH] Avoid DllMain symbol conflict when linking statically
  
 -Adjusted by Boris Nagaev on 29-Jan-2017 to fix
@@ -125,7 +114,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Hans Petter Jansson <hpj@cl.no>
  Date: Fri, 15 Jun 2012 15:27:22 +0200
--Subject: [PATCH 3/9] Allow building without inotify support
+-Subject: [PATCH 03/10] Allow building without inotify support
 +Subject: [PATCH] Allow building without inotify support
  
  
@@ -142,7 +131,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Hans Petter Jansson <hpj@cl.no>
  Date: Fri, 15 Jun 2012 15:28:14 +0200
--Subject: [PATCH 4/9] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
+-Subject: [PATCH 04/10] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
 +Subject: [PATCH] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
   Backported from upstream
  
@@ -160,7 +149,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Hans Petter Jansson <hpj@cl.no>
  Date: Fri, 15 Jun 2012 15:29:06 +0200
--Subject: [PATCH 5/9] Link with dnsapi
+-Subject: [PATCH 05/10] Link with dnsapi
 +Subject: [PATCH] Link with dnsapi
  
  
@@ -169,7 +158,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Hans Petter Jansson <hpj@cl.no>
  Date: Fri, 15 Jun 2012 15:29:38 +0200
--Subject: [PATCH 6/9] Ensure globals are initialized even when DllMain is not
+-Subject: [PATCH 06/10] Ensure globals are initialized even when DllMain is not
 - being run
 +Subject: [PATCH] Ensure globals are initialized even when DllMain is not being
 + run
@@ -206,7 +195,7 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Gerardo Ballabio <gerardo.ballabio@gmail.com>
  Date: Sun, 16 Aug 2015 13:18:24 +0200
--Subject: [PATCH 7/9] Remove an annoying runtime warning
+-Subject: [PATCH 07/10] Remove an annoying runtime warning
 +Subject: [PATCH] Remove an annoying runtime warning
  
  that pops up when using GtkApplication in Gtk+ 3 programs.
@@ -233,19 +222,19 @@ index 021a5cac..428cc6a9 100644
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: aquiles2k <aj@elane2k.com>
  Date: Wed, 6 Apr 2016 22:39:53 +0300
--Subject: [PATCH 8/9] fix error "won't overwrite defined macro" on OSX
+-Subject: [PATCH 08/10] fix error "won't overwrite defined macro" on OSX
 +Subject: [PATCH] fix error "won't overwrite defined macro" on OSX
  
  See https://github.com/mxe/mxe/issues/1281
  
-@@ -596,48 +580,22 @@ index 1111111..2222222 100644
+@@ -596,110 +580,22 @@ index 1111111..2222222 100644
   dnl At the end, if we're not within glib, we'll define the public
   dnl definitions in terms of our private definitions.
  
 -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 -From: Tony Theodore <tonyt@logyst.com>
 -Date: Mon, 26 Feb 2018 16:09:53 +1100
--Subject: [PATCH 9/9] darwin: disable g_cocoa_notification_backend
+-Subject: [PATCH 09/10] darwin: disable g_cocoa_notification_backend
  
 +From: Boris Pek <tehnick-8@mail.ru>
 +Date: Thu, 28 Apr 2016 16:48:12 +0300
@@ -302,6 +291,151 @@ index 021a5cac..428cc6a9 100644
 - #ifdef G_OS_WIN32
 -       g_type_ensure (_g_winhttp_vfs_get_type ());
 - #endif
+-
+-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+-From: Ernestas Kulik <ekulik@redhat.com>
+-Date: Tue, 29 Jan 2019 09:50:46 +0100
+-Subject: [PATCH 10/10] gdbus: Avoid printing null strings
+-
+-This mostly affects the 2.56 branch, but, given that GCC 9 is being
+-stricter about passing null string pointers to printf-like functions, it
+-might make sense to proactively fix such calls.
+-
+-gdbusauth.c: In function '_g_dbus_auth_run_server':
+-gdbusauth.c:1302:11: error: '%s' directive argument is null
+-[-Werror=format-overflow=]
+- 1302 |           debug_print ("SERVER: WaitingForBegin, read '%s'",
+- line);
+-       |
+-
+-gdbusmessage.c: In function ‘g_dbus_message_to_blob’:
+-gdbusmessage.c:2730:30: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
+- 2730 |       tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
+-      |
+-
+-diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c
+-index 1111111..2222222 100644
+---- a/gio/gdbusauth.c
+-+++ b/gio/gdbusauth.c
+-@@ -1295,9 +1295,9 @@ _g_dbus_auth_run_server (GDBusAuth              *auth,
+-                                                     &line_length,
+-                                                     cancellable,
+-                                                     error);
+--          debug_print ("SERVER: WaitingForBegin, read '%s'", line);
+-           if (line == NULL)
+-             goto out;
+-+          debug_print ("SERVER: WaitingForBegin, read '%s'", line);
+-           if (g_strcmp0 (line, "BEGIN") == 0)
+-             {
+-               /* YAY, done! */
+-diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
+-index 1111111..2222222 100644
+---- a/gio/gdbusmessage.c
+-+++ b/gio/gdbusmessage.c
+-@@ -2695,7 +2695,6 @@ g_dbus_message_to_blob (GDBusMessage          *message,
+-   if (message->body != NULL)
+-     {
+-       gchar *tupled_signature_str;
+--      tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
+-       if (signature == NULL)
+-         {
+-           g_set_error (error,
+-@@ -2703,10 +2702,10 @@ g_dbus_message_to_blob (GDBusMessage          *message,
+-                        G_IO_ERROR_INVALID_ARGUMENT,
+-                        _("Message body has signature '%s' but there is no signature header"),
+-                        signature_str);
+--          g_free (tupled_signature_str);
+-           goto out;
+-         }
+--      else if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
+-+      tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
+-+      if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
+-         {
+-           g_set_error (error,
+-                        G_IO_ERROR,
+diff --git a/src/glib-2-format.patch b/src/glib-2-format.patch
+new file mode 100644
+index 00000000..3d594af0
+--- /dev/null
++++ b/src/glib-2-format.patch
+@@ -0,0 +1,77 @@
++--- a/configure.ac.orig       2018-10-03 16:23:45.065890113 +0200
+++++ b/configure.ac    2018-10-03 16:28:04.378188119 +0200
++@@ -562,7 +562,7 @@ AS_IF([test x$glib_native_win32 != xyes
++      # long long is a 64 bit integer.
++      AC_MSG_CHECKING(for format to printf and scanf a guint64)
++      AC_CACHE_VAL(glib_cv_long_long_format,[
++-             for format in ll q I64; do
+++             for format in ll q; do
++                AC_TRY_RUN([#include <stdio.h>  
++                      int main()
++                      {
++@@ -588,7 +588,7 @@ AS_IF([test x$glib_native_win32 != xyes
++      # __int64 is a 64 bit integer.
++      AC_MSG_CHECKING(for format to printf and scanf a guint64)
++      # We know this is MSVCRT.DLL, and what the formats are
++-     glib_cv_long_long_format=I64
+++     glib_cv_long_long_format=ll
++      AC_MSG_RESULT(%${glib_cv_long_long_format}u)
++         AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
++      AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
++@@ -3176,8 +3176,8 @@ $ac_cv_sizeof___int64)
++     guint64_format='"'$glib_cv_long_long_format'u"'
++   fi
++   glib_extension=
++-  gint64_constant='(val##i64)'
++-  guint64_constant='(val##ui64)'
+++  gint64_constant='(val##ll)'
+++  guint64_constant='(val##ull)'
++   ;;
++ esac
++ glib_size_t=$ac_cv_sizeof_size_t
++@@ -3204,8 +3204,8 @@ long)
++   glib_msize_type='LONG'
++   ;;
++ "long long"|__int64)
++-  gsize_modifier='"I64"'
++-  gsize_format='"I64u"'
+++  gsize_modifier='"ll"'
+++  gsize_format='"llu"'
++   glib_msize_type='INT64'
++   ;;
++ esac
++@@ -3227,8 +3227,8 @@ long)
++   glib_mssize_type='LONG'
++   ;;
++ "long long"|__int64)
++-  gssize_modifier='"I64"'
++-  gssize_format='"I64i"'
+++  gssize_modifier='"ll"'
+++  gssize_format='"lli"'
++   glib_mssize_type='INT64'
++   ;;
++ esac
++@@ -3257,17 +3257,17 @@ $ac_cv_sizeof_long)
++   ;;
++ $ac_cv_sizeof_long_long)
++   glib_intptr_type_define='long long'
++-  gintptr_modifier='"I64"'
++-  gintptr_format='"I64i"'
++-  guintptr_format='"I64u"'
+++  gintptr_modifier='"ll"'
+++  gintptr_format='"lli"'
+++  guintptr_format='"llu"'
++   glib_gpi_cast='(gint64)'
++   glib_gpui_cast='(guint64)'
++   ;;
++ $ac_cv_sizeof___int64)
++   glib_intptr_type_define=__int64
++-  gintptr_modifier='"I64"'
++-  gintptr_format='"I64i"'
++-  guintptr_format='"I64u"'
+++  gintptr_modifier='"ll"'
+++  gintptr_format='"lli"'
+++  guintptr_format='"llu"'
++   glib_gpi_cast='(gint64)'
++   glib_gpui_cast='(guint64)'
++   ;;
 diff --git a/src/glib.mk b/src/glib.mk
 index 825b86bb..499a45b8 100644
 --- a/src/glib.mk