[rhythmbox/wip/sam/meson: 7/7] More Meson work in progress



commit cf5fdf3eaad5bdbdb18b242360dccdbaf809e4b2
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 17 01:53:44 2016 +0100

    More Meson work in progress
    
    Seems that resource generation fails due to what looks like a bug in
    `glib-compile-resources --generate-dependencies` or in Meson:
    
        $ glib-compile-resources ../shell/rhythmbox.gresource.xml --generate-dependencies --sourcedir=../data
        ../data/ui/style.css
        ../data/ui/podcast-add-dialog.ui
        ../data/icons/hicolor/16x16/status/rhythmbox-unset-star.png
        ../data/icons/hicolor/16x16/status/rhythmbox-set-star.png
        ../data/ui/encoding-settings.ui
        ../data/ui/create-playlist.ui
        playlists.xml
        ...
    
    This occurs with GLib 2.48 and current 'master'. Meson (or rather,
    the Ninja build instructions that Meson generates) can find the
    playlists.xml file OK but they complain that '../ui/style.css' is
    missing ...

 backends/gstreamer/meson.build |   14 +++++--
 backends/meson.build           |   17 ++++----
 data/meson.build               |    8 ++++
 lib/meson.build                |   16 ++++++-
 meson.build                    |    7 +++-
 metadata/meson.build           |   16 ++++---
 po/meson.build                 |   86 ++++++++++++++++++++++++++++++++++++++++
 podcast/meson.build            |   38 ++++++++++--------
 rhythmdb/meson.build           |   16 ++++---
 shell/meson.build              |   25 +++++++++--
 sources/meson.build            |   14 ++++---
 sources/sync/meson.build       |   12 +++--
 tests/meson.build              |    6 +++
 widgets/meson.build            |   29 +++++++------
 14 files changed, 228 insertions(+), 76 deletions(-)
---
diff --git a/backends/gstreamer/meson.build b/backends/gstreamer/meson.build
index a78c711..7604b68 100644
--- a/backends/gstreamer/meson.build
+++ b/backends/gstreamer/meson.build
@@ -14,13 +14,19 @@ gstreamer_backend_c_args = [
   '-DG_LOG_DOMAIN="Rhythmbox"',
 ]
 
+gstreamer_backend_dependencies = [rhythmdb_dep, gdk_pixbuf]
+
 librbbackendsgstreamer = static_library('rbbackendsgstreamer',
   gstreamer_backend_sources,
   c_args: gstreamer_backend_c_args,
-  dependencies: [gdk_pixbuf, gstreamer, gtk, libxml],
-  include_directories: [
-    configinc, libinc, metadatainc, backendsinc, rhythmdbinc,
-  ],
+  dependencies: gstreamer_backend_dependencies,
+  include_directories: backendsinc,
   install: 'true',
   link_args: ['-export-dynamic'],
 )
+
+gstreamer_backend_dep = declare_dependency(
+  link_with: librbbackendsgstreamer,
+  dependencies: gstreamer_backend_dependencies,
+  include_directories: [ include_directories('.') ]
+)
diff --git a/backends/meson.build b/backends/meson.build
index c2d5c02..c070c32 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -21,16 +21,17 @@ backend_c_args = [
   '-DG_LOG_DOMAIN="Rhythmbox"',
 ]
 
+backend_dependencies = [gstreamer_backend_dep]
+
 librbbackends = static_library('rbbackends', backend_sources,
   c_args: backend_c_args,
-  dependencies: [
-    gdk_pixbuf, glib, gstreamer, gtk, libxml
-  ],
-  include_directories: [
-    configinc, libinc, metadatainc, rhythmdbinc,
-    include_directories('gstreamer'),
-  ],
+  dependencies: backend_dependencies,
   install: 'true',
   link_args: ['-export-dynamic'],
-  link_with: [librbbackendsgstreamer]
+)
+
+backends_dep = declare_dependency(
+  link_with: librbbackends,
+  dependencies: gstreamer_backend_dep,
+  include_directories: include_directories('.')
 )
diff --git a/data/meson.build b/data/meson.build
index ebf62cb..2d56b62 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -6,3 +6,11 @@ foreach desktop_in_file : desktop_in_files
     configuration: cdata
   )
 endforeach
+
+# This is done with intltool in the Makefile.am, but there's no need to
+# use intltool any more.
+playlists_xml = custom_target('playlists.xml',
+  input: 'playlists.xml.in',
+  output: 'playlists.xml',
+  command: ['msgfmt', '--xml', '-d', '../po', '--template', '@INPUT@', '-o', '@OUTPUT@'],
+)
diff --git a/lib/meson.build b/lib/meson.build
index 1bc3ee5..302a3fd 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -48,11 +48,21 @@ lib_c_args = [
   '-DDATADIR="' + get_option('datadir') + '"'
 ]
 
