commit:     7196e3be28e9ff7821b5757c88c78f1ff62ed7cf
Author:     Rasmus Thomsen <rasmus.thomsen <AT> live <DOT> de>
AuthorDate: Wed Mar 29 14:37:29 2017 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Wed Mar 29 16:47:22 2017 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=7196e3be

dev-libs/glib: include additional patches

 dev-libs/glib/Manifest                             |  6 +-
 dev-libs/glib/files/glib-2.48.2-musl-glibmm.patch  | 47 -----------
 .../files/glib-2.50.3-fix-gdatetime-tests.patch    | 52 +++++++++++++
 dev-libs/glib/files/gobject_init_on_demand.patch   | 91 ++++++++++++++++++++++
 dev-libs/glib/files/quark_init_on_demand.patch     | 77 ++++++++++++++++++
 dev-libs/glib/glib-2.48.2.ebuild                   |  6 +-
 6 files changed, 228 insertions(+), 51 deletions(-)

diff --git a/dev-libs/glib/Manifest b/dev-libs/glib/Manifest
index 4f1405f..f9f4e55 100644
--- a/dev-libs/glib/Manifest
+++ b/dev-libs/glib/Manifest
@@ -1,6 +1,8 @@
 AUX glib-2.40.0-external-gdbus-codegen.patch 3901 SHA256 
d06d2775c3632212c11eceb715f0da6a3b1ab6d8d901bb2fcb7c1fc3ca6b004a SHA512 
2f960a53cf51f809af6788664e2cd6d67a29eb58dfe34156f665e2d5ae1fd53a3c792714672fc82dcbfae38e1c793a3eef07116484511ef21d96536559339b00
 WHIRLPOOL 
39dc4d38e6a3450cbba3a1843096da330b6b2bc8954b9cce4a890454e5546d3e6440ddd237772407bd4ffec05b78eb6ddddb5c4cb6c86a86e01a5ad4c96fe8b0
-AUX glib-2.48.2-musl-glibmm.patch 1496 SHA256 
17cd23f9bea7eaa0ed4c3a83e894392d3d6824a462790cb1e3b6f10d591b9448 SHA512 
6656b6c40366c43e48916a1851319f0a6b939ae5f1c78b9496930f47b566ab17924ee031ed6a0ea9beb8a4b1fc37b66ef1784b4a95a890dd71410717175509e7
 WHIRLPOOL 
afc16f2a772a474f92eec77d666b88c88b6a96e2ded4b1e4e02f824bea7a903ead48ed2cdc1ab0f273f7e1d492e99bb5ae5e3545ffa3318e2fe56538d0a55d85
+AUX glib-2.50.3-fix-gdatetime-tests.patch 2052 SHA256 
182695950e34356f3d97005cd0120d3a0ed1e485ec97b86b0c121a72c418c7b5 SHA512 
7701cd1116626ef2b5a79e0d31f4c445a609b8b4481745f443fbac290670c776fbf4196a33a80629bf13bd9e405579715758e6c7ffcee72b6129d444d1dfa724
 WHIRLPOOL 
19f0193c57d2a4de5b1429ee3171c554e43aaadbc53e2f1471803a8b3c32c8ac6cd0ff5d5ed4ff46bb2923b09f97a354b2a3ae0989a633f2757c250a5b80a2f7
+AUX gobject_init_on_demand.patch 2113 SHA256 
ffb30a240f23ee76dff0fc1ecc155288ea8bb976e814cc52e55c025e7ab792d0 SHA512 
4281f0e1405618c593988b549b34f66bc530c2d3196364e0a387ca8f61fdd75065b40b039afc0711f73a8fcf5f9483f1d3c57fe3154bae9bc72243ede3bd239e
 WHIRLPOOL 
a7090b51c28421e7c600b495665a47866554e317810abce07dfa07070a7887655d09ac12c04b0dbb30ab442b22175849f49e433f25f3ef41b519de6bf49f42a6
+AUX quark_init_on_demand.patch 1725 SHA256 
e09d8e723752c1f36b7451b244bbe4dd9b5c39ff0dcd5a778ddbfe93c5343ef5 SHA512 
29311855d0058b8171914542304d04536c83cca265f094f9d537b6e9c2e2d71a5975967bb2743c4fa3a6c569c058c0c21b78dfaa0c9c3ce8aed7f474678a53d9
 WHIRLPOOL 
71bb85a258417014cd4ab7dbcc16779ef222408be37e590f9f67dfb2dbbf6bfefb9ce8ac1d0097216b6d92fb69c9c846678d7f71f5f45ab8de07f6b88f6c8ff0
 DIST glib-2.48.2.tar.xz 6408644 SHA256 
