This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:43:43 +0200
Subject: [PATCH 01/12] s,DllMain,static _disabled_DllMain,


diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index 1111111..2222222 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -65,7 +65,7 @@ const GOptionEntry _gdk_windowing_args[] = {
 };
 
 int __stdcall
-DllMain (HINSTANCE hinstDLL,
+gdk_DllMain (HINSTANCE hinstDLL,
 	 DWORD     dwReason,
 	 LPVOID    reserved)
 {
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 1111111..2222222 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -74,7 +74,7 @@
 static HMODULE gtk_dll;
 
 BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
+gtk_DllMain (HINSTANCE hinstDLL,
 	 DWORD     fdwReason,
 	 LPVOID    lpvReserved)
 {

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:46:20 +0200
Subject: [PATCH 02/12] s,__declspec(dllimport),,


diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 1111111..2222222 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -41,7 +41,7 @@
 #  ifdef GDK_COMPILATION
 #    define GDKVAR __declspec(dllexport)
 #  else
-#    define GDKVAR extern __declspec(dllimport)
+#    define GDKVAR extern 
 #  endif
 #else
 #  define GDKVAR extern
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 1111111..2222222 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -66,7 +66,7 @@ typedef enum {
 #  ifdef GTK_COMPILATION
 #    define GTKVAR __declspec(dllexport)
 #  else
-#    define GTKVAR extern __declspec(dllimport)
+#    define GTKVAR extern 
 #  endif
 #else
 #  define GTKVAR extern
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 1111111..2222222 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -69,7 +69,7 @@ typedef gint	(*GtkKeySnoopFunc)	    (GtkWidget	  *grab_widget,
 #ifdef GTK_COMPILATION
 #define GTKMAIN_C_VAR __declspec(dllexport)
 #else
-#define GTKMAIN_C_VAR extern __declspec(dllimport)
+#define GTKMAIN_C_VAR extern 
 #endif
 #else
 #define GTKMAIN_C_VAR extern
diff --git a/gtk/gtktexttypes.h b/gtk/gtktexttypes.h
index 1111111..2222222 100644
--- a/gtk/gtktexttypes.h
+++ b/gtk/gtktexttypes.h
@@ -46,7 +46,7 @@ typedef struct _GtkTextMarkBody GtkTextMarkBody;
 #ifdef GTK_COMPILATION
 #define VARIABLE __declspec(dllexport)
 #else
-#define VARIABLE extern __declspec(dllimport)
+#define VARIABLE extern 
 #endif
 #else
 #define VARIABLE extern

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 15:03:28 +0200
Subject: [PATCH 03/12] s,__declspec(dllexport),,


diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 1111111..2222222 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -39,7 +39,7 @@
 
 #ifdef G_OS_WIN32
 #  ifdef GDK_COMPILATION
-#    define GDKVAR __declspec(dllexport)
+#    define GDKVAR 
 #  else
 #    define GDKVAR extern 
 #  endif
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 1111111..2222222 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -64,7 +64,7 @@ typedef enum {
 
 #ifdef G_OS_WIN32
 #  ifdef GTK_COMPILATION
-#    define GTKVAR __declspec(dllexport)
+#    define GTKVAR 
 #  else
 #    define GTKVAR extern 
 #  endif
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 1111111..2222222 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -67,7 +67,7 @@ typedef gint	(*GtkKeySnoopFunc)	    (GtkWidget	  *grab_widget,
  */
 #ifdef G_PLATFORM_WIN32
 #ifdef GTK_COMPILATION
-#define GTKMAIN_C_VAR __declspec(dllexport)
+#define GTKMAIN_C_VAR 
 #else
 #define GTKMAIN_C_VAR extern 
 #endif
diff --git a/gtk/gtktexttypes.h b/gtk/gtktexttypes.h
index 1111111..2222222 100644
--- a/gtk/gtktexttypes.h
+++ b/gtk/gtktexttypes.h
@@ -44,7 +44,7 @@ typedef struct _GtkTextMarkBody GtkTextMarkBody;
 
 #ifdef G_OS_WIN32
 #ifdef GTK_COMPILATION
-#define VARIABLE __declspec(dllexport)
+#define VARIABLE 
 #else
 #define VARIABLE extern 
 #endif

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:17:22 +0200
Subject: [PATCH 04/12] fix gtk+-2.0.pc.in


diff --git a/gtk+-2.0.pc.in b/gtk+-2.0.pc.in
index 1111111..2222222 100644
--- a/gtk+-2.0.pc.in
+++ b/gtk+-2.0.pc.in
@@ -11,5 +11,5 @@ Name: GTK+
 Description: GTK+ Graphical UI Library (${target} target)
 Version: @VERSION@
 Requires: gdk-${target}-2.0 @GTK_PACKAGES@
-Libs: -L${libdir} -lgtk-${target}-@GTK_API_VERSION@ @GTK_EXTRA_LIBS@
+Libs: -L${libdir} -lgtk-${target}-@GTK_API_VERSION@ @GTK_DEP_LIBS@ -lwinspool -lcomctl32 -lcomdlg32
 Cflags: -I${includedir}/gtk-2.0 @GTK_EXTRA_CFLAGS@

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:48:31 +0200
Subject: [PATCH 05/12] disable gtkbuiltincache


diff --git a/gtk/Makefile.in b/gtk/Makefile.in
index 1111111..2222222 100644
--- a/gtk/Makefile.in
+++ b/gtk/Makefile.in
@@ -5713,7 +5713,7 @@ stamp-icons: $(STOCK_ICONS)
 	) done 								\
 	&& touch stamp-icons
 
-gtkbuiltincache.h: @REBUILD@ stamp-icons
+_disabled_gtkbuiltincache.h: @REBUILD@ stamp-icons
 	$(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT)
 	$(gtk_update_icon_cache_program) --force --ignore-theme-index		\
 	   --include-image-data							\

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:49:50 +0200
Subject: [PATCH 06/12] disable test-inline-pixbufs.h


diff --git a/demos/Makefile.in b/demos/Makefile.in
index 1111111..2222222 100644
--- a/demos/Makefile.in
+++ b/demos/Makefile.in
@@ -529,7 +529,7 @@ LDADDS = \
 	$(GTK_DEP_LIBS)							\
 	$(MATH_LIB)
 
-BUILT_SOURCES = test-inline-pixbufs.h
+BUILT_SOURCES = 
 testpixbuf_DEPENDENCIES = $(DEPS)
 testpixbuf_drawable_DEPENDENCIES = $(DEPS)
 testpixbuf_save_DEPENDENCIES = $(DEPS)

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:51:04 +0200
Subject: [PATCH 07/12] permit static building


diff --git a/configure b/configure
index 1111111..2222222 100755
--- a/configure
+++ b/configure
@@ -4649,9 +4649,9 @@ if test "${enable_static+set}" = set; then :
   enableval=$enable_static; p=${PACKAGE-default}
     case $enableval in
     yes) enable_static=yes ;;
-    no) enable_static=no ;;
+    no) enable_static=yes ;;
     *)
-     enable_static=no
+     enable_static=yes
       # Look at the argument we got.  We use all the common list separators.
       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
@@ -4664,7 +4664,7 @@ if test "${enable_static+set}" = set; then :
       ;;
     esac
 else
-  enable_static=no
+  enable_static=yes
 fi
 
 
@@ -5233,15 +5233,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 if test "$os_win32" = "yes"; then
   if test x$enable_static = xyes -o x$enable_static = x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling static library build, must build as DLL on Windows." >&5
-$as_echo "$as_me: WARNING: Disabling static library build, must build as DLL on Windows." >&2;}
-    enable_static=no
+    { $as_echo "(disabled warning)" >&5
+$as_echo "(disabled warning)" >&2;}
+    enable_static=yes
   fi
   if test x$enable_shared = xno; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Enabling shared library build, must build as DLL on Windows." >&5
-$as_echo "$as_me: WARNING: Enabling shared library build, must build as DLL on Windows." >&2;}
+    { $as_echo "(disabled warning)" >&5
+$as_echo "(disabled warning)" >&2;}
   fi