+lib_dependencies = [
+   gio, gio_unix, glib, gobject, gstreamer, gstreamer_pbutils, gtk, libpeas,
+   libpeas_gtk, libxml
+]
+
 librb = library('rb', lib_sources,
   c_args: lib_c_args + ['-DG_LOG_DOMAIN="Rhythmbox"'],
   include_directories: [configinc],
-  dependencies: [gio, gio_unix, glib, gobject, gstreamer,
-                 gstreamer_pbutils, gtk, libpeas, libpeas_gtk, libxml],
-  install: 'true',
+  dependencies: lib_dependencies,
+  install: true,
   link_args: ['-export-dynamic']
 )
+
+lib_dep = declare_dependency(
+  link_with: librb,
+  dependencies: lib_dependencies,
+  include_directories: [configinc, libinc],
+)
diff --git a/meson.build b/meson.build
index 10273e3..fb884c2 100644
--- a/meson.build
+++ b/meson.build
@@ -438,12 +438,17 @@ sourcessyncinc = include_directories('sources/sync')
 widgetsinc = include_directories('widgets')
 
 subdir('data')
+
 subdir('lib')
-subdir('backends')
 subdir('metadata')
 subdir('rhythmdb')
+subdir('backends')
 subdir('plugins')
 subdir('podcast')
 subdir('sources')
 subdir('widgets')
 subdir('shell')
+
+subdir('tests')
+
+subdir('po')
diff --git a/metadata/meson.build b/metadata/meson.build
index aec16d5..e03582a 100644
--- a/metadata/meson.build
+++ b/metadata/meson.build
@@ -49,17 +49,19 @@ endif
 # client library
 
 librbmetadata = static_library('rbmetadata', metadata_sources,
-  dependencies: [glib, gtk, tdb],
-  include_directories: [configinc, libinc],
-  link_args: '-export-dynamic',
-  link_with: [librb])
+  dependencies: [lib_dep, tdb],
+  link_args: '-export-dynamic')
+
+metadata_dep = declare_dependency(
+  link_with: librbmetadata,
+  dependencies: [lib_dep],
+  include_directories: metadatainc
+)
 
 # service
 
 librbmetadatasvc = static_library('rbmetadatasvc', metadata_service_sources,
-  dependencies: [glib, gobject, gstreamer, gstreamer_pbutils, gtk],
-  include_directories: [configinc, libinc],
-  link_with: [librb])
+  dependencies: [lib_dep, glib, gobject, gstreamer, gstreamer_pbutils, gtk])
 
 executable('rhythmbox-metadata', metadata_dbus_service_sources,
   link_with: librbmetadatasvc,
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..6850b8f
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,86 @@
+i18n = import('i18n')
+
+langs = [
+  'af',
+  'am',
+  'ar',
+  'as',
+  'az',
+  'be',
+  'be@latin',
+  'bg',
+  'bn_IN',
+  'br',
+  'bs',
+  'ca',
+  'ca@valencia',
+  'cs',
+  'cy',
+  'da',
+  'de',
+  'dz',
+  'el',
+  'en_CA',
+  'en_GB',
+  'eo',
+  'es',
+  'et',
+  'eu',
+  'fa',
+  'fi',
+  'fr',
+  'ga',
+  'gd',
+  'gl',
+  'gu',
+  'he',
+  'hi',
+  'hr',
+  'hu',
+  'id',
+  'is',
+  'it',
+  'ja',
+  'kk',
+  'kn',
+  'ko',
+  'lt',
+  'lv',
+  'mk',
+  'ml',
+  'mn',
+  'mr',
+  'ms',
+  'nb',
+  'nds',
+  'ne',
+  'nl',
+  'nn',
+  'oc',
+  'or',
+  'pa',
+  'pl',
+  'ps',
+  'pt',
+  'pt_BR',
+  'ro',
+  'ru',
+  'rw',
+  'si',
+  'sk',
+  'sl',
+  'sr',
+  'sr@latin',
+  'sv',
+  'ta',
+  'te',
+  'th',
+  'tr',
+  'uk',
+  'vi',
+  'zh_CN',
+  'zh_HK',
+  'zh_TW',
+]
+
+i18n.gettext('rhythmbox', languages : langs)
diff --git a/podcast/meson.build b/podcast/meson.build
index ce1ca91..d29a131 100644
--- a/podcast/meson.build
+++ b/podcast/meson.build
@@ -35,41 +35,45 @@ podcast_sources = [
   'rb-podcast-entry-types.c'
 ]
 
-c_args = [
+podcast_c_args = [
   '-DGNOMELOCALEDIR="' + get_option('datadir') + '/locale"',
   '-DG_LOG_DOMAIN="RhythmBox"'
 ]
 
+podcast_dependencies = [
+    rhythmdb_dep, json_glib, libsoup, totem_plparser
+]
+
 librbpodcast = static_library('rbpodcast', podcast_sources,
-  c_args: c_args,
+  c_args: podcast_c_args,
+  dependencies: podcast_dependencies,
   include_directories: [
-    configinc, libinc, metadatainc, podcastinc, rhythmdbinc, shellinc,
-    sourcesinc, widgetsinc
-  ],
-  dependencies: [
-    glib, gobject, gstreamer, gtk, json_glib, libsoup, libxml, totem_plparser
-  ],
-  link_with: librhythmdb)
+     shellinc, sourcesinc, widgetsinc
+  ]
+)
+
+podcast_dep = declare_dependency(
+  link_with: librbpodcast,
+  dependencies: podcast_dependencies,
+  include_directories: include_directories('.'),
+)
 
 librbpodcast_parse = static_library('rbpodcast_parse', podcast_parse_sources,
   c_args: c_args,
-  include_directories: [configinc, libinc],
-  dependencies: [glib, json_glib, libsoup, totem_plparser],
-  link_with: librb)
+  dependencies: [lib_dep, json_glib, libsoup, totem_plparser])
 
 test_podcast_search = executable('test-podcast-search',
   'test-podcast-search.c',
   c_args: c_args,
   include_directories: [configinc, libinc],
-  dependencies: [glib, json_glib, totem_plparser],
-  link_with: [librbpodcast_parse, librb])
+  dependencies: [lib_dep, json_glib, totem_plparser],
+  link_with: [librbpodcast_parse])
 
 test_podcast_parse = executable('test-podcast-parse',
   'test-podcast-parse.c',
   c_args: c_args,
-  include_directories: [configinc, libinc],
-  dependencies: [glib, totem_plparser],
-  link_with: [librb, librbpodcast_parse])
+  dependencies: [lib_dep, totem_plparser],
+  link_with: [librbpodcast_parse])
 
 #
 #PLUGIN_FILES = rhythmbox-itms-plugin.c npapi.h npupp.h npruntime.h
