glib: patch to fix w/musl, quark static ctor order assumptions

From [1] with prefix added, using local copy to avoid dep on fetchpatch.

[1] https://raw.githubusercontent.com/void-linux/void-packages/master/srcpkgs/glib/patches/quark_init_on_demand.patch

+34
+1
pkgs/development/libraries/glib/default.nix
··· 54 54 55 55 patches = optional stdenv.isDarwin ./darwin-compilation.patch 56 56 ++ optional doCheck ./skip-timer-test.patch 57 + ++ optional stdenv.hostPlatform.isMusl ./quark_init_on_demand.patch 57 58 ++ [ ./schema-override-variable.patch ]; 58 59 59 60 outputs = [ "out" "dev" "devdoc" ];
+33
pkgs/development/libraries/glib/quark_init_on_demand.patch
··· 1 + --- glib-source/glib/gquark.c 2016-08-17 17:20:47.000000000 +0200 2 + +++ glib-source/glib/gquark.c 2016-08-30 07:49:13.298234757 +0200 3 + @@ -57,6 +57,9 @@ 4 + void 5 + g_quark_init (void) 6 + { 7 + + if (quark_ht) 8 + + return; 9 + + 10 + g_assert (quark_seq_id == 0); 11 + quark_ht = g_hash_table_new (g_str_hash, g_str_equal); 12 + quarks = g_new (gchar*, QUARK_BLOCK_SIZE); 13 + @@ -138,9 +141,12 @@ 14 + return 0; 15 + 16 + G_LOCK (quark_global); 17 + +#if !defined(__GLIBC__) 18 + + g_quark_init (); 19 + +#endif 20 + quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); 21 + G_UNLOCK (quark_global); 22 + 23 + return quark; 24 + } 25 + 26 + @@ -280,6 +286,7 @@ 27 + GQuark quark; 28 + gchar **quarks_new; 29 + 30 + + g_quark_init (); 31 + if (quark_seq_id % QUARK_BLOCK_SIZE == 0) 32 + { 33 + quarks_new = g_new (gchar*, quark_seq_id + QUARK_BLOCK_SIZE);