Upgraded Glib from 2.72.0 to 2.84.3

This commit is contained in:
dslm4515
2025-07-04 17:18:17 -05:00
parent c1ac5498b4
commit 35ea2d6d95
4 changed files with 28 additions and 142 deletions

View File

@ -1,15 +1,14 @@
#! /bin/bash
# Glib 2.74.5
# Source: ftp://ftp.acc.umu.se/pub/gnome/sources/glib/2.72/glib-2.72.0.tar.xz
# Source: https://download.gnome.org/sources/glib/2.74/glib-2.74.5.tar.xz
# Glib
# Source: https://download.gnome.org/sources/glib/2.84/glib-2.84.3.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: libxslt and PCRE
# Recommended: docutils, libxslt and PCRE
# Optional: dbus, bindfs, GDB, docbook-xml, docbook-xsl,
# Optional: GTK-Doc, glib-networking, gobject-introspection
# LTO: Tested with LLVM
@ -20,27 +19,40 @@ export CFLAGS+="-O3 -Ofast -falign-functions=32 -ffat-lto-objects -flto=auto "
export CFLAGS+="-fno-semantic-interposition -mprefer-vector-width=256 "
export LDFLAGS="-flto=auto -Wl,-O2 -Wl,--as-needed "
patch -Np1 -i ../patches/glib-lfs/glib-2.74.5-skip_warnings-1.patch
# If desired, apply the optional patch, per LFS.
# In many cases, applications that use this library, either directly
# or indirectly via other libraries such as GTK, output numerous
# warnings when run from the command line. This patch enables the
# use of an environment variable, GLIB_LOG_LEVEL, that suppresses
# unwanted messages. The value of the variable is a digit that
# corresponds to:
# 1 Alert
# 2 Critical
# 3 Error
# 4 Warning
# 5 Notice
# For instance export GLIB_LOG_LEVEL=4 will skip output of Warning
# and Notice messages (and Info/Debug messages if they are turned
# on). If GLIB_LOG_LEVEL is not defined, normal message output will
# not be affected.
patch -Np1 -i ../patches/glib-lfs/glib-skip_warnings-1.patch
mkdir build &&
cd build &&
export PVER="2.84.3"
meson --prefix=/usr \
-Dman=true \
-Dselinux=disabled \
.. &&
meson --prefix=/usr -Dman=false \
-Dselinux=disabled OUT &&
read -p "Compile?" && ninja -j2 &&
read -p "Compile?" && ninja -C OUT -j2 &&
read -p "Press Enter to install" &&
# if not using a package manager:
# ninja install
# Install may fail due to missint 'otool'. Use a link for now.
sudo -S ln -sv ../../bin/true /usr/bin/otool
#sudo -S ln -sv ../../bin/true /usr/bin/otool
# if using pkgtools from Slackware, then:
sudo -S DESTDIR=$BUILD ninja install &&
sudo -S DESTDIR=$BUILD ninja -C OUT install &&
sudo -S mkdir -pv /BMAN/install
sudo -S mkdir -pv /BMAN/usr/share
sudo -S mv $BUILD/usr/share/man /BMAN/usr/share/
@ -71,7 +83,7 @@ EOF
sudo mv /tmp/slack-desc install/ &&
read -p "Enter to build and install package" &&
sudo makepkg -l y -c n $PKGS/glib-2.74.5-${NOPSUFFIX} &&
sudo makepkg -l y -c n $PKGS/glib-$PVER-${PSUFFIX} &&
cd /BMAN
cat > /tmp/slack-desc << "EOF"
@ -84,6 +96,6 @@ glib-doc: GLib is required by nearly everything that uses GTK+ 1/2/3/4.x
glib-doc:
EOF
sudo mv /tmp/slack-desc install/
sudo makepkg -l y -c n $PKGS/glib-doc-2.74.5-${NOPSUFFIX}
sudo makepkg -l y -c n $PKGS/glib-doc-$PVER-${NOPSUFFIX}
sudo rm -rf /BMAN/*
sudo rm -rf $BUILD/*

View File

@ -1,47 +0,0 @@
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

View File

@ -1,79 +0,0 @@
Submitted By: Bruce Dubbs <bdubbs@linuxfromscratch.org>
Rediffed By: Douglas R. Reno <renodr at linuxfromscratch dot org>
Date: 2017-10-15
Rediffed Date: 2021-04-01
Initial Package Version: 2.54.0
Upstream Status: Not submitted
Origin: Self
Description: Adds a capabiility to skip printing warning messages using
an environment variable: GLIB_LOG_LEVEL. The value
of the variable is a digit that correponds to:
1 Alert
2 Critical
3 Error
4 Warning
5 Notice
For instance GLIB_LOG_LEVEL=4 will skip output of Warning and
Notice messages (and Info/Debug messages if they are turned on).
Rediffed for 2.68.0 to reduce the fuzz warnings.
diff -Naurp glib-2.68.0.orig/glib/gmessages.c glib-2.68.0/glib/gmessages.c
--- glib-2.68.0.orig/glib/gmessages.c 2021-03-18 08:28:31.909625000 -0500
+++ glib-2.68.0/glib/gmessages.c 2021-04-01 20:32:23.517596280 -0500
@@ -528,6 +528,34 @@ static GDestroyNotify log_writer_user_da
/* --- functions --- */
+/* skip_message
+ *
+ * This internal function queries an optional environment variable,
+ * GLIB_LOG_LEVEL and converts it to a value consistent
+ * with the type GLogLevelFlags. If the value is equal to
+ * or greater than the integer equivalent of the log_level,
+ * then the function returns a boolean that indicates that
+ * logging the output should be skipped.
+ */
+
+static gboolean skip_message( GLogLevelFlags log_level);
+
+static gboolean skip_message( GLogLevelFlags log_level)
+{
+ char* user_log_level;
+ int user_log_int;
+ gboolean skip = FALSE;
+
+ user_log_level = getenv( "GLIB_LOG_LEVEL" );
+
+ user_log_int = ( user_log_level != NULL ) ? atoi( user_log_level ) : 0;
+ user_log_int = ( user_log_level != 0 ) ? 1 << user_log_int : 0;
+
+ if ( user_log_int >= log_level ) skip = TRUE;
+
+ return skip;
+}
+
static void _g_log_abort (gboolean breakpoint);
static void
@@ -2591,6 +2619,9 @@ g_log_writer_standard_streams (GLogLevel
g_return_val_if_fail (fields != NULL, G_LOG_WRITER_UNHANDLED);
g_return_val_if_fail (n_fields > 0, G_LOG_WRITER_UNHANDLED);
+ /* If the user does not want this message level, just return */
+ if ( skip_message( log_level) ) return G_LOG_WRITER_HANDLED;
+
stream = log_level_to_file (log_level);
if (!stream || fileno (stream) < 0)
return G_LOG_WRITER_UNHANDLED;
@@ -2818,6 +2849,9 @@ _g_log_writer_fallback (GLogLevelFlags
FILE *stream;
gsize i;
+ /* If the user does not want this message level, just return */
+ if ( skip_message( log_level) ) return G_LOG_WRITER_HANDLED;
+
/* we cannot call _any_ GLib functions in this fallback handler,
* which is why we skip UTF-8 conversion, etc.
* since we either recursed or ran out of memory, we're in a pretty