Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
@ 2021-01-13 15:49 ericonr
  2021-01-13 19:48 ` [PR PATCH] [Updated] " ericonr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ericonr @ 2021-01-13 15:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

There is a new pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 8620 bytes --]

From ff1be5a25988dee0d91853ac887ac223546b6465 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:35:37 -0300
Subject: [PATCH 1/3] glib: also build static libraries.

---
 srcpkgs/glib/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template
index 0d6de76ea88..9ac4b7734fd 100644
--- a/srcpkgs/glib/template
+++ b/srcpkgs/glib/template
@@ -1,10 +1,11 @@
 # 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
 configure_args="-Dfam=false -Dman=true -Dselinux=disabled
- $(vopt_bool gtk_doc gtk_doc)"
+ $(vopt_bool gtk_doc gtk_doc) --default-library=both"
 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 +37,7 @@ libglib-devel_package() {
 		vmove usr/lib/glib-2.0
 		vmove usr/lib/pkgconfig
 		vmove "usr/lib/*.so"
+		vmove "usr/lib/*.a"
 	}
 }
 

From 810738c867390476cb71c3a7397a14b320793934 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
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 <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"

From 0eef039c3ed7e819c58c0f2ca446c23824174310 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
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 <gottox@voidlinux.org>"
-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
-}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
@ 2021-01-13 19:48 ` ericonr
  2021-02-11  2:32 ` ericonr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-01-13 19:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 8818 bytes --]

From 2c5d1b2b27fe2f5aa4dfb7f4caa73f3962b95b9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
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?= <erico.erc@gmail.com>
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 <orphan@voidlinux.org>"
 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?= <erico.erc@gmail.com>
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 <gottox@voidlinux.org>"
-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
-}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
  2021-01-13 19:48 ` [PR PATCH] [Updated] " ericonr
@ 2021-02-11  2:32 ` ericonr
  2021-02-11  2:50 ` ericonr
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11  2:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 12270 bytes --]