f25e751589cb1a58826eac24fbd4186cda4518af772806b666a3f91f66e6d3f4 SHA512 
2eac104eb2207d0a6488992e48069a34b417f51e141364f281ab7b0953a6de88be177b1c694dd9464a856c9a5d8021e3cf0193a8d9c5aaf6ea11f1f9ff743c43
 WHIRLPOOL 
cba211000d5597e93d01113e5f2b6736e47f4daa00935a53af182b3304fef9a1ac25f78995c7a53cc1234261433a1bbd1ec751c87b556845a15da720af5b971b
 DIST pkg-config-0.28.tar.gz 1931203 SHA256 
6b6eb31c6ec4421174578652c7e141fdaae2dabad1021f420d8713206ac1f845 SHA512 
6eafa5ca77c5d44cd15f48457a5e96fcea2555b66d8e35ada5ab59864a0aa03d441e15f54ab9c6343693867b3b490f392c75b7d9312f024c9b7ec6a0194d8320
 WHIRLPOOL 
db4ddb4ce61724e629931c5ffccb4d7a551b4dc0f4efed5a966822307e4b5a786adee5705dd80ec0a9aa32cb1af9ad9615e307360e131fc34688207216161486
-EBUILD glib-2.48.2.ebuild 8617 SHA256 
2b64e2ebb7ecc6eda84de3254e5ce8ae984b60ddc3c54e20652059ec2eded32d SHA512 
ea1327f401eae1ad945602e4e686a396ff6c90115beb161e6703fd102f534ef3e02104abdf9d9404307f66997fca2500013e63967f698dbd0e290a5c073b2e56
 WHIRLPOOL 
f58d2c94fea90aef272e0009a5da9b01f216df26432b390c421985804bb19ba03a47c95b29d2e2a2e103bbc1a65af65154ba9e3aa6332629df66a03600daec51
+EBUILD glib-2.48.2.ebuild 8727 SHA256 
a2baeca411a6c6755d42e1ab144466ae71502fbebefdf8c2511b615575c9589a SHA512 
3f853481a142967e494fb88b1798c429b05ab81fa6d71e39a0d021ea1bbf24eda73ef5abdac4c4bcb0ebfd170ec261a658a5f4a40802dd5d1dcff4f941efe10a
 WHIRLPOOL 
6d0063403a73bb3502b58520a349c828ebc991b4f7a2c06f0f5de2a6519e04431f1e0a1a9f7f45df8e149d360ea4f22f8db2f8154ea8f0f9bbe657c2d7e71af4
 MISC metadata.xml 955 SHA256 
424ffc685dcfdfa5dcb142046d937915d07945217db814ff759b9b736d67f9e4 SHA512 
31b87bd850ffaa3f2263e6435d2929ef9f8f979e6fe6cff86433c8841dc383088bc6d672ac7daf94c1ef660767d0e91a03860267df9c750dcde3204dd6631cb1
 WHIRLPOOL 
cf59bd50dcfcc466ad19a81f458875b7e62fc569cda4f730defdbed72f0112395b332b52574c5794539c8e0255f7abaa9e7f14a9c5bb5fd6048ad3c4c35991c8