-  enable_shared=yes
+  enable_shared=no
 fi
 
 enable_win32_dll=yes
@@ -9265,7 +9265,7 @@ func_stripname_cnf ()
 if test "${enable_shared+set}" = set; then :
   enableval=$enable_shared; p=${PACKAGE-default}
     case $enableval in
-    yes) enable_shared=yes ;;
+    yes) enable_shared=no ;;
     no) enable_shared=no ;;
     *)
       enable_shared=no
@@ -9274,14 +9274,14 @@ if test "${enable_shared+set}" = set; then :
       for pkg in $enableval; do
 	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
+	  enable_shared=no
 	fi
       done
       IFS=$lt_save_ifs
       ;;
     esac
 else
-  enable_shared=yes
+  enable_shared=no
 fi
 
 
@@ -13455,7 +13455,7 @@ $as_echo_n "checking whether to build shared libraries... " >&6; }
   # are all built from PIC.
   case $host_os in
   aix3*)
-    test yes = "$enable_shared" && enable_static=no
+    test yes = "$enable_shared" && enable_static=yes
     if test -n "$RANLIB"; then
       archive_cmds="$archive_cmds~\$RANLIB \$lib"
       postinstall_cmds='$RANLIB $lib'
@@ -13467,7 +13467,7 @@ $as_echo_n "checking whether to build shared libraries... " >&6; }
       case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
       yes,aix,yes) ;;			# shared object as lib.so file only
       yes,svr4,*) ;;			# shared object as lib.so archive member only
