about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-06-25 09:45:45 -0500
committerWill Dietz <w@wdtz.org>2018-06-25 09:47:51 -0500
commit7fa6b340931acaccfa8211f0dd2ef4938e68ea17 (patch)
treeef9fca4fa6db46051aa060ccd4e2242760ae6afd /pkgs/development
parent01847b7c5f961d869e6823e54bbfe19eab077034 (diff)
downloadnixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar.gz
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar.bz2
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar.lz
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar.xz
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.tar.zst
nixlib-7fa6b340931acaccfa8211f0dd2ef4938e68ea17.zip
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
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/glib/default.nix1
-rw-r--r--pkgs/development/libraries/glib/quark_init_on_demand.patch33
2 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index ac921227740c..a793bf5f7521 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch
     ++ optional doCheck ./skip-timer-test.patch
+    ++ optional stdenv.hostPlatform.isMusl ./quark_init_on_demand.patch
     ++ [ ./schema-override-variable.patch ];
 
   outputs = [ "out" "dev" "devdoc" ];
diff --git a/pkgs/development/libraries/glib/quark_init_on_demand.patch b/pkgs/development/libraries/glib/quark_init_on_demand.patch
new file mode 100644
index 000000000000..168086484314
--- /dev/null
+++ b/pkgs/development/libraries/glib/quark_init_on_demand.patch
@@ -0,0 +1,33 @@
+--- glib-source/glib/gquark.c	2016-08-17 17:20:47.000000000 +0200
++++ glib-source/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;
+ }
+ 
+@@ -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);