From 2c5d1b2b27fe2f5aa4dfb7f4caa73f3962b95b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Wed, 13 Jan 2021 11:35:37 -0300 Subject: [PATCH 1/3] glib: also build static libraries. Remove LTO from build to avoid issues when linking qemu-user-static. Thanks to leah for finding the fix. --- srcpkgs/glib/template | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template index 0d6de76ea88..7a51624cde8 100644 --- a/srcpkgs/glib/template +++ b/srcpkgs/glib/template @@ -1,10 +1,12 @@ # Template file for 'glib' pkgname=glib version=2.66.2 -revision=1 +revision=2 build_style=meson +# static version is necessary for qemu-user-static; +# also disable LTO, otherwise there are multiple failures when linking qemu configure_args="-Dfam=false -Dman=true -Dselinux=disabled - $(vopt_bool gtk_doc gtk_doc)" + $(vopt_bool gtk_doc gtk_doc) --default-library=both -Db_lto=false" hostmakedepends="gettext pkg-config libxslt docbook-xsl $(vopt_if gtk_doc gtk-doc)" makedepends="zlib-devel pcre-devel libffi-devel dbus-devel elfutils-devel libmount-devel" checkdepends="desktop-file-utils shared-mime-info tzdata dbus" @@ -36,6 +38,7 @@ libglib-devel_package() { vmove usr/lib/glib-2.0 vmove usr/lib/pkgconfig vmove "usr/lib/*.so" + vmove "usr/lib/*.a" } } From 1e4db3d501303642c29529568daa8efac42cb6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Wed, 13 Jan 2021 11:36:06 -0300 Subject: [PATCH 2/3] qemu-user-static: revbump to link against new glib version. Also, move from libglib-static to libglib-devel, which now includes static versions of each library. --- srcpkgs/qemu-user-static/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template index 608dc27d982..dc2b3922e72 100644 --- a/srcpkgs/qemu-user-static/template +++ b/srcpkgs/qemu-user-static/template @@ -1,10 +1,10 @@ # Template file for 'qemu-user-static' pkgname=qemu-user-static version=5.1.0 -revision=1 +revision=2 wrksrc="qemu-${version}" hostmakedepends="pkg-config automake python3" -makedepends="dtc-devel libglib-static pixman-devel libuuid-devel" +makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel" short_desc="QEMU User-mode emulators (statically compiled)" maintainer="Orphaned " license="GPL-2.0-or-later, LGPL-2.1-or-later" From 9371d7cd0422536b7478b0457d5af439d3ee197d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Wed, 13 Jan 2021 11:37:04 -0300 Subject: [PATCH 3/3] libglib-static: remove package. No longer necessary, now that glib includes static libraries. --- .../patches/gobject_init_on_demand.patch | 91 ------------------- .../patches/quark_init_on_demand.patch | 37 -------- srcpkgs/libglib-static/template | 49 ---------- 3 files changed, 177 deletions(-) delete mode 100644 srcpkgs/libglib-static/patches/gobject_init_on_demand.patch delete mode 100644 srcpkgs/libglib-static/patches/quark_init_on_demand.patch delete mode 100644 srcpkgs/libglib-static/template diff --git a/srcpkgs/libglib-static/patches/gobject_init_on_demand.patch b/srcpkgs/libglib-static/patches/gobject_init_on_demand.patch deleted file mode 100644 index bcc3cabfbcd..00000000000 --- a/srcpkgs/libglib-static/patches/gobject_init_on_demand.patch +++ /dev/null @@ -1,91 +0,0 @@ -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. - ---- gobject/gtype.c 2016-08-17 17:20:47.000000000 +0200 -+++ 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/srcpkgs/libglib-static/patches/quark_init_on_demand.patch b/srcpkgs/libglib-static/patches/quark_init_on_demand.patch deleted file mode 100644 index 458a2adab43..00000000000 --- a/srcpkgs/libglib-static/patches/quark_init_on_demand.patch +++ /dev/null @@ -1,37 +0,0 @@ -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. - - ---- glib/gquark.c 2016-08-17 17:20:47.000000000 +0200 -+++ 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); diff --git a/srcpkgs/libglib-static/template b/srcpkgs/libglib-static/template deleted file mode 100644 index 83dc7323082..00000000000 --- a/srcpkgs/libglib-static/template +++ /dev/null @@ -1,49 +0,0 @@ -# Template file for 'libglib-static' -# -# This is only used for qemu-user-static until meson figures out building static -# glib 2.60.0 via meson. -# -pkgname=libglib-static -version=2.58.3 -revision=5 -wrksrc="glib-${version}" -build_style=gnu-configure -configure_args="--enable-libelf --disable-fam --disable-shared --with-pcre=system - --enable-static" -hostmakedepends="automake gettext libtool pkg-config python3 libxslt docbook-xsl" -makedepends="zlib-devel pcre-devel libffi-devel dbus-devel elfutils-devel libmount-devel" -depends="$makedepends" -short_desc="GNU library of C routines" -maintainer="Enno Boland " -license="LGPL-2.1-or-later" -homepage="https://wiki.gnome.org/Projects/GLib" -changelog="https://gitlab.gnome.org/GNOME/glib/raw/master/NEWS" -distfiles="${GNOME_SITE}/glib/${version%.*}/glib-${version}.tar.xz" -checksum=8f43c31767e88a25da72b52a40f3301fefc49a665b56dc10ee7cc9565cbe7481 -conflicts="libglib-devel>=0" - -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" glib-devel" - case "$XBPS_TARGET_MACHINE" in - mips*|ppc|ppc-musl) # It seems mips/ppc autoconf cache is not read? - configure_args+=" glib_cv_stack_grows=no glib_cv_rtldglobal_broken=no glib_cv_uscore=no" ;; - esac -fi - -post_patch() { - # Better to just rm -rf /usr/lib/locale in post_install? - vsed -i -e "s,localedir=.*,localedir=/usr/share/locale," \ - -e "s,DATADIRNAME=lib,DATADIRNAME=share," \ - m4macros/glib-gettext.m4 - vsed -i -e "s,^localedir =.*,localedir = /usr/share/locale," \ - po/Makefile.in.in -} - -pre_configure() { - NOCONFIGURE=1 ./autogen.sh -} - -post_install() { - rm -r $DESTDIR/usr/bin - rm -r $DESTDIR/usr/share -}