config: Check runtime dependencies at runtime

Both bluetooth and screencast support are based on build checks
right now. However in both cases, the dependency is only consumed
at runtime via the typelib, so let's actually check for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2297>
This commit is contained in:
Florian Müllner 2022-05-18 16:49:41 +02:00 committed by Marge Bot
parent a8c5d77872
commit 5a9d365f84
3 changed files with 8 additions and 15 deletions

View File

@ -1,17 +1,14 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const pkg = imports.package;
/* The name of this package (not localized) */ /* The name of this package (not localized) */
var PACKAGE_NAME = '@PACKAGE_NAME@'; var PACKAGE_NAME = '@PACKAGE_NAME@';
/* The version of this package */ /* The version of this package */
var PACKAGE_VERSION = '@PACKAGE_VERSION@'; var PACKAGE_VERSION = '@PACKAGE_VERSION@';
/* 1 if gnome-bluetooth is available, 0 otherwise */
var HAVE_BLUETOOTH = @HAVE_BLUETOOTH@;
/* 1 if networkmanager is available, 0 otherwise */ /* 1 if networkmanager is available, 0 otherwise */
var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@; var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@;
/* 1 if soup2 should be used instead of soup3, 0 otherwise */ /* 1 if soup2 should be used instead of soup3, 0 otherwise */
var HAVE_SOUP2 = @HAVE_SOUP2@; var HAVE_SOUP2 = @HAVE_SOUP2@;
/* 1 if recorder is enabled, 0 otherwise */
var HAVE_RECORDER = @HAVE_RECORDER@;
/* gettext package */ /* gettext package */
var GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@'; var GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
/* locale dir */ /* locale dir */
@ -21,3 +18,10 @@ var LIBEXECDIR = '@libexecdir@';
var PKGDATADIR = '@datadir@/@PACKAGE_NAME@'; var PKGDATADIR = '@datadir@/@PACKAGE_NAME@';
/* g-i package versions */ /* g-i package versions */
var LIBMUTTER_API_VERSION = '@LIBMUTTER_API_VERSION@' var LIBMUTTER_API_VERSION = '@LIBMUTTER_API_VERSION@'
var HAVE_BLUETOOTH = pkg.checkSymbol('GnomeBluetooth', '3.0');
var HAVE_RECORDER =
pkg.checkSymbol('Gst', '1.0') &&
imports.gi.Gst.init_check(null) &&
imports.gi.Gst.ElementFactory.find('pipewiresrc') &&
imports.gi.Gst.ElementFactory.find('filesrc');

View File

@ -3,10 +3,8 @@ jsconf.set('PACKAGE_NAME', meson.project_name())
jsconf.set('PACKAGE_VERSION', meson.project_version()) jsconf.set('PACKAGE_VERSION', meson.project_version())
jsconf.set('GETTEXT_PACKAGE', meson.project_name()) jsconf.set('GETTEXT_PACKAGE', meson.project_name())
jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version) jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version)
jsconf.set10('HAVE_BLUETOOTH', bt_dep.found())
jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager) jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager)
jsconf.set10('HAVE_SOUP2', have_soup2) jsconf.set10('HAVE_SOUP2', have_soup2)
jsconf.set10('HAVE_RECORDER', enable_recorder)
jsconf.set('datadir', datadir) jsconf.set('datadir', datadir)
jsconf.set('libexecdir', libexecdir) jsconf.set('libexecdir', libexecdir)

View File

@ -32,8 +32,6 @@ startup_req = '>= 0.11'
ibus_req = '>= 1.5.19' ibus_req = '>= 1.5.19'
gnome_desktop_req = '>= 3.35.90' gnome_desktop_req = '>= 3.35.90'
bt_req = '>= 3.9.0'
gst_req = '>= 0.11.92'
nm_req = '>= 1.10.4' nm_req = '>= 1.10.4'
secret_req = '>= 0.18' secret_req = '>= 0.18'
@ -93,13 +91,6 @@ x11_dep = dependency('x11')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req) schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: gnome_desktop_req) gnome_desktop_dep = dependency('gnome-desktop-3.0', version: gnome_desktop_req)
bt_dep = dependency('gnome-bluetooth-3.0', version: bt_req, required: false)
gst_dep = dependency('gstreamer-1.0', version: gst_req, required: false)
gst_base_dep = dependency('gstreamer-base-1.0', required: false)
pipewire_dep = dependency('libpipewire-0.3', required: false)
enable_recorder = gst_dep.found() and gst_base_dep.found() and pipewire_dep.found()
nm_deps = [] nm_deps = []
if get_option('networkmanager') if get_option('networkmanager')
nm_deps += dependency('libnm', version: nm_req) nm_deps += dependency('libnm', version: nm_req)