From 5a9d365f849b1f081b8c00c3a7517d12866349f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 18 May 2022 16:49:41 +0200 Subject: [PATCH] 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: --- js/misc/config.js.in | 12 ++++++++---- js/misc/meson.build | 2 -- meson.build | 9 --------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/js/misc/config.js.in b/js/misc/config.js.in index 8cea70bc0..deb5139d1 100644 --- a/js/misc/config.js.in +++ b/js/misc/config.js.in @@ -1,17 +1,14 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- +const pkg = imports.package; /* The name of this package (not localized) */ var PACKAGE_NAME = '@PACKAGE_NAME@'; /* The version of this package */ 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 */ var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@; /* 1 if soup2 should be used instead of soup3, 0 otherwise */ var HAVE_SOUP2 = @HAVE_SOUP2@; -/* 1 if recorder is enabled, 0 otherwise */ -var HAVE_RECORDER = @HAVE_RECORDER@; /* gettext package */ var GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@'; /* locale dir */ @@ -21,3 +18,10 @@ var LIBEXECDIR = '@libexecdir@'; var PKGDATADIR = '@datadir@/@PACKAGE_NAME@'; /* g-i package versions */ 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'); diff --git a/js/misc/meson.build b/js/misc/meson.build index 43d6d99c6..2dff20dec 100644 --- a/js/misc/meson.build +++ b/js/misc/meson.build @@ -3,10 +3,8 @@ jsconf.set('PACKAGE_NAME', meson.project_name()) jsconf.set('PACKAGE_VERSION', meson.project_version()) jsconf.set('GETTEXT_PACKAGE', meson.project_name()) jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version) -jsconf.set10('HAVE_BLUETOOTH', bt_dep.found()) jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager) jsconf.set10('HAVE_SOUP2', have_soup2) -jsconf.set10('HAVE_RECORDER', enable_recorder) jsconf.set('datadir', datadir) jsconf.set('libexecdir', libexecdir) diff --git a/meson.build b/meson.build index 7465790a4..26b404c29 100644 --- a/meson.build +++ b/meson.build @@ -32,8 +32,6 @@ startup_req = '>= 0.11' ibus_req = '>= 1.5.19' gnome_desktop_req = '>= 3.35.90' -bt_req = '>= 3.9.0' -gst_req = '>= 0.11.92' nm_req = '>= 1.10.4' secret_req = '>= 0.18' @@ -93,13 +91,6 @@ x11_dep = dependency('x11') schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_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 = [] if get_option('networkmanager') nm_deps += dependency('libnm', version: nm_req)