[rhythmbox] build: attempt to tidy up external library dependencies



commit a5c7e587d824e85aaf878d83795d9eca76924200
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed May 18 09:19:41 2022 +1000

    build: attempt to tidy up external library dependencies
    
    Rather than each sub library trying to determine which libraries it
    uses, then having to add them all together because each sub library uses
    headers from all the others (more or less), now we have a single list of
    the library dependencies used by core code, and we use it everywhere.
    This probably makes the build marginally slower.

 backends/meson.build             |  6 ++----
 lib/libmediaplayerid/meson.build | 13 ++++---------
 lib/meson.build                  |  9 ++-------
 meson.build                      | 41 +++++++++++++++++++++-------------------
 metadata/meson.build             |  6 ++----
 plugins/daap/meson.build         |  6 +-----
 plugins/mtpdevice/meson.build    |  7 +------
 podcast/meson.build              |  6 ++----
 rhythmdb/meson.build             |  6 ++----
 shell/meson.build                | 25 +++++-------------------
 sources/meson.build              |  2 +-
 widgets/meson.build              |  2 +-
 12 files changed, 45 insertions(+), 84 deletions(-)
---
diff --git a/backends/meson.build b/backends/meson.build
index c4dd11618..3391ff939 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -24,17 +24,15 @@ backends_c_args = [
   '-DG_LOG_DOMAIN="Rhythmbox"',
 ]
 
-backends_dependencies = [gstreamer_base, gstreamer_controller, gstreamer_plugins_base, gstreamer_tag]
-
 rbbackends_lib = static_library('rbbackends',
   backends_sources,
-  dependencies: [backends_dependencies, librb_dep, rhythmdb_dep],
+  dependencies: [common_deps, librb_dep, rhythmdb_dep],
   c_args: backends_c_args,
   include_directories: backendsinc,
 )
 
 rbbackends_dep = declare_dependency(
   link_with: rbbackends_lib,
-  dependencies: backends_dependencies,
+  dependencies: common_deps,
   include_directories: backendsinc,
 )
diff --git a/lib/libmediaplayerid/meson.build b/lib/libmediaplayerid/meson.build
index aa0d0930a..d06f853d5 100644
--- a/lib/libmediaplayerid/meson.build
+++ b/lib/libmediaplayerid/meson.build
@@ -10,30 +10,25 @@ mpid_sources = files(
   'mpid-util.c'
 )
 
-mpid_dependencies = [gio, gio_unix, glib, gobject]
-
-# use the GUdev/media-player-id implementation if possible,
-# otherwise HAL.
-if use_gudev
+if gudev.found()
   mpid_sources += files('mpid-udev.c')
