summaryrefslogtreecommitdiffstats
path: root/src/glib-1-fixes.patch
blob: 57cb0ac96146ef1c0b4a73af41ea685f298967d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
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: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 23 Sep 2010 21:42:46 +0200
Subject: [PATCH] fix tool paths


diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
index 1111111..2222222 100644
--- 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

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] Avoid DllMain symbol conflict when linking statically

Adjusted by Boris Nagaev on 29-Jan-2017 to fix
https://gist.github.com/starius/f4fc85939352cb50122ba29e0f5b140d
when updating to glib-2.50.2.

diff --git a/gio/giomodule.c b/gio/giomodule.c
index 1111111..2222222 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -928,14 +928,12 @@ extern GType g_cocoa_notification_backend_get_type (void);
 
 static HMODULE gio_dll = NULL;
 
-#ifdef DLL_EXPORT
-
-BOOL WINAPI DllMain (HINSTANCE hinstDLL,
+BOOL WINAPI gio_DllMain (HINSTANCE hinstDLL,
                      DWORD     fdwReason,
                      LPVOID    lpvReserved);
 
 BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
+gio_DllMain (HINSTANCE hinstDLL,
 	 DWORD     fdwReason,
 	 LPVOID    lpvReserved)
 {
@@ -945,8 +943,6 @@ DllMain (HINSTANCE hinstDLL,
   return TRUE;
 }
 
-#endif
-
 void *
 _g_io_win32_get_module (void)
 {
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 1111111..2222222 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -245,14 +245,14 @@ glib_init (void)
 
 #if defined (G_OS_WIN32)
 
-BOOL WINAPI DllMain (HINSTANCE hinstDLL,
+BOOL WINAPI glib_DllMain (HINSTANCE hinstDLL,
                      DWORD     fdwReason,
                      LPVOID    lpvReserved);
 
 HMODULE glib_dll;
 
 BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
+glib_DllMain (HINSTANCE hinstDLL,
          DWORD     fdwReason,
          LPVOID    lpvReserved)
 {
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 1111111..2222222 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -4450,7 +4450,7 @@ gobject_init (void)
   _g_signal_init ();
 }
 
-#if defined (G_OS_WIN32)
+#if 0
 
 BOOL WINAPI DllMain (HINSTANCE hinstDLL,
                      DWORD     fdwReason,

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] Allow building without inotify support


diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1599,10 +1599,16 @@ dnl *****************************
 dnl ** Check for inotify (GIO) **
 dnl *****************************
 inotify_support=no
+ AC_ARG_ENABLE(inotify,
+               AC_HELP_STRING([--disable-inotify],
+                              [build without inotify support]))
+
+ if test "x$enable_inotify" != "xno"; then
 AC_CHECK_HEADERS([sys/inotify.h],
 [
   AC_CHECK_FUNCS(inotify_init1, [inotify_support=yes], [inotify_support=no])
 ])
+fi
 
 AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
 

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] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
 Backported from upstream


diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -511,6 +511,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])
 
+# Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF
+AS_IF([false], [AC_CHECK_HEADER([stdint.h])])
 
 AS_IF([test "$glib_native_win32" = "yes"], [
   if test x$enable_static = xyes -a x$enable_shared = xyes; then

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] Link with dnsapi


diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
index 1111111..2222222 100644
--- a/gio-2.0.pc.in
+++ b/gio-2.0.pc.in
@@ -13,6 +13,6 @@ Description: glib I/O library
 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
 Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@
 Cflags:

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] Ensure globals are initialized even when DllMain is not
 being run


diff --git a/glib/gmain.c b/glib/gmain.c
index 1111111..2222222 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -2657,12 +2657,15 @@ g_get_real_time (void)
 #if defined (G_OS_WIN32)
 static ULONGLONG (*g_GetTickCount64) (void) = NULL;
 static guint32 g_win32_tick_epoch = 0;
+static gboolean g_win32_clock_is_initialized;
 
 void
 g_clock_win32_init (void)
 {
   HMODULE kernel32;
 
+  g_win32_clock_is_initialized = TRUE;
+
   g_GetTickCount64 = NULL;
   kernel32 = GetModuleHandle ("KERNEL32.DLL");
   if (kernel32 != NULL)
@@ -2721,6 +2724,9 @@ g_get_monotonic_time (void)
    *    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;
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
index 1111111..2222222 100644
--- a/glib/gthread-win32.c
+++ b/glib/gthread-win32.c
@@ -116,18 +116,28 @@ typedef struct
   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);
 }
