From 96652e7def0fcca57d488413ffc89416af198433 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 19 Sep 2024 22:01:37 +0200 Subject: [PATCH 1/3] ci: Only build gobject-introspection if the system version is too old MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to build GLib against a matched version of gobject-introspection, and this version will probably be bumped quite often as the two are developed in tandem. However, if the CI system provides a newer version, we should probably use that, otherwise we’re essentially downgrading part of the OS on the CI system, and that probably will result in issues. In particular, gobject-introspection <1.82 has a bug on MSYS2 which means it doesn’t build (see issue #3464). So, build gobject-introspection manually if the CI system version is too old, otherwise use the system version. Do this programmatically so we don’t have to repeatedly add and remove the gobject-introspection build commands from the CI configuration as versions are bumped. Fixes: #3464 --- .gitlab-ci.yml | 14 ++++++++++---- .gitlab-ci/test-msys2.sh | 13 +++++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac9fcc7a7..95342c493 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,10 +108,16 @@ variables: .build-gobject-introspection: before_script: - - mkdir -p gobject-introspection - - git clone --branch $GOBJECT_INTROSPECTION_TAG https://gitlab.gnome.org/GNOME/gobject-introspection.git gobject-introspection - - meson gobject-introspection gobject-introspection/build --prefix=/usr - - sudo meson install -C gobject-introspection/build + # If the CI image doesn’t provide a new enough gobject-introspection + # package, build it ourselves. + # See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3746#note_2161354 + - > + if ! pkg-config --atleast-version "${GOBJECT_INTROSPECTION_TAG}" gobject-introspection-1.0; then + mkdir -p gobject-introspection + git clone --branch $GOBJECT_INTROSPECTION_TAG https://gitlab.gnome.org/GNOME/gobject-introspection.git gobject-introspection + meson gobject-introspection gobject-introspection/build --prefix=/usr + sudo meson install -C gobject-introspection/build + fi artifacts: expire_in: 3 days paths: diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index 3a58f0bb7..29c103a4f 100755 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -34,10 +34,15 @@ PATH="$(cygpath "$USERPROFILE")/.local/bin:$HOME/.local/bin:$PATH" DIR="$(pwd)" export PATH CFLAGS -mkdir -p gobject-introspection -git clone --branch "${GOBJECT_INTROSPECTION_TAG}" https://gitlab.gnome.org/GNOME/gobject-introspection.git gobject-introspection -meson gobject-introspection gobject-introspection/build --prefix "/c/msys64/${MSYSTEM}/usr" -meson install -C gobject-introspection/build +# If msys2 doesn’t provide a new enough gobject-introspection package, build it +# ourselves. +# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3746#note_2161354 +if [[ $(vercmp "$(pacman -Qi "${MINGW_PACKAGE_PREFIX}"-gobject-introspection | grep -Po '^Version\s*: \K.+')" "${GOBJECT_INTROSPECTION_TAG}") -lt 0 ]]; then + mkdir -p gobject-introspection + git clone --branch "${GOBJECT_INTROSPECTION_TAG}" https://gitlab.gnome.org/GNOME/gobject-introspection.git gobject-introspection + meson gobject-introspection gobject-introspection/build --prefix "/c/msys64/${MSYSTEM}/usr" + meson install -C gobject-introspection/build +fi # FIXME: We can’t use ${MESON_COMMON_OPTIONS} here because this script installs # Meson 1.3. See the comment in .gitlab-ci.yml about the same problem on From d3e0d4fbde292981489c90a6f6fa8431e9f9620b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 29 Sep 2024 12:30:53 +0100 Subject: [PATCH 2/3] gpoll: Remove unused variable Fixes commit 3baf1f1a73952277abd05ac82b0b356c6f5ab725. Signed-off-by: Philip Withnall --- glib/gpoll.c | 1 - 1 file changed, 1 deletion(-) diff --git a/glib/gpoll.c b/glib/gpoll.c index 4ec0bfdd3..cbbbe8886 100644 --- a/glib/gpoll.c +++ b/glib/gpoll.c @@ -449,7 +449,6 @@ g_poll (GPollFD *fds, for (i = 0; i < nthreads; i++) { guint thread_fds; - guint ignore; if (i == (nthreads - 1) && threads_remain > 0) thread_fds = threads_remain; From d50102f2d8f0bdbb3308ab3d8ba46ef1483c09ba Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 29 Sep 2024 12:45:13 +0100 Subject: [PATCH 3/3] gvariant: Fix suffix alignment on 32-bit machines This fixes commit 0b083e3d8c. The static assertion added in that commit fails on 32-bit machines. Signed-off-by: Philip Withnall --- glib/gvariant-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c index a8de6689c..7afef1b2f 100644 --- a/glib/gvariant-core.c +++ b/glib/gvariant-core.c @@ -76,7 +76,11 @@ struct _GVariant gatomicrefcount ref_count; gsize depth; +#if g_macro__has_attribute(aligned) + guint8 suffix[] __attribute__((aligned(8))); +#else guint8 suffix[]; +#endif }; /* Ensure our suffix data aligns to largest guaranteed offset