From 159aa468d0b137ab9e25143d37ce287961bb1c06 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 6 Apr 2016 08:17:08 +0200 Subject: [PATCH] glib: bring back quark_init_on_demand.patch --- .../glib/patches/quark_init_on_demand.patch | 99 +++++++++++++++++++ srcpkgs/glib/template | 2 +- 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/glib/patches/quark_init_on_demand.patch diff --git a/srcpkgs/glib/patches/quark_init_on_demand.patch b/srcpkgs/glib/patches/quark_init_on_demand.patch new file mode 100644 index 00000000000..b62bdb52a7e --- /dev/null +++ b/srcpkgs/glib/patches/quark_init_on_demand.patch @@ -0,0 +1,99 @@ +Reverting commit https://github.com/GNOME/glib/commit/2fe992b099bfd3fb121a71b7af43e116b2142b5d + +musl's does not run ctors in the assumed order that glib-2.46 expects: + +- glib_init() should be called before gobject_init_ctor(). + + +diff --git glib/glib-init.c glib/glib-init.c +index e7002e6..24efe9d 100644 +--- glib/glib-init.c ++++ glib/glib-init.c +@@ -233,7 +233,6 @@ glib_init (void) + { + g_messages_prefixed_init (); + g_debug_init (); +- g_quark_init (); + } + + #if defined (G_OS_WIN32) +diff --git glib/glib-init.h glib/glib-init.h +index b56f7e2..de6be78 100644 +--- glib/glib-init.h ++++ glib/glib-init.h +@@ -25,8 +25,6 @@ + extern GLogLevelFlags g_log_always_fatal; + extern GLogLevelFlags g_log_msg_prefix; + + void glib_init (void); +-void g_quark_init (void); +- + #ifdef G_OS_WIN32 + #include + +diff --git glib/gquark.c glib/gquark.c +index 9e51a92..d620533 100644 +--- glib/gquark.c ++++ glib/gquark.c +@@ -40,7 +40,6 @@ + #include "gthread.h" + #include "gtestutils.h" + #include "glib_trace.h" +-#include "glib-init.h" + + #define QUARK_BLOCK_SIZE 2048 + #define QUARK_STRING_BLOCK_SIZE (4096 - sizeof (gsize)) +@@ -54,16 +53,6 @@ static gint quark_seq_id = 0; + static gchar *quark_block = NULL; + static gint quark_block_offset = 0; + +-void +-g_quark_init (void) +-{ +- g_assert (quark_seq_id == 0); +- quark_ht = g_hash_table_new (g_str_hash, g_str_equal); +- quarks = g_new (gchar*, QUARK_BLOCK_SIZE); +- quarks[0] = NULL; +- quark_seq_id = 1; +-} +- + /** + * SECTION:quarks + * @title: Quarks +@@ -138,9 +127,10 @@ g_quark_try_string (const gchar *string) + return 0; + + G_LOCK (quark_global); +- quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); ++ if (quark_ht) ++ quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); + G_UNLOCK (quark_global); +- ++ + return quark; + } + +@@ -179,7 +169,8 @@ quark_from_string (const gchar *string, + { + GQuark quark = 0; + +- quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); ++ if (quark_ht) ++ quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); + + if (!quark) + { +@@ -292,6 +283,13 @@ quark_new (gchar *string) + */ + g_atomic_pointer_set (&quarks, quarks_new); + } ++ if (!quark_ht) ++ { ++ g_assert (quark_seq_id == 0); ++ quark_ht = g_hash_table_new (g_str_hash, g_str_equal); ++ quarks[quark_seq_id] = NULL; ++ g_atomic_int_inc (&quark_seq_id); ++ } + + quark = quark_seq_id; + g_atomic_pointer_set (&quarks[quark], string); diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template index 3b9ba8d2e73..0618e94942e 100644 --- a/srcpkgs/glib/template +++ b/srcpkgs/glib/template @@ -1,7 +1,7 @@ # Template build file for 'glib' pkgname=glib version=2.48.0 -revision=1 +revision=2 build_style=gnu-configure configure_args="--enable-libelf --disable-fam --with-pcre=system --enable-static" hostmakedepends="automake libtool pkg-config perl python libxslt docbook-xsl"