-  mpid_dependencies += [gudev]
 else
   mpid_sources += files('mpid-dummy.c')
 endif
 
 mediaplayerid_lib = static_library('mediaplayerid',
   mpid_sources,
-  dependencies: mpid_dependencies,
+  dependencies: common_deps,
 )
 
 mediaplayerid_dep = declare_dependency(
   link_with: mediaplayerid_lib,
-  dependencies: mpid_dependencies,
+  dependencies: common_deps,
   include_directories: include_directories('.'),
 )
 
 mpid_gir = gnome.generate_gir(mediaplayerid_lib,
-  dependencies: mpid_dependencies,
+  dependencies: common_deps,
   extra_args: [
     '--library-path=@0@/../../lib/libmediaplayerid'.format(meson.current_build_dir()),
   ],
diff --git a/lib/meson.build b/lib/meson.build
index 803b5e505..dccd3957b 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -44,20 +44,15 @@ lib_c_args = [
   '-DDATADIR="' + datadir + '"'
 ]
 
-lib_dependencies = [
-   gio, gio_unix, glib, gmodule_export, gobject, gstreamer, gstreamer_pbutils, gtk,
-   gdk_pixbuf, libpeas, libpeas_gtk, libxml, pango
-]
-
 librb = static_library('rb', lib_sources,
   c_args: lib_c_args,
   include_directories: [configinc],
-  dependencies: lib_dependencies,
+  dependencies: common_deps,
   install: false,
 )
 
 librb_dep = declare_dependency(
   link_with: librb,
-  dependencies: lib_dependencies,
+  dependencies: common_deps,
   include_directories: [configinc, include_directories('.')],
 )
diff --git a/meson.build b/meson.build
index 1f44e0ae7..88bb39ae1 100644
--- a/meson.build
+++ b/meson.build
@@ -50,7 +50,6 @@ gdk_pixbuf = dependency('gdk-pixbuf-2.0', version: '>= 2.18.0')
 gio = dependency('gio-2.0', version: '>=' + glib_required, required: true)
 gio_unix = dependency('gio-unix-2.0', version: '>=' + glib_required, required: true)
 glib = dependency('glib-2.0', version: '>=' + glib_required, required: true)
-gmodule_export = dependency('gmodule-export-2.0', version: '>=' + glib_required, required: true)
 gobject = dependency('gobject-2.0', version: '>=' + glib_required, required: true)
 gobject_introspection = dependency('gobject-introspection-1.0', version: '>= 0.10.0', required: true)
 gstreamer = dependency('gstreamer-1.0', version: '>= ' + gstreamer_required, required: true)
@@ -70,22 +69,27 @@ pango = dependency('pango', required: true)
 tdb = dependency('tdb', version: '>= 1.2.6', required: true)
 totem_plparser = dependency('totem-plparser', version: '>= 3.2.0', required: true)
 
-check = dependency('check', required: get_option('tests'))
-
-use_gudev = false
 gudev = dependency('gudev-1.0', version: '>= 143', required: get_option('gudev'))
 if gudev.found()
-  use_gudev = true
   cdata.set('HAVE_GUDEV', 1)
 endif
 
-use_libsecret = false
+common_deps = [
+  libmath,
+  intl, glib, gobject, gio, gio_unix, gobject_introspection,
+  cairo, pango, gdk_pixbuf, gtk,
+  gstreamer, gstreamer_audio, gstreamer_base, gstreamer_controller, gstreamer_plugins_base, 
gstreamer_pbutils, gstreamer_tag,
+  json_glib, libsoup, libxml, tdb, totem_plparser,
+  libpeas, libpeas_gtk,
+  gudev
+]
+
+check = dependency('check', required: get_option('tests'))
+
+
 libsecret = dependency('libsecret-1', version: '>= 0.18', required: get_option('libsecret'))
-if libsecret.found()
-  use_libsecret = true
-endif
-cdata.set('PY_LIBSECRET_ENABLED', use_libsecret)
-cdata.set('WITH_LIBSECRET', use_libsecret)
+cdata.set('PY_LIBSECRET_ENABLED', libsecret.found())
+cdata.set('WITH_LIBSECRET', libsecret.found())
 
 have_gnu_fwrite_unlocked = false
 if cc.has_function('fwrite_unlocked')
@@ -98,6 +102,9 @@ have_cfmakeraw = cc.has_function('cfmakeraw', prefix: '#include <termios.h>')
 cdata.set('HAVE_CFMAKERAW', have_cfmakeraw)
 
 gdk_targets = run_command(['pkg-config', '--variable', 'targets', 'gdk-3.0'], check: true).stdout().strip()
+if gdk_targets.contains('x11')
+  common_deps += dependency('x11', required: true)
+endif
 
 have_prctl = cc.has_function('prctl', prefix: '#include <sys/prctl.h>')
 cdata.set('HAVE_PRCTL', have_prctl)
@@ -110,10 +117,6 @@ have_pthread_getname_np = cc.links('''
   }''', name: 'pthread_getname_np')
 cdata.set('HAVE_PTHREAD_GETNAME_NP', have_pthread_getname_np)
 
-if gdk_targets.contains('x11')
-  x11 = dependency('x11', required: true)
-endif
-
 cdata.set('GETTEXT_PACKAGE', '"rhythmbox"')
 cdata.set('PACKAGE', '"rhythmbox"')
 cdata.set('VERSION', '@0@'.format(meson.project_version()))
@@ -206,13 +209,13 @@ endif
 
 libmtp = dependency('libmtp', version: '>= 0.3.0', required: get_option('mtp'))
 if libmtp.found()
-  if use_gudev
+  if gudev.found()
     plugins += 'mtpdevice'
   elif get_option('mtp').enabled()
     error('MTP explicitly requested but GUdev is not available')
   endif
 endif
-if use_gudev
+if gudev.found()
   plugins += 'android'
 endif
 
@@ -288,10 +291,10 @@ summary({'iPod integration': plugins.contains('ipod'),
          'CD burning support': plugins.contains('brasero-disc-recorder'),
          'DAAP (music sharing) support': plugins.contains('daap'),
          'libnotify support': plugins.contains('notification'),
-         'GUdev support': use_gudev,
+         'GUdev support': gudev.found(),
          'Python plugin support': enable_python,
          'Vala plugin support': enable_vala,
-         'Libsecret keyring support': use_libsecret,
+         'Libsecret keyring support': libsecret.found(),
          'FM radio support': plugins.contains('fmradio'),
          'Grilo support': plugins.contains('grilo'),
          'Sample plugins': get_option('sample-plugins'),
diff --git a/metadata/meson.build b/metadata/meson.build
index 4f096082c..5b5ce1dfc 100644
--- a/metadata/meson.build
+++ b/metadata/meson.build
@@ -37,19 +37,17 @@ if use_no_strict_aliasing
   metadata_c_args += ['-fno-strict-aliasing']
 endif
 
-metadata_deps = [tdb, gstreamer, gstreamer_pbutils, gstreamer_tag]
-
 # client library
 
 rbmetadata_lib = static_library('rbmetadata', metadata_sources,
   c_args: metadata_c_args,
-  dependencies: [metadata_deps, librb_dep],
+  dependencies: [common_deps, librb_dep],
   install: false,
 )
 
 rbmetadata_dep = declare_dependency(
   link_with: rbmetadata_lib,
-  dependencies: metadata_deps,
+  dependencies: common_deps,
   include_directories: include_directories('.'),
 )
 
diff --git a/plugins/daap/meson.build b/plugins/daap/meson.build
index b6c6491f3..49ac227eb 100644
--- a/plugins/daap/meson.build
+++ b/plugins/daap/meson.build
@@ -21,7 +21,7 @@ daap_sources = [
   'rb-rhythmdb-query-model-dmap-db-adapter.c',
 ]
 
-daap_dependencies = [rhythmbox_core_dep, pango]
+daap_dependencies = [rhythmbox_core_dep, pango, libsecret]
 args = []
 
 if libdmapsharing4.found()
@@ -31,10 +31,6 @@ else
   daap_dependencies += libdmapsharing
 endif
 
-if use_libsecret
-  daap_dependencies += libsecret
-endif
-
 shared_module('daap',
   daap_sources,
   c_args: args,
diff --git a/plugins/mtpdevice/meson.build b/plugins/mtpdevice/meson.build
index 1dd577649..b160cb4dc 100644
--- a/plugins/mtpdevice/meson.build
+++ b/plugins/mtpdevice/meson.build
@@ -14,12 +14,7 @@ mtpdevice_sources = [
   'rb-mtp-thread.c',
 ]
 
-mtpdevice_dependencies = [rhythmbox_core_dep, libmtp]
-if use_gudev
-  mtpdevice_dependencies += gudev
-else
-  mtpdevice_dependencies += hal
-endif
+mtpdevice_dependencies = [rhythmbox_core_dep, libmtp, gudev]
 
 shared_module('mtpdevice',
   mtpdevice_sources,
diff --git a/podcast/meson.build b/podcast/meson.build
index 5c201051c..7ca11bece 100644
--- a/podcast/meson.build
+++ b/podcast/meson.build
@@ -30,18 +30,16 @@ podcast_c_args = [
   '-DG_LOG_DOMAIN="RhythmBox"'
 ]
 
-podcast_dependencies = [ json_glib, libsoup, totem_plparser, gdk_pixbuf ]
-
 rbpodcast_lib = static_library('rbpodcast', podcast_sources,
   c_args: lib_c_args,
   include_directories: [configinc, shellinc, sourcesinc, widgetsinc],
-  dependencies: [podcast_dependencies, librb_dep, rhythmdb_dep, rbmetadata_dep],
+  dependencies: [common_deps, librb_dep, rhythmdb_dep, rbmetadata_dep],
   install: false,
 )
 
 rbpodcast_dep = declare_dependency(
   link_with: rbpodcast_lib,
-  dependencies: podcast_dependencies,
+  dependencies: common_deps,
   include_directories: [configinc, include_directories('.')],
 )
 
diff --git a/rhythmdb/meson.build b/rhythmdb/meson.build
index 1a91cf6c0..25790c62d 100644
--- a/rhythmdb/meson.build
+++ b/rhythmdb/meson.build
@@ -40,15 +40,13 @@ if use_no_strict_aliasing
   c_args += ['-fno-strict-aliasing']
 endif
 
-rhythmdb_dependencies = [libmath]
-
 librhythmdb = static_library('rhythmdb', rhythmdb_sources,
   c_args: c_args,
-  dependencies: [rhythmdb_dependencies, librb_dep],
+  dependencies: [common_deps, librb_dep],
   include_directories: [podcastinc, widgetsinc])
 
 rhythmdb_dep = declare_dependency(
   link_with: librhythmdb,
   include_directories: include_directories('.'),
-  dependencies: rhythmdb_dependencies,
+  dependencies: common_deps,
 )
diff --git a/shell/meson.build b/shell/meson.build
index 98e3a082e..25e2d1830 100644
--- a/shell/meson.build
+++ b/shell/meson.build
@@ -81,11 +81,6 @@ shell_c_args = [
   '-DLIBDIR="' + libdir + '"',
 ]
 
-rhythmbox_core_dependencies = [gobject_introspection, libpeas]
-if gdk_targets.contains('x11')
-  rhythmbox_core_dependencies += [x11]
-endif
-
 rhythmbox_core_include_directories = [
   configinc, libinc, mpidinc, metadatainc, rhythmdbinc, backendsinc, pluginsinc,
   podcastinc, sourcesinc, widgetsinc, include_directories('.'),
@@ -95,25 +90,21 @@ librhythmbox_core = shared_library('rhythmbox-core',
   shell_sources,
   c_args: shell_c_args,
   include_directories: rhythmbox_core_include_directories,
-  dependencies: [rhythmbox_core_dependencies,  mediaplayerid_dep, rhythmdb_dep,
+  dependencies: [common_deps, mediaplayerid_dep, librb_dep, rhythmdb_dep,
     rbbackends_dep, rbmetadata_dep, rbpodcast_dep, rbwidgets_dep, sources_dep],
   install: 'true',
   link_whole: [librb, rbwidgets_lib, sources_lib],
   version: '@0@.@1@.@2@'.format(RHYTHMBOX_CORE_CURRENT, RHYTHMBOX_CORE_REVISION, RHYTHMBOX_CORE_AGE)
 )
 
-# We can't use the _dep objects from the helper libraries here
-# as we need to avoid linking the static helper libraries to the
-# plugins.
 rhythmbox_core_dep = declare_dependency(
   link_with: librhythmbox_core,
-  dependencies: [mpid_dependencies, lib_dependencies, rhythmdb_dependencies,
-    backends_dependencies, podcast_dependencies, widgets_dependencies, sources_dependencies],
+  dependencies: common_deps,
   include_directories: rhythmbox_core_include_directories,
 )
 
 rb_gir = gnome.generate_gir(librhythmbox_core,
-  dependencies: [rhythmbox_core_dependencies],
+  dependencies: common_deps,
   link_with: [],
   extra_args: [ '--accept-unprefixed'],
   sources: lib_headers + lib_sources + 
@@ -133,19 +124,13 @@ rb_gir = gnome.generate_gir(librhythmbox_core,
   install: true,
 )
 
-rhythmbox_dependencies = [rhythmbox_core_dep, gobject_introspection,
-  gio, gio_unix, libsoup, tdb, json_glib]
-
-if gdk_targets.contains('x11')
-  rhythmbox_dependencies += [x11]
-endif
-
+rhythmbox_dependencies = [rhythmbox_core_dep]
 if enable_python
   rhythmbox_dependencies += [pygobject]
 endif
 
 executable('rhythmbox', 'main.c',
-  dependencies: [ rhythmbox_dependencies, intl ],
+  dependencies: [ rhythmbox_dependencies ],
   c_args: shell_c_args,
   include_directories: [ pluginsinc ],
   install: true
diff --git a/sources/meson.build b/sources/meson.build
index 2afe79fae..c1b685c17 100644
--- a/sources/meson.build
+++ b/sources/meson.build
@@ -58,7 +58,7 @@ if use_no_strict_aliasing
   sources_c_args += ['-fno-strict-aliasing']
 endif
 
-sources_dependencies = [totem_plparser, gstreamer_pbutils, gtk]
+sources_dependencies = [totem_plparser, gstreamer_pbutils, libxml, gtk]
 
 sources_lib = static_library('sources', sources_sources,
   c_args: sources_c_args,
diff --git a/widgets/meson.build b/widgets/meson.build
index 1bf39ab08..76a265dfc 100644
--- a/widgets/meson.build
+++ b/widgets/meson.build
@@ -53,7 +53,7 @@ widgets_c_args = [
   '-DG_LOG_DOMAIN="Rhythmbox"',
 ]
 
-widgets_dependencies = [libnotify, gtk, gdk_pixbuf, cairo, pango, gstreamer_pbutils]
+widgets_dependencies = [gtk, gdk_pixbuf, cairo, pango, gstreamer_pbutils, libsoup]
 
 rbwidgets_lib = static_library('rbwidgets',
   widgets_sources,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]