diff --git a/rhythmdb/meson.build b/rhythmdb/meson.build
index 5a710a8..a644317 100644
--- a/rhythmdb/meson.build
+++ b/rhythmdb/meson.build
@@ -46,11 +46,13 @@ if use_no_strict_aliasing
 endif
 
 librhythmdb = static_library('rhythmdb', sources,
-  # GStreamer and Gtk are included in some lib/ headers, so we have to depend
-  # on them here to use librb. In case you wonder why a database library
-  # requires a GUI or audio playback...
   c_args: c_args,
-  dependencies: [gio, glib, gobject, gstreamer, gtk, libmath, libxml, tdb],
-  include_directories: [configinc, libinc, metadatainc, podcastinc, widgetsinc],
-  link_args: '-export-dynamic',
-  link_with: [librb, librbmetadata])
+  dependencies: [metadata_dep, libmath],
+  include_directories: [podcastinc, widgetsinc],
+  link_args: '-export-dynamic')
+
+rhythmdb_dep = declare_dependency(
+  link_with: librhythmdb,
+  include_directories: include_directories('.'),
+  dependencies: [metadata_dep],
+)
diff --git a/shell/meson.build b/shell/meson.build
index 0c76718..e4e8004 100644
--- a/shell/meson.build
+++ b/shell/meson.build
@@ -1,10 +1,25 @@
 gnome = import('gnome')
 