diff --git a/dev-libs/glib/files/glib-2.48.2-musl-glibmm.patch 
b/dev-libs/glib/files/glib-2.48.2-musl-glibmm.patch
deleted file mode 100644
index 818ccf1..0000000
--- a/dev-libs/glib/files/glib-2.48.2-musl-glibmm.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 424c077cde206acdbb4d2c072513dc9bc8e850a4 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <nc...@alpinelinux.org>
-Date: Wed, 6 Jul 2016 12:38:40 +0200
-Subject: [PATCH 3/3] gquark: fix initialization with c++ constructors
-
-C++ constructors may want create new quarks, but we can not guarantee
-that the glib library ctor is executed first. Therefore we make sure
-that quarks are always initialized from g_quark_from_string and
-g_quark_from_static_string
-
-This fixes crashes in glibmm with musl which likely happens on AIX too.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=768215
-https://bugzilla.gnome.org/show_bug.cgi?id=756139#c14
----
- glib/gquark.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/glib/gquark.c b/glib/gquark.c
-index e79ec9e..e93281e 100644
---- a/glib/gquark.c
-+++ b/glib/gquark.c
-@@ -57,6 +57,11 @@ static gint           quark_block_offset = 0;
- void
- g_quark_init (void)
- {
-+  /* we may be initialized from c++ constructor or the glib ctor, but we
-+  cannot guarantee in what order. So we check if we have been initialized */
-+  if (quark_ht != NULL)
-+    return;
-+
-   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);
-@@ -182,6 +187,9 @@ quark_from_string (const gchar *string,
-     return 0;
- 
-   G_LOCK (quark_global);
-+  if (G_UNLIKELY (quark_ht == NULL))
-+    g_quark_init();
-+
-   quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
- 
-   if (!quark)
--- 
-2.9.0
-

diff --git a/dev-libs/glib/files/glib-2.50.3-fix-gdatetime-tests.patch 
b/dev-libs/glib/files/glib-2.50.3-fix-gdatetime-tests.patch
new file mode 100644
index 0000000..6c41c5c
--- /dev/null
+++ b/dev-libs/glib/files/glib-2.50.3-fix-gdatetime-tests.patch
@@ -0,0 +1,52 @@
+From ec02a1875f29ecb8e46c0d8c1403cd00a0b3a9e4 Mon Sep 17 00:00:00 2001
+From: Iain Lane <i...@orangesquash.org.uk>
+Date: Mon, 13 Mar 2017 16:52:11 +0000
+Subject: [PATCH] tests/gdatetime: Use a real rather than invented timezone
+
+The tzdata maintainers had previously invented abbreviations for
+timezones. As of their 2017a release, the one we were testing ("BRT")
+has been dropped.
+
+Switch to testing PST, which is a real timezone abbreviation.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=779799
+---
+ glib/tests/gdatetime.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
+index dcb8a8f..c54031d 100644
+--- a/glib/tests/gdatetime.c
++++ b/glib/tests/gdatetime.c
+@@ -635,22 +635,22 @@ test_GDateTime_new_full (void)
+   g_date_time_unref (dt);
+ 
+ #ifdef G_OS_UNIX
+-  tz = g_time_zone_new ("America/Recife");
++  tz = g_time_zone_new ("America/Tijuana");
+ #elif defined G_OS_WIN32
+-  tz = g_time_zone_new ("E. South America Standard Time");
++  tz = g_time_zone_new ("Pacific Standard Time");
+ #endif
+-  dt = g_date_time_new (tz, 2010, 5, 24, 8, 4, 0);
++  dt = g_date_time_new (tz, 2010, 11, 24, 8, 4, 0);
+   g_time_zone_unref (tz);
+   g_assert_cmpint (2010, ==, g_date_time_get_year (dt));
+-  g_assert_cmpint (5, ==, g_date_time_get_month (dt));
++  g_assert_cmpint (11, ==, g_date_time_get_month (dt));
+   g_assert_cmpint (24, ==, g_date_time_get_day_of_month (dt));
+   g_assert_cmpint (8, ==, g_date_time_get_hour (dt));
+   g_assert_cmpint (4, ==, g_date_time_get_minute (dt));
+   g_assert_cmpint (0, ==, g_date_time_get_second (dt));
+ #ifdef G_OS_UNIX
+-  g_assert_cmpstr ("BRT", ==, g_date_time_get_timezone_abbreviation (dt));
++  g_assert_cmpstr ("PST", ==, g_date_time_get_timezone_abbreviation (dt));
+ #elif defined G_OS_WIN32
+-  g_assert_cmpstr ("E. South America Standard Time", ==,
++  g_assert_cmpstr ("Pacific Standard Time", ==,
+                     g_date_time_get_timezone_abbreviation (dt));
+ #endif
+   g_assert (!g_date_time_is_daylight_savings (dt));
+-- 
+2.10.1
+

diff --git a/dev-libs/glib/files/gobject_init_on_demand.patch 
b/dev-libs/glib/files/gobject_init_on_demand.patch
new file mode 100644
index 0000000..024e588
--- /dev/null
+++ b/dev-libs/glib/files/gobject_init_on_demand.patch
@@ -0,0 +1,91 @@
+Initialize the gobject system on demand, i.e. before it is
+expected to be initialized. Do this only once by checking
+a local static variable gobject_initialized.
+
+--- a/gobject/gtype.c  2016-08-17 17:20:47.000000000 +0200
++++ b/gobject/gtype.c  2016-09-01 21:56:31.777406646 +0200
+@@ -209,6 +209,9 @@
+ static gboolean                               type_node_is_a_L                
(TypeNode               *node,
+                                                                        
TypeNode               *iface_node);
+ 
++#if !defined(__GLIBC__)
++static void gobject_init (void);
++#endif
+ 
+ /* --- enumeration --- */
+ 
+@@ -2631,7 +2634,10 @@
+                            GTypeFlags                  flags)
+ {
+   TypeNode *node;
+-  
++ 
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (type_id > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -2749,6 +2755,9 @@
+   TypeNode *pnode, *node;
+   GType type = 0;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (parent_type > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -2804,6 +2813,9 @@
+   TypeNode *pnode, *node;
+   GType type;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   g_return_val_if_fail (parent_type > 0, 0);
+   g_return_val_if_fail (type_name != NULL, 0);
+@@ -3319,6 +3331,9 @@
+ {
+   TypeNode *node;
+   
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+   
+   node = lookup_type_node_I (type);
+@@ -4343,6 +4358,9 @@
+ void
+ g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
+ {
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+ 
+   if (debug_flags)
+@@ -4361,6 +4379,9 @@
+ void
+ g_type_init (void)
+ {
++#if !defined(__GLIBC__)
++  gobject_init();
++#endif 
+   g_assert_type_system_initialized ();
+ }
+ 
+@@ -4372,6 +4393,12 @@
+   TypeNode *node;
+   GType type;
+ 
++#if !defined(__GLIBC__)
++  static int gobject_initialized = 0;
++  if (gobject_initialized)
++    return;
++  gobject_initialized = 1;
++#endif
+   /* Ensure GLib is initialized first, see
+    * https://bugzilla.gnome.org/show_bug.cgi?id=756139
+    */

diff --git a/dev-libs/glib/files/quark_init_on_demand.patch 
b/dev-libs/glib/files/quark_init_on_demand.patch
new file mode 100644
index 0000000..4c07fa7
--- /dev/null
+++ b/dev-libs/glib/files/quark_init_on_demand.patch
@@ -0,0 +1,77 @@
+musl does not run ctors in the assumed order that glib-2.46 expects.
+Call g_quark_init() where it is expected to have been called.
+
+
+--- a/glib/gquark.c    2016-08-17 17:20:47.000000000 +0200
++++ b/glib/gquark.c    2016-08-30 07:49:13.298234757 +0200
+@@ -57,6 +57,9 @@
+ void
+ g_quark_init (void)
+ {
++  if (quark_ht)
++    return;
++
+   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);
+@@ -138,9 +141,12 @@
+     return 0;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
+   G_UNLOCK (quark_global);
+
+   return quark;
+ }
+ 
+@@ -209,6 +213,9 @@
+     return 0;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = quark_from_string (string, TRUE);
+   G_UNLOCK (quark_global);
+ 
+@@ -243,6 +248,9 @@
+     return 0;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = quark_from_string (string, FALSE);
+   G_UNLOCK (quark_global);
+ 
+@@ -280,6 +286,7 @@
+   GQuark quark;
+   gchar **quarks_new;
+ 
++  g_quark_init ();
+   if (quark_seq_id % QUARK_BLOCK_SIZE == 0)
+     {
+       quarks_new = g_new (gchar*, quark_seq_id + QUARK_BLOCK_SIZE);
+@@ -323,6 +330,9 @@
+     return NULL;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = quark_from_string (string, TRUE);
+   result = quarks[quark];
+   G_UNLOCK (quark_global);
+@@ -353,6 +361,9 @@
+     return NULL;
+ 
+   G_LOCK (quark_global);
++#if !defined(__GLIBC__)
++  g_quark_init ();
++#endif
+   quark = quark_from_string (string, FALSE);
+   result = quarks[quark];
+   G_UNLOCK (quark_global);

diff --git a/dev-libs/glib/glib-2.48.2.ebuild b/dev-libs/glib/glib-2.48.2.ebuild
index dbcb2ca..707a4f6 100644
--- a/dev-libs/glib/glib-2.48.2.ebuild
+++ b/dev-libs/glib/glib-2.48.2.ebuild
@@ -1,6 +1,5 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id$
 
 # Until bug #537330 glib is a reverse dependency of pkgconfig and, then
 # adding new dependencies end up making stage3 to grow. Every addition needs
@@ -84,7 +83,8 @@ pkg_setup() {
 
 src_prepare() {
        # Fix for MUSL
-       epatch "${FILESDIR}"/${P}-musl-glibmm.patch
+       eapply "${FILESDIR}"/quark_init_on_demand.patch
+       eapply "${FILESDIR}"/gobject_init_on_demand.patch
 
        # Prevent build failure in stage3 where pkgconfig is not available, bug 
#481056
        mv -f "${WORKDIR}"/pkg-config-*/pkg.m4 "${S}"/m4macros/ || die
@@ -116,6 +116,8 @@ src_prepare() {
                sed -i -e 's/ tests//' {.,gio,glib}/Makefile.am || die
        fi
 
+       eapply "${FILESDIR}"/${PN}-2.50.3-fix-gdatetime-tests.patch
+
        # gdbus-codegen is a separate package
        eapply "${FILESDIR}"/${PN}-2.40.0-external-gdbus-codegen.patch
 

Reply via email to