From 04da3756b616c3bdbced49e74c312f1c3b6c6622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 17:37:28 -0300
Subject: [PATCH 1/4] Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d033f0165990cb66af88ed216e9b17046.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
---
 common/build-style/meson.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index 6eb2dc530da..b1eddda36e7 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -92,6 +92,14 @@ do_configure() {
 		configure_args+=" --cross-file=${meson_crossfile}"
 	fi
 
+	# binutils ar needs a plugin when LTO is used on static libraries, so we
+	# have to use the gcc-ar wrapper that calls the correct plugin.
+	# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
+	# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
+	# issues with static libraries + LTO by defaulting to gcc-ar themselves.
+	# We also force gcc-ar usage in the crossfile above.
+	export AR="gcc-ar"
+
 	${meson_cmd} \
 		--prefix=/usr \
 		--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \

From f8fc3729ce1b286e987e848db5c871f5106ff91b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:36:06 -0300
Subject: [PATCH 2/4] qemu-user-static: update to 5.2.0.

Also, move from libglib-static to libglib-devel, which now includes
static versions of each library.
---
 srcpkgs/qemu-user-static/template | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 608dc27d982..31371d19faa 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,16 +1,18 @@
 # Template file for 'qemu-user-static'
+# This package should be updated together with qemu
 pkgname=qemu-user-static
-version=5.1.0
+version=5.2.0
 revision=1
 wrksrc="qemu-${version}"
-hostmakedepends="pkg-config automake python3"
-makedepends="dtc-devel libglib-static pixman-devel libuuid-devel"
+build_style=configure
+hostmakedepends="pkg-config automake python3 ninja"
+makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=8314b6e5fcc7bf9fa3915d504de6586a69cba30ffa27cbe9ba85d2cb9987fb3a
+checksum=7bd9334c02edaf02f5b0b52beb19fe7f72556c3ca0180e20f0095f0ef2f25f14
 
 _fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
 
@@ -79,10 +81,6 @@ done
 
 binfmts="${binfmts%?}"
 
-post_extract() {
-	sed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
-}
-
 do_configure() {
 	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec \
 		--disable-kvm --disable-vnc-png \
@@ -91,10 +89,6 @@ do_configure() {
 		--static
 }
 
-do_build() {
-	make ${makejobs} LDFLAGS="-static -lrt -luuid"
-}
-
 do_install() {
 	make DESTDIR=${DESTDIR} install
 	# Remove unneeded stuff.

From 649d15a4f2f4254f1fcae4aca8a8447049b8478c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 10 Feb 2021 23:19:15 -0300
Subject: [PATCH 3/4] qemu: remove unnecessary vsed and add comment about
 qemu-user-static.

It's important to update the two packages together, since they share the
patches folder.
---
 srcpkgs/qemu/patches/musl-initialize-msghdr.patch | 15 +++++++++++++++
 srcpkgs/qemu/template                             |  5 +----
 2 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/musl-initialize-msghdr.patch

diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
new file mode 100644
index 00000000000..c195f0c0b1f
--- /dev/null
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -0,0 +1,15 @@
+Source: https://github.com/void-linux/void-packages/issues/23557
+
+diff --git linux-user/syscall.c linux-user/syscall.c
+index 945fc25..8d8b68a 100644
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+                                       int flags, int send)
+ {
+     abi_long ret, len;
+-    struct msghdr msg;
++    struct msghdr msg = {0};
+     abi_ulong count;
+     struct iovec *vec;
+     abi_ulong target_vec;
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index e8cb4d4672c..ac19de618dc 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,4 +1,5 @@
 # Template file for 'qemu'
+# This package should be updated together with qemu-user-static
 pkgname=qemu
 version=5.2.0
 revision=1
@@ -46,10 +47,6 @@ if [ -z "$CROSS_BUILD" ]; then
 	build_options_default+=" smartcard"
 fi
 
-pre_configure() {
-	vsed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
-}
-
 do_configure() {
 	local args=
 

From eb0f8a87a47984c01fa4676d9bf905e63d0eaec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:37:04 -0300
Subject: [PATCH 4/4] 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 <gottox@voidlinux.org>"
-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
-}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
  2021-01-13 19:48 ` [PR PATCH] [Updated] " ericonr
  2021-02-11  2:32 ` ericonr
@ 2021-02-11  2:50 ` ericonr
  2021-02-11  3:14 ` ericonr
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11  2:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 12473 bytes --]

From 04da3756b616c3bdbced49e74c312f1c3b6c6622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 17:37:28 -0300
Subject: [PATCH 1/4] Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d033f0165990cb66af88ed216e9b17046.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
---
 common/build-style/meson.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index 6eb2dc530da..b1eddda36e7 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -92,6 +92,14 @@ do_configure() {
 		configure_args+=" --cross-file=${meson_crossfile}"
 	fi
 
+	# binutils ar needs a plugin when LTO is used on static libraries, so we
+	# have to use the gcc-ar wrapper that calls the correct plugin.
+	# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
+	# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
+	# issues with static libraries + LTO by defaulting to gcc-ar themselves.
+	# We also force gcc-ar usage in the crossfile above.
+	export AR="gcc-ar"
+
 	${meson_cmd} \
 		--prefix=/usr \
 		--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \

From 66a005d425a4d16f4497a78c635757e9a07361b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:36:06 -0300
Subject: [PATCH 2/4] qemu-user-static: update to 5.2.0.

Also, move from libglib-static to libglib-devel, which now includes
static versions of each library.

Pick up tricks from qemu for cross compilation.
---
 srcpkgs/qemu-user-static/template | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 608dc27d982..f2c0d6a1d91 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,16 +1,18 @@
 # Template file for 'qemu-user-static'
+# This package should be updated together with qemu
 pkgname=qemu-user-static
-version=5.1.0
+version=5.2.0
 revision=1
 wrksrc="qemu-${version}"
-hostmakedepends="pkg-config automake python3"
-makedepends="dtc-devel libglib-static pixman-devel libuuid-devel"
+build_style=configure
+hostmakedepends="pkg-config automake python3 ninja"
+makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=8314b6e5fcc7bf9fa3915d504de6586a69cba30ffa27cbe9ba85d2cb9987fb3a
+checksum=7bd9334c02edaf02f5b0b52beb19fe7f72556c3ca0180e20f0095f0ef2f25f14
 
 _fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
 
@@ -79,20 +81,18 @@ done
 
 binfmts="${binfmts%?}"
 
-post_extract() {
-	sed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
-}
-
 do_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		_args="--cross-prefix=${XBPS_CROSS_TRIPLET}-"
+		export LIBTOOL=libtool
+	fi
+	unset CPP
+
 	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec \
 		--disable-kvm --disable-vnc-png \
 		--disable-virtfs --disable-fdt --disable-seccomp \
 		--enable-linux-user --disable-system \
-		--static
-}
-
-do_build() {
-	make ${makejobs} LDFLAGS="-static -lrt -luuid"
+		--static ${_args}
 }
 
 do_install() {

From 307999a4fdd666cacd250a66670cbb802aa546f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 10 Feb 2021 23:19:15 -0300
Subject: [PATCH 3/4] qemu: remove unnecessary vsed and add comment about
 qemu-user-static.

It's important to update the two packages together, since they share the
patches folder.
---
 srcpkgs/qemu/patches/musl-initialize-msghdr.patch | 15 +++++++++++++++
 srcpkgs/qemu/template                             |  5 +----
 2 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/musl-initialize-msghdr.patch

diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
new file mode 100644
index 00000000000..c195f0c0b1f
--- /dev/null
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -0,0 +1,15 @@
+Source: https://github.com/void-linux/void-packages/issues/23557
+
+diff --git linux-user/syscall.c linux-user/syscall.c
+index 945fc25..8d8b68a 100644
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+                                       int flags, int send)
+ {
+     abi_long ret, len;
+-    struct msghdr msg;
++    struct msghdr msg = {0};
+     abi_ulong count;
+     struct iovec *vec;
+     abi_ulong target_vec;
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index e8cb4d4672c..ac19de618dc 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,4 +1,5 @@
 # Template file for 'qemu'
+# This package should be updated together with qemu-user-static
 pkgname=qemu
 version=5.2.0
 revision=1
@@ -46,10 +47,6 @@ if [ -z "$CROSS_BUILD" ]; then
 	build_options_default+=" smartcard"
 fi
 
-pre_configure() {
-	vsed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
-}
-
 do_configure() {
 	local args=
 

From 1a700916afeca1018dd2811afdc5687f72139ad7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:37:04 -0300
Subject: [PATCH 4/4] 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 <gottox@voidlinux.org>"
-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
-}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
                   ` (2 preceding siblings ...)
  2021-02-11  2:50 ` ericonr
@ 2021-02-11  3:14 ` ericonr
  2021-02-11  6:21 ` ericonr
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11  3:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 12268 bytes --]

From 04da3756b616c3bdbced49e74c312f1c3b6c6622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 17:37:28 -0300
Subject: [PATCH 1/4] Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d033f0165990cb66af88ed216e9b17046.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
---
 common/build-style/meson.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index 6eb2dc530da..b1eddda36e7 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -92,6 +92,14 @@ do_configure() {
 		configure_args+=" --cross-file=${meson_crossfile}"
 	fi
 
+	# binutils ar needs a plugin when LTO is used on static libraries, so we
+	# have to use the gcc-ar wrapper that calls the correct plugin.
+	# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
+	# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
+	# issues with static libraries + LTO by defaulting to gcc-ar themselves.
+	# We also force gcc-ar usage in the crossfile above.
+	export AR="gcc-ar"
+
 	${meson_cmd} \
 		--prefix=/usr \
 		--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \

From 2fa9082be3006690700c424c8ca846d4da76e7cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:36:06 -0300
Subject: [PATCH 2/4] qemu-user-static: update to 5.2.0.

Also, move from libglib-static to libglib-devel, which now includes
static versions of each library.

Pick up tricks from qemu for cross compilation.
---
 srcpkgs/qemu-user-static/template | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 608dc27d982..01d4d7acb56 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,16 +1,18 @@
 # Template file for 'qemu-user-static'
+# This package should be updated together with qemu
 pkgname=qemu-user-static
-version=5.1.0
+version=5.2.0
 revision=1
 wrksrc="qemu-${version}"
-hostmakedepends="pkg-config automake python3"
-makedepends="dtc-devel libglib-static pixman-devel libuuid-devel"
+build_style=configure
+hostmakedepends="pkg-config automake python3 ninja"
+makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=8314b6e5fcc7bf9fa3915d504de6586a69cba30ffa27cbe9ba85d2cb9987fb3a
+checksum=7bd9334c02edaf02f5b0b52beb19fe7f72556c3ca0180e20f0095f0ef2f25f14
 
 _fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
 
@@ -80,19 +82,21 @@ done
 binfmts="${binfmts%?}"
 
 post_extract() {
-	sed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
+	vsed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
 }
 
 do_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		_args="--cross-prefix=${XBPS_CROSS_TRIPLET}-"
+		export LIBTOOL=libtool
+	fi
+	unset CPP
+
 	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec \
 		--disable-kvm --disable-vnc-png \
 		--disable-virtfs --disable-fdt --disable-seccomp \
 		--enable-linux-user --disable-system \
-		--static
-}
-
-do_build() {
-	make ${makejobs} LDFLAGS="-static -lrt -luuid"
+		--static ${_args}
 }
 
 do_install() {

From b6a76c9ab4abd96fb19273cc134de261b2ca1206 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 10 Feb 2021 23:19:15 -0300
Subject: [PATCH 3/4] qemu: add comment about qemu-user-static.

It's important to update the two packages together, since they share the
patches folder.
---
 srcpkgs/qemu/patches/musl-initialize-msghdr.patch | 15 +++++++++++++++
 srcpkgs/qemu/template                             |  1 +
 2 files changed, 16 insertions(+)
 create mode 100644 srcpkgs/qemu/patches/musl-initialize-msghdr.patch

diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
new file mode 100644
index 00000000000..c195f0c0b1f
--- /dev/null
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -0,0 +1,15 @@
+Source: https://github.com/void-linux/void-packages/issues/23557
+
+diff --git linux-user/syscall.c linux-user/syscall.c
+index 945fc25..8d8b68a 100644
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+                                       int flags, int send)
+ {
+     abi_long ret, len;
+-    struct msghdr msg;
++    struct msghdr msg = {0};
+     abi_ulong count;
+     struct iovec *vec;
+     abi_ulong target_vec;
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index e8cb4d4672c..88573064518 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,4 +1,5 @@
 # Template file for 'qemu'
+# This package should be updated together with qemu-user-static
 pkgname=qemu
 version=5.2.0
 revision=1

From 4613047432dec5873bebe6d642145883f1fb4547 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:37:04 -0300
Subject: [PATCH 4/4] 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 <gottox@voidlinux.org>"
-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
-}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
                   ` (3 preceding siblings ...)
  2021-02-11  3:14 ` ericonr
@ 2021-02-11  6:21 ` ericonr
  2021-02-11  6:28 ` ericonr
  2021-02-11 18:22 ` [PR PATCH] [Merged]: Remove " ericonr
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11  6:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 13003 bytes --]

From 72097d54438a453da35e46c9261f09dd87e3667c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 17:37:28 -0300
Subject: [PATCH 1/3] Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d033f0165990cb66af88ed216e9b17046.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
---
 common/build-style/meson.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index 6eb2dc530da..b1eddda36e7 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -92,6 +92,14 @@ do_configure() {
 		configure_args+=" --cross-file=${meson_crossfile}"
 	fi
 
+	# binutils ar needs a plugin when LTO is used on static libraries, so we
+	# have to use the gcc-ar wrapper that calls the correct plugin.
+	# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
+	# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
+	# issues with static libraries + LTO by defaulting to gcc-ar themselves.
+	# We also force gcc-ar usage in the crossfile above.
+	export AR="gcc-ar"
+
 	${meson_cmd} \
 		--prefix=/usr \
 		--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \

From 5794f2707d23e256208213997ecd4fb2e05a12f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:36:06 -0300
Subject: [PATCH 2/3] qemu-user-static: update to 5.2.0.

Move from libglib-static to libglib-devel, which now includes static
versions of each library.

Pick up tricks from qemu for cross compilation.

The patch being applied fixes #23557.

Add comment to qemu about qemu-user-static. It's important to update the
two packages together, since they share the patches folder.
---
 srcpkgs/qemu-user-static/template             | 26 ++++++++++++-------
 .../qemu/patches/musl-initialize-msghdr.patch | 15 +++++++++++
 srcpkgs/qemu/template                         |  3 +++
 3 files changed, 34 insertions(+), 10 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/musl-initialize-msghdr.patch

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 608dc27d982..1627721149c 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,16 +1,20 @@
 # Template file for 'qemu-user-static'
+# This package should be updated together with qemu
 pkgname=qemu-user-static
-version=5.1.0
+version=5.2.0
 revision=1
 wrksrc="qemu-${version}"
-hostmakedepends="pkg-config automake python3"
-makedepends="dtc-devel libglib-static pixman-devel libuuid-devel"
+build_style=configure
+hostmakedepends="pkg-config automake python3 ninja"
+makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=8314b6e5fcc7bf9fa3915d504de6586a69cba30ffa27cbe9ba85d2cb9987fb3a
+checksum=7bd9334c02edaf02f5b0b52beb19fe7f72556c3ca0180e20f0095f0ef2f25f14
+# FIXME
+make_check=no
 
 _fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
 
@@ -80,19 +84,21 @@ done
 binfmts="${binfmts%?}"
 
 post_extract() {
-	sed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
+	vsed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
 }
 
 do_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		_args="--cross-prefix=${XBPS_CROSS_TRIPLET}-"
+		export LIBTOOL=libtool
+	fi
+	unset CPP
+
 	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec \
 		--disable-kvm --disable-vnc-png \
 		--disable-virtfs --disable-fdt --disable-seccomp \
 		--enable-linux-user --disable-system \
-		--static
-}
-
-do_build() {
-	make ${makejobs} LDFLAGS="-static -lrt -luuid"
+		--static ${_args}
 }
 
 do_install() {
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
new file mode 100644
index 00000000000..c195f0c0b1f
--- /dev/null
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -0,0 +1,15 @@
+Source: https://github.com/void-linux/void-packages/issues/23557
+
+diff --git linux-user/syscall.c linux-user/syscall.c
+index 945fc25..8d8b68a 100644
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+                                       int flags, int send)
+ {
+     abi_long ret, len;
+-    struct msghdr msg;
++    struct msghdr msg = {0};
+     abi_ulong count;
+     struct iovec *vec;
+     abi_ulong target_vec;
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index e8cb4d4672c..6d3bba8df89 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,4 +1,5 @@
 # Template file for 'qemu'
+# This package should be updated together with qemu-user-static
 pkgname=qemu
 version=5.2.0
 revision=1
@@ -27,6 +28,8 @@ ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
+# FIXME
+make_check=no
 
 build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi"
 build_options_default="opengl gtk3 virgl sdl2 numa iscsi"

From f50c81a888461c61f6b9d2415ce006ba76568ce9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
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 ----------
 srcpkgs/removed-packages/template             |  1 +
 4 files changed, 1 insertion(+), 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 <gottox@voidlinux.org>"
-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
-}
diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template
index 27e8669c24f..14bd76761ff 100644
--- a/srcpkgs/removed-packages/template
+++ b/srcpkgs/removed-packages/template
@@ -152,6 +152,7 @@ replaces="
  libfcitx-qt<=4.2.9.8_1
  libfcitx-qt-devel<=4.2.9.8_1
  libgksu<=2.0.12_5
+ libglib-static<=2.58.3_5
  libqzeitgeist<=0.8.0_6
  librpcsecgss<=0.19_6
  librpcsecgss-devel<=0.19_6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
                   ` (4 preceding siblings ...)
  2021-02-11  6:21 ` ericonr
@ 2021-02-11  6:28 ` ericonr
  2021-02-11 18:22 ` [PR PATCH] [Merged]: Remove " ericonr
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11  6:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages glib
https://github.com/void-linux/void-packages/pull/27894

[WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
WIP because of linking issues :/ 

I'm not sure why they are happening.

A patch file from https://github.com/void-linux/void-packages/pull/27894.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-glib-27894.patch --]
[-- Type: text/x-diff, Size: 12986 bytes --]

From 72097d54438a453da35e46c9261f09dd87e3667c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 17:37:28 -0300
Subject: [PATCH 1/3] Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d033f0165990cb66af88ed216e9b17046.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
---
 common/build-style/meson.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh
index 6eb2dc530da..b1eddda36e7 100644
--- a/common/build-style/meson.sh
+++ b/common/build-style/meson.sh
@@ -92,6 +92,14 @@ do_configure() {
 		configure_args+=" --cross-file=${meson_crossfile}"
 	fi
 
+	# binutils ar needs a plugin when LTO is used on static libraries, so we
+	# have to use the gcc-ar wrapper that calls the correct plugin.
+	# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
+	# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
+	# issues with static libraries + LTO by defaulting to gcc-ar themselves.
+	# We also force gcc-ar usage in the crossfile above.
+	export AR="gcc-ar"
+
 	${meson_cmd} \
 		--prefix=/usr \
 		--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \

From 6a4ea461d48e908a334a9dfb050c12989236ff9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 13 Jan 2021 11:36:06 -0300
Subject: [PATCH 2/3] qemu-user-static: update to 5.2.0.

Move from libglib-static to libglib-devel, which now includes static
versions of each library.

Pick up tricks from qemu for cross compilation.

The patch being applied fixes #23557.

Add comment to qemu about qemu-user-static. It's important to update the
two packages together, since they share the patches folder.
---
 srcpkgs/qemu-user-static/template             | 24 +++++++++++--------
 .../qemu/patches/musl-initialize-msghdr.patch | 15 ++++++++++++
 srcpkgs/qemu/template                         |  3 +++
 3 files changed, 32 insertions(+), 10 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/musl-initialize-msghdr.patch

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 608dc27d982..01d4d7acb56 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,16 +1,18 @@
 # Template file for 'qemu-user-static'
+# This package should be updated together with qemu
 pkgname=qemu-user-static
-version=5.1.0
+version=5.2.0
 revision=1
 wrksrc="qemu-${version}"
-hostmakedepends="pkg-config automake python3"
-makedepends="dtc-devel libglib-static pixman-devel libuuid-devel"
+build_style=configure
+hostmakedepends="pkg-config automake python3 ninja"
+makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later, LGPL-2.1-or-later"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=8314b6e5fcc7bf9fa3915d504de6586a69cba30ffa27cbe9ba85d2cb9987fb3a
+checksum=7bd9334c02edaf02f5b0b52beb19fe7f72556c3ca0180e20f0095f0ef2f25f14
 
 _fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
 
@@ -80,19 +82,21 @@ done
 binfmts="${binfmts%?}"
 
 post_extract() {
-	sed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
+	vsed -i 's/__u64/unsigned long/' linux-user/host/aarch64/hostdep.h
 }
 
 do_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		_args="--cross-prefix=${XBPS_CROSS_TRIPLET}-"
+		export LIBTOOL=libtool
+	fi
+	unset CPP
+
 	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec \
 		--disable-kvm --disable-vnc-png \
 		--disable-virtfs --disable-fdt --disable-seccomp \
 		--enable-linux-user --disable-system \
-		--static
-}
-
-do_build() {
-	make ${makejobs} LDFLAGS="-static -lrt -luuid"
+		--static ${_args}
 }
 
 do_install() {
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
new file mode 100644
index 00000000000..c195f0c0b1f
--- /dev/null
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -0,0 +1,15 @@
+Source: https://github.com/void-linux/void-packages/issues/23557
+
+diff --git linux-user/syscall.c linux-user/syscall.c
+index 945fc25..8d8b68a 100644
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+                                       int flags, int send)
+ {
+     abi_long ret, len;
+-    struct msghdr msg;
++    struct msghdr msg = {0};
+     abi_ulong count;
+     struct iovec *vec;
+     abi_ulong target_vec;
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index e8cb4d4672c..ae18a557078 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,4 +1,5 @@
 # Template file for 'qemu'
+# This package should be updated together with qemu-user-static
 pkgname=qemu
 version=5.2.0
 revision=1
@@ -27,6 +28,8 @@ ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
+# FIXME
+make_check=extended
 
 build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi"
 build_options_default="opengl gtk3 virgl sdl2 numa iscsi"

From 251306d5ba55dbd43bca7f931c82a907d10ca06b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
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 ----------
 srcpkgs/removed-packages/template             |  1 +
 4 files changed, 1 insertion(+), 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 <gottox@voidlinux.org>"
-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
-}
diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template
index 27e8669c24f..14bd76761ff 100644
--- a/srcpkgs/removed-packages/template
+++ b/srcpkgs/removed-packages/template
@@ -152,6 +152,7 @@ replaces="
  libfcitx-qt<=4.2.9.8_1
  libfcitx-qt-devel<=4.2.9.8_1
  libgksu<=2.0.12_5
+ libglib-static<=2.58.3_5
  libqzeitgeist<=0.8.0_6
  librpcsecgss<=0.19_6
  librpcsecgss-devel<=0.19_6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Merged]: Remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
  2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
                   ` (5 preceding siblings ...)
  2021-02-11  6:28 ` ericonr
@ 2021-02-11 18:22 ` ericonr
  6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2021-02-11 18:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

There's a merged pull request on the void-packages repository

Remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static
https://github.com/void-linux/void-packages/pull/27894

Description:
WIP because of linking issues :/ 

I'm not sure why they are happening.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-11 18:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 15:49 [PR PATCH] [WIP] remove libglib-static, build shared and static libraries in glib, use those in qemu-user-static ericonr
2021-01-13 19:48 ` [PR PATCH] [Updated] " ericonr
2021-02-11  2:32 ` ericonr
2021-02-11  2:50 ` ericonr
2021-02-11  3:14 ` ericonr
2021-02-11  6:21 ` ericonr
2021-02-11  6:28 ` ericonr
2021-02-11 18:22 ` [PR PATCH] [Merged]: Remove " ericonr

Github messages for voidlinux

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/voidlinux-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 voidlinux-github voidlinux-github/ https://inbox.vuxu.org/voidlinux-github \
		voidlinux-github@inbox.vuxu.org
	public-inbox-index voidlinux-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.voidlinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git