-      yes,*) enable_static=no ;;	# shared object in lib.a archive as well
+      yes,*) enable_static=yes ;;	# shared object in lib.a archive as well
       esac
     fi
     ;;

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:53:18 +0200
Subject: [PATCH 08/12] no -Wl


diff --git a/configure b/configure
index 1111111..2222222 100755
--- a/configure
+++ b/configure
@@ -24018,7 +24018,7 @@ fi
 fi
 
 if test "x$gdktarget" = "xwin32"; then
-  GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
+  GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -luuid"
    if true; then
   USE_WIN32_TRUE=
   USE_WIN32_FALSE='#'

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 14:54:15 +0200
Subject: [PATCH 09/12] gio not gio-unix


diff --git a/configure b/configure
index 1111111..2222222 100755
--- a/configure
+++ b/configure
@@ -24250,9 +24250,9 @@ fi
 CFLAGS="$saved_cflags"
 LDFLAGS="$saved_ldflags"
 
-# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c
+# Pull in gio for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c
 if test "x$gdktarget" = "xx11"; then
-  GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend"
+  GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend"
 else
   GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 gdk-pixbuf-2.0 cairo-$cairo_backend"
 fi

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Fri, 24 Sep 2010 15:30:49 +0200
Subject: [PATCH 10/12] removed duplicate _gtk_marshal_OBJECT__VOID()


diff --git a/perf/marshalers.c b/perf/marshalers.c
index 1111111..2222222 100644
--- a/perf/marshalers.c
+++ b/perf/marshalers.c
@@ -49,43 +49,6 @@
 #endif /* !G_ENABLE_DEBUG */
 
 
