comparison src/glib-1-fixes.patch @ 2618:54ebb3d54d97

package glib: gitify patches
author Mark Brand <mabrand@mabrand.nl>
date Fri, 15 Jun 2012 15:41:53 +0200
parents 7e5aaa010a02
children 383ab5d1e69f
comparison
equal deleted inserted replaced
2617:ab77db77a4ea 2618:54ebb3d54d97
1 This file is part of MXE. 1 This file is part of MXE.
2 See index.html for further information. 2 See index.html for further information.
3 3
4 Contains ad hoc patches for cross building. 4 Contains ad hoc patches for cross building.
5 5
6 From 46d0d473e6fb32c5204d063cad5f5073d2a139a5 Mon Sep 17 00:00:00 2001 6 From 2a15b5d8c570d34e44d315116219bcd731054a54 Mon Sep 17 00:00:00 2001
7 From: MXE 7 From: "a@mxe.cc" <a@mxe.cc>
8 Date: Thu, 23 Sep 2010 21:41:51 +0200 8 Date: Thu, 23 Sep 2010 21:41:51 +0200
9 Subject: [PATCH 2/5] optional gettext 9 Subject: [PATCH 1/7] optional gettext
10 10
11 ---
12 configure.ac | 4 ++--
13 glib/gi18n.h | 5 +++++
14 2 files changed, 7 insertions(+), 2 deletions(-)
11 15
12 diff --git a/configure.ac b/configure.ac 16 diff --git a/configure.ac b/configure.ac
13 index 2e541d2..18c2dea 100644 17 index cadd925..241284d 100644
14 --- a/configure.ac 18 --- a/configure.ac
15 +++ b/configure.ac 19 +++ b/configure.ac
16 @@ -464,8 +464,8 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS']) 20 @@ -479,8 +479,8 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
17 GLIB_GNU_GETTEXT 21 GLIB_GNU_GETTEXT
18 22
19 if test "$gt_cv_have_gettext" != "yes" ; then 23 if test "$gt_cv_have_gettext" != "yes" ; then
20 - AC_MSG_ERROR([ 24 - AC_MSG_ERROR([
21 -*** You must have either have gettext support in your C library, or use the 25 -*** You must have either have gettext support in your C library, or use the
40 + 44 +
41 #include <string.h> 45 #include <string.h>
42 46
43 #define _(String) gettext (String) 47 #define _(String) gettext (String)
44 -- 48 --
45 1.7.1 49 1.7.10.4
46 50
47 51
48 From 3473b5183b2e59d247cd1db053efc6c9ecaf2aab Mon Sep 17 00:00:00 2001 52 From 6e19d772238eb429fe0ea77b65dbc9d8a5d89afa Mon Sep 17 00:00:00 2001
49 From: MXE 53 From: "a@mxe.cc" <a@mxe.cc>
50 Date: Thu, 23 Sep 2010 21:42:46 +0200 54 Date: Thu, 23 Sep 2010 21:42:46 +0200
51 Subject: [PATCH 3/5] fix tool paths 55 Subject: [PATCH 2/7] fix tool paths
52 56
57 ---
58 glib-2.0.pc.in | 6 +++---
59 1 file changed, 3 insertions(+), 3 deletions(-)
53 60
54 diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in 61 diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in
55 index 3d1ac12..58e1ecf 100644 62 index 4a8898e..5164bae 100644
56 --- a/glib-2.0.pc.in 63 --- a/glib-2.0.pc.in
57 +++ b/glib-2.0.pc.in 64 +++ b/glib-2.0.pc.in
58 @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ 65 @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
59 libdir=@libdir@ 66 libdir=@libdir@
60 includedir=@includedir@ 67 includedir=@includedir@
67 +glib_mkenums=@bindir@/glib-mkenums 74 +glib_mkenums=@bindir@/glib-mkenums
68 75
69 Name: GLib 76 Name: GLib
70 Description: C Utility Library 77 Description: C Utility Library
71 -- 78 --
72 1.7.1 79 1.7.10.4
73 80
74 81
82 From 556504bac07f4d80c0d9e50be1090f3ae02a653b Mon Sep 17 00:00:00 2001
83 From: Hans Petter Jansson <hpj@cl.no>
84 Date: Fri, 15 Jun 2012 15:25:01 +0200
85 Subject: [PATCH 3/7] Avoid DllMain symbol conflict when linking statically
86
87 ---
88 gio/giomodule.c | 6 +-----
89 glib/glib-init.c | 6 +++---
90 2 files changed, 4 insertions(+), 8 deletions(-)
91
92 diff --git a/gio/giomodule.c b/gio/giomodule.c
93 index d8ce138..679279f 100644
94 --- a/gio/giomodule.c
95 +++ b/gio/giomodule.c
96 @@ -782,10 +782,8 @@ extern GType _g_network_monitor_netlink_get_type (void);
97
98 static HMODULE gio_dll = NULL;
99
100 -#ifdef DLL_EXPORT
101 -
102 BOOL WINAPI
103 -DllMain (HINSTANCE hinstDLL,
104 +gio_DllMain (HINSTANCE hinstDLL,
105 DWORD fdwReason,
106 LPVOID lpvReserved)
107 {
108 @@ -801,8 +799,6 @@ _g_io_win32_get_module (void)
109 return gio_dll;
110 }
111
112 -#endif
113 -
114 #undef GIO_MODULE_DIR
115
116 /* GIO_MODULE_DIR is used only in code called just once,
117 diff --git a/glib/glib-init.c b/glib/glib-init.c
118 index f4edd5c..02bf678 100644
119 --- a/glib/glib-init.c
120 +++ b/glib/glib-init.c
121 @@ -226,9 +226,9 @@ glib_init (void)
122 HMODULE glib_dll;
123
124 BOOL WINAPI
125 -DllMain (HINSTANCE hinstDLL,
126 - DWORD fdwReason,
127 - LPVOID lpvReserved)
128 +glib_DllMain (HINSTANCE hinstDLL,
129 + DWORD fdwReason,
130 + LPVOID lpvReserved)
131 {
132 switch (fdwReason)
133 {
134 --
135 1.7.10.4
136
137
138 From a83efeaa712bdfe43a1fcada6775ce2c89781631 Mon Sep 17 00:00:00 2001
139 From: Hans Petter Jansson <hpj@cl.no>
140 Date: Fri, 15 Jun 2012 15:27:22 +0200
141 Subject: [PATCH 4/7] Allow building without inotify support
142
143 ---
144 configure.ac | 13 ++++++++++---
145 1 file changed, 10 insertions(+), 3 deletions(-)
146
147 diff --git a/configure.ac b/configure.ac
148 index 241284d..04d8590 100644
149 --- a/configure.ac
150 +++ b/configure.ac
151 @@ -1700,11 +1700,18 @@ dnl *****************************
152 dnl ** Check for inotify (GIO) **
153 dnl *****************************
154 inotify_support=no
155 -AC_CHECK_HEADERS([sys/inotify.h],
156 -[
157 +
158 +AC_ARG_ENABLE(inotify,
159 + AC_HELP_STRING([--disable-inotify],
160 + [build without inotify support]))
161 +
162 +if test "x$enable_inotify" != "xno"; then
163 + AC_CHECK_HEADERS([sys/inotify.h],
164 + [
165 inotify_support=yes
166 AC_CHECK_FUNCS(inotify_init1)
167 -])
168 + ])
169 +fi
170
171 AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
172
173 --
174 1.7.10.4
175
176
177 From e3d193f7e4f3d1ada0d65ccdccab1f28ef6d23d3 Mon Sep 17 00:00:00 2001
178 From: Hans Petter Jansson <hpj@cl.no>
179 Date: Fri, 15 Jun 2012 15:28:14 +0200
180 Subject: [PATCH 5/7] Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF.
181 Backported from upstream
182
183 ---
184 configure.ac | 2 ++
185 1 file changed, 2 insertions(+)
186
187 diff --git a/configure.ac b/configure.ac
188 index 04d8590..29b6252 100644
189 --- a/configure.ac
190 +++ b/configure.ac
191 @@ -452,6 +452,8 @@ fi
192
193 AC_MSG_RESULT($enable_iconv_cache)
194
195 +# Make sure STDC_HEADERS is set for AC_CHECK_ALIGNOF
196 +AS_IF([false], [AC_CHECK_HEADER([stdint.h])])
197
198 dnl
199 dnl zlib support
200 --
201 1.7.10.4
202
203
204 From 08b493b8480f360ab21a0ce5c79b096392a389a8 Mon Sep 17 00:00:00 2001
205 From: Hans Petter Jansson <hpj@cl.no>
206 Date: Fri, 15 Jun 2012 15:29:06 +0200
207 Subject: [PATCH 6/7] Link with dnsapi
208
209 ---
210 gio-2.0.pc.in | 2 +-
211 1 file changed, 1 insertion(+), 1 deletion(-)
212
213 diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
214 index 9f7123f..b0d5779 100644
215 --- a/gio-2.0.pc.in
216 +++ b/gio-2.0.pc.in
217 @@ -13,6 +13,6 @@ Description: glib I/O library
218 Version: @VERSION@
219 Requires: glib-2.0 gobject-2.0
220 Requires.private: gmodule-no-export-2.0
221 -Libs: -L${libdir} -lgio-2.0
222 +Libs: -L${libdir} -lgio-2.0 -ldnsapi
223 Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@
224 Cflags:
225 --
226 1.7.10.4
227
228
229 From 645849d2055b1c7a46132a8b83739290b316ffba Mon Sep 17 00:00:00 2001
230 From: Hans Petter Jansson <hpj@cl.no>
231 Date: Fri, 15 Jun 2012 15:29:38 +0200
232 Subject: [PATCH 7/7] Ensure globals are initialized even when DllMain is not
233 being run
234
235 ---
236 glib/gmain.c | 6 +++
237 glib/gthread-win32.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++
238 2 files changed, 112 insertions(+)
239
240 diff --git a/glib/gmain.c b/glib/gmain.c
241 index 760f179..878ac14 100644
242 --- a/glib/gmain.c
243 +++ b/glib/gmain.c
244 @@ -1981,12 +1981,15 @@ g_get_real_time (void)
245 #ifdef G_OS_WIN32
246 static ULONGLONG (*g_GetTickCount64) (void) = NULL;
247 static guint32 g_win32_tick_epoch = 0;
248 +static gboolean g_win32_clock_is_initialized;
249
250 G_GNUC_INTERNAL void
251 g_clock_win32_init (void)
252 {
253 HMODULE kernel32;
254
255 + g_win32_clock_is_initialized = TRUE;
256 +
257 g_GetTickCount64 = NULL;
258 kernel32 = GetModuleHandle ("KERNEL32.DLL");
259 if (kernel32 != NULL)
260 @@ -2105,6 +2108,9 @@ g_get_monotonic_time (void)
261 * timeBeginPeriod() to increase it as much as they want
262 */
263
264 + if (!g_win32_clock_is_initialized)
265 + g_clock_win32_init ();
266 +
267 if (g_GetTickCount64 != NULL)
268 {
269 guint32 ticks_as_32bit;
270 diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
271 index 5a9ac97..e4d1d48 100644
272 --- a/glib/gthread-win32.c
273 +++ b/glib/gthread-win32.c
274 @@ -117,18 +117,28 @@ typedef struct
275 void (__stdcall * WakeConditionVariable) (gpointer cond);
276 } GThreadImplVtable;
277
278 +/* Needed for static builds where DllMain initializer doesn't get called */
279 +static gboolean g_threads_is_initialized;
280 +G_GNUC_INTERNAL void g_thread_win32_init (void);
281 +
282 static GThreadImplVtable g_thread_impl_vtable;
283
284 /* {{{1 GMutex */
285 void
286 g_mutex_init (GMutex *mutex)
287 {
288 + if (!g_threads_is_initialized)
289 + g_thread_win32_init ();
290 +
291 g_thread_impl_vtable.InitializeSRWLock (mutex);
292 }
293
294 void
295 g_mutex_clear (GMutex *mutex)
296 {
297 + if (!g_threads_is_initialized)
298 + g_thread_win32_init ();
299 +
300 if (g_thread_impl_vtable.DeleteSRWLock != NULL)
301 g_thread_impl_vtable.DeleteSRWLock (mutex);
302 }
303 @@ -136,18 +146,27 @@ g_mutex_clear (GMutex *mutex)
304 void
305 g_mutex_lock (GMutex *mutex)
306 {
307 + if (!g_threads_is_initialized)
308 + g_thread_win32_init ();
309 +
310 g_thread_impl_vtable.AcquireSRWLockExclusive (mutex);
311 }
312
313 gboolean
314 g_mutex_trylock (GMutex *mutex)
315 {
316 + if (!g_threads_is_initialized)
317 + g_thread_win32_init ();
318 +
319 return g_thread_impl_vtable.TryAcquireSRWLockExclusive (mutex);
320 }
321
322 void
323 g_mutex_unlock (GMutex *mutex)
324 {
325 + if (!g_threads_is_initialized)
326 + g_thread_win32_init ();
327 +
328 g_thread_impl_vtable.ReleaseSRWLockExclusive (mutex);
329 }
330
331 @@ -158,6 +177,9 @@ g_rec_mutex_impl_new (void)
332 {
333 CRITICAL_SECTION *cs;
334
335 + if (!g_threads_is_initialized)
336 + g_thread_win32_init ();
337 +
338 cs = g_slice_new (CRITICAL_SECTION);
339 InitializeCriticalSection (cs);
340
341 @@ -168,6 +190,10 @@ static void
342 g_rec_mutex_impl_free (CRITICAL_SECTION *cs)
343 {
344 DeleteCriticalSection (cs);
345 +
346 + if (!g_threads_is_initialized)
347 + g_thread_win32_init ();
348 +
349 g_slice_free (CRITICAL_SECTION, cs);
350 }
351
352 @@ -176,6 +202,9 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
353 {
354 CRITICAL_SECTION *impl = mutex->p;
355
356 + if (!g_threads_is_initialized)
357 + g_thread_win32_init ();
358 +
359 if G_UNLIKELY (mutex->p == NULL)
360 {
361 impl = g_rec_mutex_impl_new ();
362 @@ -190,30 +219,45 @@ g_rec_mutex_get_impl (GRecMutex *mutex)
363 void
364 g_rec_mutex_init (GRecMutex *mutex)
365 {
366 + if (!g_threads_is_initialized)
367 + g_thread_win32_init ();
368 +
369 mutex->p = g_rec_mutex_impl_new ();
370 }
371
372 void
373 g_rec_mutex_clear (GRecMutex *mutex)
374 {
375 + if (!g_threads_is_initialized)
376 + g_thread_win32_init ();
377 +
378 g_rec_mutex_impl_free (mutex->p);
379 }
380
381 void
382 g_rec_mutex_lock (GRecMutex *mutex)
383 {
384 + if (!g_threads_is_initialized)
385 + g_thread_win32_init ();
386 +
387 EnterCriticalSection (g_rec_mutex_get_impl (mutex));
388 }
389
390 void
391 g_rec_mutex_unlock (GRecMutex *mutex)
392 {
393 + if (!g_threads_is_initialized)
394 + g_thread_win32_init ();
395 +
396 LeaveCriticalSection (mutex->p);
397 }
398
399 gboolean
400 g_rec_mutex_trylock (GRecMutex *mutex)
401 {
402 + if (!g_threads_is_initialized)
403 + g_thread_win32_init ();
404 +
405 return TryEnterCriticalSection (g_rec_mutex_get_impl (mutex));
406 }
407
408 @@ -222,12 +266,18 @@ g_rec_mutex_trylock (GRecMutex *mutex)
409 void
410 g_rw_lock_init (GRWLock *lock)
411 {
412 + if (!g_threads_is_initialized)
413 + g_thread_win32_init ();
414 +
415 g_thread_impl_vtable.InitializeSRWLock (lock);
416 }
417
418 void
419 g_rw_lock_clear (GRWLock *lock)
420 {
421 + if (!g_threads_is_initialized)
422 + g_thread_win32_init ();
423 +
424 if (g_thread_impl_vtable.DeleteSRWLock != NULL)
425 g_thread_impl_vtable.DeleteSRWLock (lock);
426 }
427 @@ -235,36 +285,54 @@ g_rw_lock_clear (GRWLock *lock)
428 void
429 g_rw_lock_writer_lock (GRWLock *lock)
430 {
431 + if (!g_threads_is_initialized)
432 + g_thread_win32_init ();
433 +
434 g_thread_impl_vtable.AcquireSRWLockExclusive (lock);
435 }
436
437 gboolean
438 g_rw_lock_writer_trylock (GRWLock *lock)
439 {
440 + if (!g_threads_is_initialized)
441 + g_thread_win32_init ();
442 +
443 return g_thread_impl_vtable.TryAcquireSRWLockExclusive (lock);
444 }
445
446 void
447 g_rw_lock_writer_unlock (GRWLock *lock)
448 {
449 + if (!g_threads_is_initialized)
450 + g_thread_win32_init ();
451 +
452 g_thread_impl_vtable.ReleaseSRWLockExclusive (lock);
453 }
454
455 void
456 g_rw_lock_reader_lock (GRWLock *lock)
457 {
458 + if (!g_threads_is_initialized)
459 + g_thread_win32_init ();
460 +
461 g_thread_impl_vtable.AcquireSRWLockShared (lock);
462 }
463
464 gboolean
465 g_rw_lock_reader_trylock (GRWLock *lock)
466 {
467 + if (!g_threads_is_initialized)
468 + g_thread_win32_init ();
469 +
470 return g_thread_impl_vtable.TryAcquireSRWLockShared (lock);
471 }
472
473 void
474 g_rw_lock_reader_unlock (GRWLock *lock)
475 {
476 + if (!g_threads_is_initialized)
477 + g_thread_win32_init ();
478 +
479 g_thread_impl_vtable.ReleaseSRWLockShared (lock);
480 }
481
482 @@ -272,12 +340,18 @@ g_rw_lock_reader_unlock (GRWLock *lock)
483 void
484 g_cond_init (GCond *cond)
485 {
486 + if (!g_threads_is_initialized)
487 + g_thread_win32_init ();
488 +
489 g_thread_impl_vtable.InitializeConditionVariable (cond);
490 }
491
492 void
493 g_cond_clear (GCond *cond)
494 {
495 + if (!g_threads_is_initialized)
496 + g_thread_win32_init ();
497 +
498 if (g_thread_impl_vtable.DeleteConditionVariable)
499 g_thread_impl_vtable.DeleteConditionVariable (cond);
500 }
501 @@ -285,12 +359,18 @@ g_cond_clear (GCond *cond)
502 void
503 g_cond_signal (GCond *cond)
504 {
505 + if (!g_threads_is_initialized)
506 + g_thread_win32_init ();
507 +
508 g_thread_impl_vtable.WakeConditionVariable (cond);
509 }
510
511 void
512 g_cond_broadcast (GCond *cond)
513 {
514 + if (!g_threads_is_initialized)
515 + g_thread_win32_init ();
516 +
517 g_thread_impl_vtable.WakeAllConditionVariable (cond);
518 }
519
520 @@ -298,6 +378,9 @@ void
521 g_cond_wait (GCond *cond,
522 GMutex *entered_mutex)
523 {
524 + if (!g_threads_is_initialized)
525 + g_thread_win32_init ();
526 +
527 g_thread_impl_vtable.SleepConditionVariableSRW (cond, entered_mutex, INFINITE, 0);
528 }
529
530 @@ -308,6 +391,9 @@ g_cond_wait_until (GCond *cond,
531 {
532 gint64 span;
533
534 + if (!g_threads_is_initialized)
535 + g_thread_win32_init ();
536 +
537 span = end_time - g_get_monotonic_time ();
538
539 if G_UNLIKELY (span < 0)
540 @@ -340,6 +426,9 @@ g_private_get_impl (GPrivate *key)
541
542 if G_UNLIKELY (impl == 0)
543 {
544 + if (!g_threads_is_initialized)
545 + g_thread_win32_init ();
546 +
547 EnterCriticalSection (&g_private_lock);
548 impl = (DWORD) key->p;
549 if (impl == 0)
550 @@ -433,6 +522,9 @@ g_system_thread_free (GRealThread *thread)
551 {
552 GThreadWin32 *wt = (GThreadWin32 *) thread;
553
554 + if (!g_threads_is_initialized)
555 + g_thread_win32_init ();
556 +
557 win32_check_for_error (CloseHandle (wt->handle));
558 g_slice_free (GThreadWin32, wt);
559 }
560 @@ -440,6 +532,9 @@ g_system_thread_free (GRealThread *thread)
561 void
562 g_system_thread_exit (void)
563 {
564 + if (!g_threads_is_initialized)
565 + g_thread_win32_init ();
566 +
567 _endthreadex (0);
568 }
569
570 @@ -448,6 +543,9 @@ g_thread_win32_proxy (gpointer data)
571 {
572 GThreadWin32 *self = data;
573
574 + if (!g_threads_is_initialized)
575 + g_thread_win32_init ();
576 +
577 self->proxy (self);
578
579 g_system_thread_exit ();
580 @@ -465,6 +563,9 @@ g_system_thread_new (GThreadFunc func,
581 GThreadWin32 *thread;
582 guint ignore;
583
584 + if (!g_threads_is_initialized)
585 + g_thread_win32_init ();
586 +
587 thread = g_slice_new0 (GThreadWin32);
588 thread->proxy = func;
589
590 @@ -494,6 +595,9 @@ g_system_thread_wait (GRealThread *thread)
591 {
592 GThreadWin32 *wt = (GThreadWin32 *) thread;
593
594 + if (!g_threads_is_initialized)
595 + g_thread_win32_init ();
596 +
597 win32_check_for_error (WAIT_FAILED != WaitForSingleObject (wt->handle, INFINITE));
598 }
599
600 @@ -985,6 +1089,8 @@ g_thread_lookup_native_funcs (void)
601 G_GNUC_INTERNAL void
602 g_thread_win32_init (void)
603 {
604 + g_threads_is_initialized = TRUE;
605 +
606 if (!g_thread_lookup_native_funcs ())
607 g_thread_xp_init ();
608
609 --
610 1.7.10.4
611