summaryrefslogtreecommitdiff
path: root/repo/system/glib
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
commit739c65c54cb0e957df5e9b76f93fb02554e5cac3 (patch)
tree09ddfa0a342f3ea9de136cb50abdd79821bf1b53 /repo/system/glib
parent4c585ad54388285500fd18a6aaa516894e0f2c16 (diff)
moved everything to new file formatting
Diffstat (limited to 'repo/system/glib')
-rw-r--r--repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch47
-rw-r--r--repo/system/glib/deprecated-no-warn.patch23
-rw-r--r--repo/system/glib/glib.xibuild36
-rw-r--r--repo/system/glib/musl-libintl.patch22
4 files changed, 128 insertions, 0 deletions
diff --git a/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch b/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch
new file mode 100644
index 0000000..50a9a8c
--- /dev/null
+++ b/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch
@@ -0,0 +1,47 @@
+From e4216dee57f5156e192b2910f13eb855a104cb18 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 6 Jul 2016 12:38:40 +0200
+Subject: [PATCH] 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 9e51a92..17ecd7f 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);
+@@ -179,6 +184,9 @@ quark_from_string (const gchar *string,
+ {
+ GQuark quark = 0;
+
++ 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/repo/system/glib/deprecated-no-warn.patch b/repo/system/glib/deprecated-no-warn.patch
new file mode 100644
index 0000000..e247eca
--- /dev/null
+++ b/repo/system/glib/deprecated-no-warn.patch
@@ -0,0 +1,23 @@
+diff -Naur a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
+--- a/gio/glib-compile-schemas.c 2018-09-21 15:23:52.000000000 +0100
++++ b/gio/glib-compile-schemas.c 2019-02-10 14:37:30.034879344 +0000
+@@ -1233,19 +1233,6 @@
+ return;
+ }
+
+- if (path && (g_str_has_prefix (path, "/apps/") ||
+- g_str_has_prefix (path, "/desktop/") ||
+- g_str_has_prefix (path, "/system/")))
+- {
+- gchar *message = NULL;
+- message = g_strdup_printf (_("Warning: Schema “%s” has path “%s”. "
+- "Paths starting with "
+- "“/apps/”, “/desktop/” or “/system/” are deprecated."),
+- id, path);
+- g_printerr ("%s\n", message);
+- g_free (message);
+- }
+-
+ state->schema_state = schema_state_new (path, gettext_domain,
+ extends, extends_name, list_of);
+
diff --git a/repo/system/glib/glib.xibuild b/repo/system/glib/glib.xibuild
new file mode 100644
index 0000000..870e600
--- /dev/null
+++ b/repo/system/glib/glib.xibuild
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+MAKEDEPS="meson ninja docbook-xsl docbook-dtd"
+DEPS="pcre libffi zlib musl libxslt gdbm"
+
+PKG_VER=2.72.1
+SOURCE=https://download.gnome.org/sources/glib/$(echo $PKG_VER | cut -d. -f-2)/glib-$PKG_VER.tar.xz
+DESC="Low level core library"
+ADDITIONAL="
+0001-gquark-fix-initialization-with-c-constructors.patch
+deprecated-no-warn.patch
+musl-libintl.patch"
+
+prepare () {
+ apply_patches
+}
+
+build () {
+ mkdir build &&
+ cd build &&
+
+ meson --prefix=/usr \
+ --buildtype=release \
+ -Dman=false \
+ .. &&
+ ninja
+}
+package () {
+ DESTDIR=$PKG_DEST ninja install
+ mkdir -p $PKG_DEST/usr/share/doc/glib-$PKG_VER &&
+ cp -r ../docs/reference/NEWS $PKG_DEST/usr/share/doc/glib-$PKG_VER
+ cp -r ../docs/reference/gio $PKG_DEST/usr/share/doc/glib-$PKG_VER
+ cp -r ../docs/reference/glib $PKG_DEST/usr/share/doc/glib-$PKG_VER
+ cp -r ../docs/reference/gobject $PKG_DEST/usr/share/doc/glib-$PKG_VER
+
+}
diff --git a/repo/system/glib/musl-libintl.patch b/repo/system/glib/musl-libintl.patch
new file mode 100644
index 0000000..a673800
--- /dev/null
+++ b/repo/system/glib/musl-libintl.patch
@@ -0,0 +1,22 @@
+diff --git a/meson.build b/meson.build
+index 319f183..3a5fdfc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2047,9 +2047,6 @@ endif
+ # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
+ # implementations. This could be extended if issues are found in some platforms.
+ libintl_deps = []
+-if cc.has_function('ngettext')
+- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
+-else
+ # First just find the bare library.
+ libintl = cc.find_library('intl', required : false)
+ # The bare library probably won't link without help if it's static.
+@@ -2081,7 +2078,6 @@ else
+ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', args : osx_ldflags,
+ dependencies : libintl_deps)
+ endif
+-endif
+
+ glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
+