+make_tab_command = ['sed', '-e', 's/^/"/', '-e', 's/$/",/', '@INPUT@']
+
 custom_target('AUTHORS.tab',
-  input: '../AUTHORS',
-  output: 'AUTHORS.tab',
-  command: ['sed', '-e', 's/^/"/', '-e', 's/$/",/', '@INPUT@'],
-  capture: true
+  input: '../AUTHORS', output: 'AUTHORS.tab',
+  command: make_tab_command, capture: true
+)
+
+custom_target('MAINTAINERS.tab',
+  input: '../MAINTAINERS', output: 'MAINTAINERS.tab',
+  command: make_tab_command, capture: true
+)
+
+custom_target('MAINTAINERS.old.tab',
+  input: '../MAINTAINERS.old', output: 'MAINTAINERS.old.tab',
+  command: make_tab_command, capture: true
+)
+
+custom_target('DOCUMENTERS.tab',
+  input: '../DOCUMENTERS', output: 'DOCUMENTERS.tab',
+  command: make_tab_command, capture: true
 )
 
 shell_headers = [
@@ -22,7 +37,7 @@ shell_headers = [
 install_headers(shell_headers, subdir: 'rhythmbox/shell')
 
 resources = gnome.compile_resources('rb-resources', 'rhythmbox.gresource.xml',
-  source_dir: '../data/')
+  source_dir: ['data/', 'data/ui/foo'])
 
 shell_sources = [
   'rb-application.c',
diff --git a/sources/meson.build b/sources/meson.build
index 90f2cd0..fa251d0 100644
--- a/sources/meson.build
+++ b/sources/meson.build
@@ -61,14 +61,16 @@ if use_no_strict_aliasing
   source_c_args += ['-fno-strict-aliasing']
 endif
 
+sources_dependencies = [backends_dep, source_sync_dep, totem_plparser]
+
 libsources = static_library('sources', source_sources,
   c_args: source_c_args,
-  include_directories: [
-    configinc, backendsinc, libinc, libmediaplayeridinc, metadatainc,
-    podcastinc, rhythmdbinc, shellinc, sourcesinc, sourcessyncinc, widgetsinc,
-  ],
-  dependencies: [
-    glib, gio, gobject, gstreamer, gtk, libxml, totem_plparser ],
+  include_directories: [ shellinc, widgetsinc, ],
+  dependencies: sources_dependencies,
   install: 'true',
   link_args: ['-export-dynamic'],
 )
+
+sources_dep = declare_dependency(
+  link_with: libsources
+)
diff --git a/sources/sync/meson.build b/sources/sync/meson.build
index 21ba6e4..0d7b416 100644
--- a/sources/sync/meson.build
+++ b/sources/sync/meson.build
@@ -23,11 +23,13 @@ endif
 
 libsourcesync = static_library('sourcesync', sourcesync_sources,
   c_args: sourcesync_c_args,
-  include_directories: [
-    configinc, backendsinc, libinc, libmediaplayeridinc, metadatainc,
-    podcastinc, rhythmdbinc, shellinc, sourcesinc, widgetsinc,
-  ],
-  dependencies: [ gio, glib, gobject, gstreamer_pbutils, gtk, libxml ],
+  dependencies: [podcast_dep],
+  include_directories: [shellinc, sourcesinc, widgetsinc],
   install: 'true',
   link_args: ['-export-dynamic'],
 )
+
+source_sync_dep = declare_dependency(
+  link_with: libsourcesync,
+  include_directories: include_directories('.')
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..fa8e397
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,6 @@
+check = dependency('check', required: false)
+
+if check.found()
+  executable('test-rhythmdb', ['test-rhythmdb.c', 'test-utils.c'],
+      dependencies: [widgets_dep, check])
+endif
diff --git a/widgets/meson.build b/widgets/meson.build
index 4a11f2a..4c2d8ee 100644
--- a/widgets/meson.build
+++ b/widgets/meson.build
@@ -58,33 +58,36 @@ widget_sources = [
   'rb-encoding-settings.c'
 ]
 
-rb_c_args = [
+widget_c_args = [
   '-DGNOMELOCALEDIR="' + get_option('datadir') + '/locale"',
   '-DG_LOG_DOMAIN="Rhythmbox"',
 ]
 
+widget_dependencies = [ lib_dep, rhythmdb_dep, podcast_dep, libnotify ]
 
 librbwidgets = static_library('rbwidgets', widget_sources,
-  c_args: rb_c_args,
+  c_args: widget_c_args,
   include_directories: [
-    configinc, backendsinc, libinc, metadatainc, rhythmdbinc, shellinc,
-    sourcesinc
-  ],
-  dependencies: [
-    gstreamer, gstreamer_pbutils, gtk, libnotify, libsoup, libxml
+    backendsinc, shellinc, sourcesinc
   ],
+  dependencies: widget_dependencies,
   install: 'true',
   link_args: ['-export-dynamic'],
-  link_with: [librb, librhythmdb]
 )
 
+widgets_dep = declare_dependency(
+  # We list librhythmdb in both 'link_with' and 'dependencies' due to
+  # circular dependency between rhythmdb/ and widgets/.
+  link_with: [librhythmdb, librbwidgets],
+  dependencies: widget_dependencies,
+  include_directories: widgetsinc
+)
+
+
 # These are interactive UI tests.
 
 test_rb_segmented_bar = executable('test-rb-segmented-bar', 'test-rb-segmented-bar.c',
-  dependencies: [gtk],
-  link_with: librbwidgets)
+  dependencies: [widgets_dep])
 
 test_uri_dialog = executable('test-uri-dialog', 'test-uri-dialog.c',
-  dependencies: [gtk],
-  include_directories: [libinc],
-  link_with: [librb, librbwidgets])
+  dependencies: [widgets_dep])


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