mxe/src/glib-1-fixes.patch

560 lines
13 KiB
Diff
Raw Normal View History

2012-03-28 14:46:58 +01:00
This file is part of MXE.
2012-03-29 11:14:15 +01:00
See index.html for further information.
Contains ad hoc patches for cross building.
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Thu, 23 Sep 2010 21:42:46 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] fix tool paths
2014-10-27 10:05:45 +00:00
diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/glib-2.0.pc.in
+++ b/glib-2.0.pc.in
@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-glib_genmarshal=glib-genmarshal
-gobject_query=gobject-query
-glib_mkenums=glib-mkenums
+glib_genmarshal=@bindir@/glib-genmarshal
+gobject_query=@bindir@/gobject-query
+glib_mkenums=@bindir@/glib-mkenums
Name: GLib
Description: C Utility Library
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
2012-06-15 14:41:53 +01:00
Date: Fri, 15 Jun 2012 15:25:01 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] Avoid DllMain symbol conflict when linking statically
2012-06-15 14:41:53 +01:00
2014-10-27 10:05:45 +00:00
diff --git a/gio/giomodule.c b/gio/giomodule.c
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
2016-04-06 20:31:53 +01:00
@@ -918,14 +918,12 @@ extern GType g_gtk_notification_backend_get_type (void);
2012-06-15 14:41:53 +01:00
static HMODULE gio_dll = NULL;
-#ifdef DLL_EXPORT
-
2013-06-29 13:41:43 +01:00
-BOOL WINAPI DllMain (HINSTANCE hinstDLL,
+BOOL WINAPI gio_DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved);
2012-06-15 14:41:53 +01:00
BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
+gio_DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
2016-04-06 20:31:53 +01:00
@@ -935,8 +933,6 @@ DllMain (HINSTANCE hinstDLL,
2013-06-29 13:41:43 +01:00
return TRUE;
2012-06-15 14:41:53 +01:00
}
-#endif
-
2013-06-29 13:41:43 +01:00
void *
_g_io_win32_get_module (void)
{
2014-10-27 10:05:45 +00:00
diff --git a/glib/glib-init.c b/glib/glib-init.c
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -237,14 +237,14 @@ glib_init (void)
2013-06-29 13:41:43 +01:00
#if defined (G_OS_WIN32)
-BOOL WINAPI DllMain (HINSTANCE hinstDLL,
+BOOL WINAPI glib_DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved);
2012-06-15 14:41:53 +01:00
HMODULE glib_dll;
BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
+glib_DllMain (HINSTANCE hinstDLL,
2013-06-29 13:41:43 +01:00
DWORD fdwReason,
LPVOID lpvReserved)
2012-06-15 14:41:53 +01:00
{
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
2012-06-15 14:41:53 +01:00
Date: Fri, 15 Jun 2012 15:27:22 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] Allow building without inotify support
2012-06-15 14:41:53 +01:00
2014-10-27 10:05:45 +00:00
diff --git a/configure.ac b/configure.ac
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/configure.ac
+++ b/configure.ac
2016-04-06 20:31:53 +01:00
@@ -1659,10 +1659,16 @@ dnl *****************************
2012-06-15 14:41:53 +01:00
dnl ** Check for inotify (GIO) **
dnl *****************************
inotify_support=no
2014-08-09 19:07:35 +01:00
+ AC_ARG_ENABLE(inotify,
+ AC_HELP_STRING([--disable-inotify],
+ [build without inotify support]))
2012-06-15 14:41:53 +01:00
+
2014-08-09 19:07:35 +01:00
+ if test "x$enable_inotify" != "xno"; then
AC_CHECK_HEADERS([sys/inotify.h],
[
AC_CHECK_FUNCS(inotify_init1, [inotify_support=yes], [inotify_support=no])
])
2012-06-15 14:41:53 +01:00
+fi
AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
2014-10-27 10:05:45 +00:00
2012-06-15 14:41:53 +01:00
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
2012-06-15 14:41:53 +01:00
Date: Fri, 15 Jun 2012 15:28:14 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
2012-06-15 14:41:53 +01:00
Backported from upstream
2014-10-27 10:05:45 +00:00
diff --git a/configure.ac b/configure.ac
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/configure.ac
+++ b/configure.ac
@@ -499,6 +499,8 @@ LT_INIT([disable-static win32-dll])
dnl when using libtool 2.x create libtool early, because it's used in configure
m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
2012-06-15 14:41:53 +01:00
+# Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF
+AS_IF([false], [AC_CHECK_HEADER([stdint.h])])
2014-10-27 10:05:45 +00:00
AS_IF([test "$glib_native_win32" = "yes"], [
if test x$enable_static = xyes -a x$enable_shared = xyes; then
2012-06-15 14:41:53 +01:00
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
2012-06-15 14:41:53 +01:00
Date: Fri, 15 Jun 2012 15:29:06 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] Link with dnsapi
2012-06-15 14:41:53 +01:00
2014-10-27 10:05:45 +00:00
diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/gio-2.0.pc.in
+++ b/gio-2.0.pc.in
@@ -13,6 +13,6 @@ Description: glib I/O library
2012-06-15 14:41:53 +01:00
Version: @VERSION@
Requires: glib-2.0 gobject-2.0
Requires.private: gmodule-no-export-2.0
-Libs: -L${libdir} -lgio-2.0
+Libs: -L${libdir} -lgio-2.0 -ldnsapi -liphlpapi
2014-08-09 19:07:35 +01:00
Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@
2012-06-15 14:41:53 +01:00
Cflags:
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
2012-06-15 14:41:53 +01:00
Date: Fri, 15 Jun 2012 15:29:38 +0200
2016-04-06 20:31:53 +01:00
Subject: [PATCH] Ensure globals are initialized even when DllMain is not being
run
2012-06-15 14:41:53 +01:00
2014-10-27 10:05:45 +00:00
diff --git a/glib/gmain.c b/glib/gmain.c
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/glib/gmain.c
+++ b/glib/gmain.c
2016-04-06 20:31:53 +01:00
@@ -2577,12 +2577,15 @@ g_get_real_time (void)
2014-10-27 10:05:45 +00:00
#if defined (G_OS_WIN32)
2012-06-15 14:41:53 +01:00
static ULONGLONG (*g_GetTickCount64) (void) = NULL;
static guint32 g_win32_tick_epoch = 0;
+static gboolean g_win32_clock_is_initialized;
2013-06-29 13:41:43 +01:00
void
2012-06-15 14:41:53 +01:00
g_clock_win32_init (void)
{
HMODULE kernel32;
+ g_win32_clock_is_initialized = TRUE;
+
g_GetTickCount64 = NULL;
kernel32 = GetModuleHandle ("KERNEL32.DLL");
if (kernel32 != NULL)
2016-04-06 20:31:53 +01:00
@@ -2641,6 +2644,9 @@ g_get_monotonic_time (void)
2012-06-15 14:41:53 +01:00
* timeBeginPeriod() to increase it as much as they want
*/
+ if (!g_win32_clock_is_initialized)
+ g_clock_win32_init ();
+
if (g_GetTickCount64 != NULL)
{
guint32 ticks_as_32bit;
2014-10-27 10:05:45 +00:00
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
2016-04-06 20:31:53 +01:00
index 1111111..2222222 100644
2014-10-27 10:05:45 +00:00
--- a/glib/gthread-win32.c
+++ b/glib/gthread-win32.c
@@ -116,18 +116,28 @@ typedef struct
2012-06-15 14:41:53 +01:00
void (__stdcall * WakeConditionVariable) (gpointer cond);
} GThreadImplVtable;
+/* Needed for static builds where DllMain initializer doesn't get called */
+static gboolean g_threads_is_initialized;
+G_GNUC_INTERNAL void g_thread_win32_init (void);
+
static GThreadImplVtable g_thread_impl_vtable;
/* {{{1 GMutex */
void
g_mutex_init (GMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.InitializeSRWLock (mutex);
}
void
g_mutex_clear (GMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
if (g_thread_impl_vtable.DeleteSRWLock != NULL)
g_thread_impl_vtable.DeleteSRWLock (mutex);
}
2014-10-27 10:05:45 +00:00
@@ -135,18 +145,27 @@ g_mutex_clear (GMutex *mutex)
2012-06-15 14:41:53 +01:00
void
g_mutex_lock (GMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.AcquireSRWLockExclusive (mutex);
}
gboolean
g_mutex_trylock (GMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
return g_thread_impl_vtable.TryAcquireSRWLockExclusive (mutex);
}
void
g_mutex_unlock (GMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.ReleaseSRWLockExclusive (mutex);
}
2014-10-27 10:05:45 +00:00
@@ -157,6 +176,9 @@ g_rec_mutex_impl_new (void)
2012-06-15 14:41:53 +01:00
{
CRITICAL_SECTION *cs;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
cs = g_slice_new (CRITICAL_SECTION);
InitializeCriticalSection (cs);
2014-10-27 10:05:45 +00:00
@@ -167,6 +189,10 @@ static void
2012-06-15 14:41:53 +01:00
g_rec_mutex_impl_free (CRITICAL_SECTION *cs)
{
DeleteCriticalSection (cs);
+
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_slice_free (CRITICAL_SECTION, cs);
}
2014-10-27 10:05:45 +00:00
@@ -175,6 +201,9 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
2012-06-15 14:41:53 +01:00
{
CRITICAL_SECTION *impl = mutex->p;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
if G_UNLIKELY (mutex->p == NULL)
{
impl = g_rec_mutex_impl_new ();
2014-10-27 10:05:45 +00:00
@@ -189,30 +218,45 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
2012-06-15 14:41:53 +01:00
void
g_rec_mutex_init (GRecMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
mutex->p = g_rec_mutex_impl_new ();
}
void
g_rec_mutex_clear (GRecMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_rec_mutex_impl_free (mutex->p);
}
void
g_rec_mutex_lock (GRecMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
EnterCriticalSection (g_rec_mutex_get_impl (mutex));
}
void
g_rec_mutex_unlock (GRecMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
LeaveCriticalSection (mutex->p);
}
gboolean
g_rec_mutex_trylock (GRecMutex *mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
return TryEnterCriticalSection (g_rec_mutex_get_impl (mutex));
}
2014-10-27 10:05:45 +00:00
@@ -221,12 +265,18 @@ g_rec_mutex_trylock (GRecMutex *mutex)
2012-06-15 14:41:53 +01:00
void
g_rw_lock_init (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.InitializeSRWLock (lock);
}
void
g_rw_lock_clear (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
if (g_thread_impl_vtable.DeleteSRWLock != NULL)
g_thread_impl_vtable.DeleteSRWLock (lock);
}
2014-10-27 10:05:45 +00:00
@@ -234,36 +284,54 @@ g_rw_lock_clear (GRWLock *lock)
2012-06-15 14:41:53 +01:00
void
g_rw_lock_writer_lock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.AcquireSRWLockExclusive (lock);
}
gboolean
g_rw_lock_writer_trylock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
return g_thread_impl_vtable.TryAcquireSRWLockExclusive (lock);
}
void
g_rw_lock_writer_unlock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.ReleaseSRWLockExclusive (lock);
}
void
g_rw_lock_reader_lock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.AcquireSRWLockShared (lock);
}
gboolean
g_rw_lock_reader_trylock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
return g_thread_impl_vtable.TryAcquireSRWLockShared (lock);
}
void
g_rw_lock_reader_unlock (GRWLock *lock)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.ReleaseSRWLockShared (lock);
}
2014-10-27 10:05:45 +00:00
@@ -271,12 +339,18 @@ g_rw_lock_reader_unlock (GRWLock *lock)
2012-06-15 14:41:53 +01:00
void
g_cond_init (GCond *cond)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.InitializeConditionVariable (cond);
}
void
g_cond_clear (GCond *cond)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
if (g_thread_impl_vtable.DeleteConditionVariable)
g_thread_impl_vtable.DeleteConditionVariable (cond);
}
2014-10-27 10:05:45 +00:00
@@ -284,12 +358,18 @@ g_cond_clear (GCond *cond)
2012-06-15 14:41:53 +01:00
void
g_cond_signal (GCond *cond)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.WakeConditionVariable (cond);
}
void
g_cond_broadcast (GCond *cond)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.WakeAllConditionVariable (cond);
}
2014-10-27 10:05:45 +00:00
@@ -297,6 +377,9 @@ void
2012-06-15 14:41:53 +01:00
g_cond_wait (GCond *cond,
GMutex *entered_mutex)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
g_thread_impl_vtable.SleepConditionVariableSRW (cond, entered_mutex, INFINITE, 0);
}
2014-10-27 10:05:45 +00:00
@@ -307,6 +390,9 @@ g_cond_wait_until (GCond *cond,
2012-06-15 14:41:53 +01:00
{
gint64 span;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
span = end_time - g_get_monotonic_time ();
if G_UNLIKELY (span < 0)
2014-10-27 10:05:45 +00:00
@@ -339,6 +425,9 @@ g_private_get_impl (GPrivate *key)
2012-06-15 14:41:53 +01:00
if G_UNLIKELY (impl == 0)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
EnterCriticalSection (&g_private_lock);
impl = (DWORD) key->p;
if (impl == 0)
2014-10-27 10:05:45 +00:00
@@ -432,6 +521,9 @@ g_system_thread_free (GRealThread *thread)
2012-06-15 14:41:53 +01:00
{
GThreadWin32 *wt = (GThreadWin32 *) thread;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
win32_check_for_error (CloseHandle (wt->handle));
g_slice_free (GThreadWin32, wt);
}
2014-10-27 10:05:45 +00:00
@@ -439,6 +531,9 @@ g_system_thread_free (GRealThread *thread)
2012-06-15 14:41:53 +01:00
void
g_system_thread_exit (void)
{
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
_endthreadex (0);
}
2014-10-27 10:05:45 +00:00
@@ -447,6 +542,9 @@ g_thread_win32_proxy (gpointer data)
2012-06-15 14:41:53 +01:00
{
GThreadWin32 *self = data;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
self->proxy (self);
g_system_thread_exit ();
2014-10-27 10:05:45 +00:00
@@ -464,6 +562,9 @@ g_system_thread_new (GThreadFunc func,
2012-06-15 14:41:53 +01:00
GThreadWin32 *thread;
guint ignore;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
thread = g_slice_new0 (GThreadWin32);
thread->proxy = func;
2014-10-27 10:05:45 +00:00
@@ -493,6 +594,9 @@ g_system_thread_wait (GRealThread *thread)
2012-06-15 14:41:53 +01:00
{
GThreadWin32 *wt = (GThreadWin32 *) thread;
+ if (!g_threads_is_initialized)
+ g_thread_win32_init ();
+
win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
}
2014-10-27 10:05:45 +00:00
@@ -984,6 +1088,8 @@ g_thread_lookup_native_funcs (void)
2013-06-29 13:41:43 +01:00
void
2012-06-15 14:41:53 +01:00
g_thread_win32_init (void)
{
+ g_threads_is_initialized = TRUE;
+
if (!g_thread_lookup_native_funcs ())
g_thread_xp_init ();
2014-10-27 10:05:45 +00:00
2016-04-06 20:31:53 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Wed, 6 Apr 2016 22:24:43 +0300
Subject: [PATCH] Remove an annoying runtime warning
that pops up when using GtkApplication in Gtk+ 3 programs.
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index 1111111..2222222 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -1325,6 +1325,7 @@ __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANC
__declspec(dllexport) void CALLBACK
g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow)
{
+ /*
GDBusDaemon *daemon;
GMainLoop *loop;
const char *address;
@@ -1354,6 +1355,7 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
g_main_loop_unref (loop);
g_object_unref (daemon);
+ */
}
static gchar *