-/* OBJECT:VOID (./marshalers.list:1) */
-void
-_gtk_marshal_OBJECT__VOID (GClosure     *closure,
-                           GValue       *return_value G_GNUC_UNUSED,
-                           guint         n_param_values,
-                           const GValue *param_values,
-                           gpointer      invocation_hint G_GNUC_UNUSED,
-                           gpointer      marshal_data)
-{
-  typedef GObject* (*GMarshalFunc_OBJECT__VOID) (gpointer     data1,
-                                                 gpointer     data2);
-  GMarshalFunc_OBJECT__VOID callback;
-  GCClosure *cc = (GCClosure*) closure;
-  gpointer data1, data2;
-  GObject* v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 1);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_OBJECT__VOID) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       data2);
-
-  g_value_take_object (return_value, v_return);
-}
-
 /* VOID:ENUM,OBJECT,DOUBLE (./marshalers.list:2) */
 void
 _gtk_marshal_VOID__ENUM_OBJECT_DOUBLE (GClosure     *closure,

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 28 May 2020 18:22:19 +0200
Subject: [PATCH 11/12] gcc 10 compatibility: add missing "extern"

Related to:
    Default to -fno-common
    https://gcc.gnu.org/gcc-10/porting_to.html

diff --git a/gdk/gdk.h b/gdk/gdk.h
index 1111111..2222222 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -186,11 +186,11 @@ void gdk_notify_startup_complete_with_id (const gchar* startup_id);
  */
 
 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
-GDKVAR GMutex *gdk_threads_mutex; /* private */
+extern GMutex *gdk_threads_mutex; /* private */
 #endif
 
-GDKVAR GCallback gdk_threads_lock;
-GDKVAR GCallback gdk_threads_unlock;
+extern GCallback gdk_threads_lock;
+extern GCallback gdk_threads_unlock;
 
 void     gdk_threads_enter                    (void);
 void     gdk_threads_leave                    (void);
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 1111111..2222222 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -62,17 +62,7 @@ typedef enum {
 
 #endif /* G_ENABLE_DEBUG */
 
-#ifdef G_OS_WIN32
-#  ifdef GTK_COMPILATION
-#    define GTKVAR 
-#  else
-#    define GTKVAR extern 
-#  endif
-#else
-#  define GTKVAR extern
-#endif
-
-GTKVAR guint gtk_debug_flags;
+extern guint gtk_debug_flags;
 
 G_END_DECLS
 
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 1111111..2222222 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -65,21 +65,12 @@ typedef gint	(*GtkKeySnoopFunc)	    (GtkWidget	  *grab_widget,
 
 /* Gtk version.
  */
-#ifdef G_PLATFORM_WIN32
-#ifdef GTK_COMPILATION
-#define GTKMAIN_C_VAR 
-#else
-#define GTKMAIN_C_VAR extern 
-#endif
-#else
-#define GTKMAIN_C_VAR extern
-#endif
 
-GTKMAIN_C_VAR const guint gtk_major_version;
-GTKMAIN_C_VAR const guint gtk_minor_version;
-GTKMAIN_C_VAR const guint gtk_micro_version;
-GTKMAIN_C_VAR const guint gtk_binary_age;
-GTKMAIN_C_VAR const guint gtk_interface_age;
+extern const guint gtk_major_version;
+extern const guint gtk_minor_version;
+extern const guint gtk_micro_version;
+extern const guint gtk_binary_age;
+extern const guint gtk_interface_age;
 const gchar* gtk_check_version (guint	required_major,
 			        guint	required_minor,
 			        guint	required_micro);
diff --git a/gtk/gtktexttypes.h b/gtk/gtktexttypes.h
index 1111111..2222222 100644
--- a/gtk/gtktexttypes.h
+++ b/gtk/gtktexttypes.h
@@ -42,16 +42,6 @@ typedef struct _GtkTextMarkBody GtkTextMarkBody;
  * Declarations for variables shared among the text-related files:
  */
 
-#ifdef G_OS_WIN32
-#ifdef GTK_COMPILATION
-#define VARIABLE 
-#else
-#define VARIABLE extern 
-#endif
-#else
-#define VARIABLE extern
-#endif
-
 /* In gtktextbtree.c */
 extern const GtkTextLineSegmentClass gtk_text_char_type;
 extern const GtkTextLineSegmentClass gtk_text_toggle_on_type;
@@ -70,7 +60,7 @@ extern const GtkTextLineSegmentClass gtk_text_child_type;
  */
 
 #define GTK_TEXT_UNKNOWN_CHAR 0xFFFC
-VARIABLE const gchar gtk_text_unknown_char_utf8[];
+extern const gchar gtk_text_unknown_char_utf8[];
 
 gboolean gtk_text_byte_begins_utf8_char (const gchar *byte);
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 28 May 2020 19:45:12 +0200
Subject: [PATCH 12/12] remove unnecessary parentheses

..which break build of gtkmm2 using gcc 10.

diff --git a/gtk/gtkfilechooserbutton.h b/gtk/gtkfilechooserbutton.h
index 1111111..2222222 100644
--- a/gtk/gtkfilechooserbutton.h
+++ b/gtk/gtkfilechooserbutton.h
@@ -56,13 +56,13 @@ struct _GtkFileChooserButtonClass
 
   void (* file_set) (GtkFileChooserButton *fc);
 
-  void (*__gtk_reserved1);
-  void (*__gtk_reserved2);
-  void (*__gtk_reserved3);
-  void (*__gtk_reserved4);
-  void (*__gtk_reserved5);
-  void (*__gtk_reserved6);
-  void (*__gtk_reserved7);
+  void *__gtk_reserved1;
+  void *__gtk_reserved2;
+  void *__gtk_reserved3;
+  void *__gtk_reserved4;
+  void *__gtk_reserved5;
+  void *__gtk_reserved6;
+  void *__gtk_reserved7;
 };
 
 
diff --git a/gtk/gtkstatusicon.h b/gtk/gtkstatusicon.h
index 1111111..2222222 100644
--- a/gtk/gtkstatusicon.h
+++ b/gtk/gtkstatusicon.h
@@ -73,8 +73,8 @@ struct _GtkStatusIconClass
                                      gboolean        keyboard_mode,
                                      GtkTooltip     *tooltip);
 
-  void (*__gtk_reserved1);
-  void (*__gtk_reserved2);
+  void *__gtk_reserved1;
+  void *__gtk_reserved2;
 };
 
 GType                 gtk_status_icon_get_type           (void) G_GNUC_CONST;