@@ -135,18 +145,27 @@ g_mutex_clear (GMutex *mutex)
 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);
 }
 
@@ -157,6 +176,9 @@ g_rec_mutex_impl_new (void)
 {
   CRITICAL_SECTION *cs;
 
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   cs = g_slice_new (CRITICAL_SECTION);
   InitializeCriticalSection (cs);
 
@@ -167,6 +189,10 @@ static void
 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);
 }
 
@@ -175,6 +201,9 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
 {
   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 ();
@@ -189,30 +218,45 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
 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));
 }
 
@@ -221,12 +265,18 @@ g_rec_mutex_trylock (GRecMutex *mutex)
 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);
 }
@@ -234,36 +284,54 @@ g_rw_lock_clear (GRWLock *lock)
 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);
 }
 
@@ -271,12 +339,18 @@ g_rw_lock_reader_unlock (GRWLock *lock)
 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);
 }
@@ -284,12 +358,18 @@ g_cond_clear (GCond *cond)
 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);
 }
 
@@ -297,6 +377,9 @@ void
 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);
 }
 
@@ -307,6 +390,9 @@ g_cond_wait_until (GCond  *cond,
 {
   gint64 span;
 
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   span = end_time - g_get_monotonic_time ();
 
   if G_UNLIKELY (span < 0)
@@ -339,6 +425,9 @@ g_private_get_impl (GPrivate *key)
 
   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)
@@ -432,6 +521,9 @@ g_system_thread_free (GRealThread *thread)
 {
   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);
 }
@@ -439,6 +531,9 @@ g_system_thread_free (GRealThread *thread)
 void
 g_system_thread_exit (void)
 {
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   _endthreadex (0);
 }
 
@@ -447,6 +542,9 @@ g_thread_win32_proxy (gpointer data)
 {
   GThreadWin32 *self = data;
 
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   self->proxy (self);
 
   g_system_thread_exit ();
@@ -464,6 +562,9 @@ g_system_thread_new (GThreadFunc   func,
   GThreadWin32 *thread;
   guint ignore;
 
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   thread = g_slice_new0 (GThreadWin32);
   thread->proxy = func;
 
@@ -493,6 +594,9 @@ g_system_thread_wait (GRealThread *thread)
 {
   GThreadWin32 *wt = (GThreadWin32 *) thread;
 
+  if (!g_threads_is_initialized)
+    g_thread_win32_init ();
+
   win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
 }
 
@@ -1041,6 +1145,8 @@ g_thread_lookup_native_funcs (void)
 void
 g_thread_win32_init (void)
 {
+  g_threads_is_initialized = TRUE;
+
   if (!g_thread_lookup_native_funcs ())
     g_thread_xp_init ();
 

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] 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
@@ -1387,6 +1387,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;
@@ -1418,6 +1419,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 *

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] fix error "won't overwrite defined macro" on OSX

See https://github.com/mxe/mxe/issues/1281

diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4
index 1111111..2222222 100644
--- a/m4macros/glib-gettext.m4
+++ b/m4macros/glib-gettext.m4
@@ -36,8 +36,8 @@ dnl We go to great lengths to make sure that aclocal won't
 dnl try to pull in the installed version of these macros
 dnl when running aclocal in the glib directory.
 dnl
-m4_copy([AC_DEFUN],[glib_DEFUN])
-m4_copy([AC_REQUIRE],[glib_REQUIRE])
+m4_copy_force([AC_DEFUN],[glib_DEFUN])
+m4_copy_force([AC_REQUIRE],[glib_REQUIRE])
 dnl
 dnl At the end, if we're not within glib, we'll define the public
 dnl definitions in terms of our private definitions.