From 802adb184acc178db145e91a52a6097dc067b271 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 5 Mar 2025 11:15:09 +0100 Subject: [PATCH] build: Detect GIRepository version to use based on glib version Glib 2.83/2.84 will incorporate its own g-i infrastructure and GIR definitions for the repository. The version was bumped which will (eventually) make GNOME Music checks for GIRepository 2.0 fail. Since bumping to 3.0 will make GNOME Music just work again, detect at runtime whether the detected GLib is recent enough to use the 3.0 repository, or it should stick to the good old 2.0. Closes: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/641 --- gnome-music.in | 2 +- meson.build | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gnome-music.in b/gnome-music.in index 7f69c1b06..cc2584f22 100755 --- a/gnome-music.in +++ b/gnome-music.in @@ -42,7 +42,7 @@ import gi gi.require_version("Adw", "1") gi.require_version('Gtk', '4.0') -gi.require_version('GIRepository', '2.0') +gi.require_version('GIRepository', '@gir_version@') gi.require_version('Gst', '1.0') from gi.repository import Adw, GIRepository, Gio, Gtk, Gst diff --git a/meson.build b/meson.build index 3ca0a11c1..c120b0b3d 100644 --- a/meson.build +++ b/meson.build @@ -54,7 +54,7 @@ endif # Dependencies -dependency('glib-2.0', version: '>= 2.67.1') +glib_dep = dependency('glib-2.0', version: '>= 2.67.1') dependency('gobject-introspection-1.0', version: '>= 1.35.0') dependency('gtk4', version: '>= 4.16.0') dependency('libadwaita-1', version: '>= 1.6') @@ -76,6 +76,12 @@ install_subdir( install_dir: py_installation.get_install_dir() ) +if glib_dep.version().version_compare('>=2.83') + gir_version = '3.0' +else + gir_version = '2.0' +endif + # Install the executable file bin_config = configuration_data() bin_config.set('application_id', APPLICATION_ID) @@ -84,6 +90,7 @@ bin_config.set('pkgdatadir', PKGDATA_DIR) bin_config.set('localedir', join_paths(get_option('prefix'), get_option('datadir'), 'locale')) bin_config.set('pythondir', PYTHON_DIR) bin_config.set('schemasdir', PKGDATA_DIR) +bin_config.set('gir_version', gir_version) bin_config.set('version', meson.project_version() + VCS_TAG) bin_config.set('local_build', 'False') @@ -103,6 +110,7 @@ local_config.set('pkgdatadir', join_paths(meson.current_build_dir(), 'data')) local_config.set('localedir', join_paths(get_option('prefix'), get_option('datadir'), 'locale')) local_config.set('pythondir', meson.current_source_dir()) local_config.set('schemasdir', join_paths(meson.current_build_dir(), 'data')) +local_config.set('gir_version', gir_version) local_config.set('version', meson.project_version() + VCS_TAG) local_config.set('local_build', 'True') -- GitLab