[totem/wip/inigomartinez/meson-improve: 3/16] build: Migrate to new meson porting guidelines
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/inigomartinez/meson-improve: 3/16] build: Migrate to new meson porting guidelines
- Date: Wed, 21 Feb 2018 11:05:26 +0000 (UTC)
commit 3ea2f5055a8b0286689b5e0aa1581acc4cfc2734
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Fri Feb 16 11:52:04 2018 +0100
build: Migrate to new meson porting guidelines
Following the new meson porting guidelines, this patch renames the
build options. The list of changes is as follows:
- Remove the enable prefix from boolean options.
- Remove the with prefix from string options.
- The character separator from multi-word options has been changed
to underscore.
Automatic feature detection has also been removed. This has involved
reworking some build aspects particularly when adding plguins to
the build.
The old `with-plugins` option has been renamed to `plugins` and now
it's a meson array option, that handles comma separated values. This
option is used now to handle fine grained plugin sets. meson version
has also been bumped to 0.44 to be able to use the array type.
Another meson option has also been added to help with this. This new
option called 'plugins_set` allows setting a predefined set of
plugins.
This both options can be combined to enable a custom set of plugins.
meson.build | 165 ++++++++++--------------------------------
meson_options.txt | 20 +++--
src/backend/meson.build | 8 ++-
src/meson.build | 16 +++-
src/plugins/meson.build | 185 ++++++++++++++++++++---------------------------
5 files changed, 148 insertions(+), 246 deletions(-)
---
diff --git a/meson.build b/meson.build
index b7b00a6..53a4505 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
version: '3.26.0',
license: 'GPL2+ with exception',
default_options: 'buildtype=debugoptimized',
- meson_version: '>= 0.41.0'
+ meson_version: '>= 0.44.0'
)
totem_version = meson.project_version()
@@ -156,113 +156,53 @@ libgd = subproject(
libgd_dep = libgd.get_variable('libgd_dep')
# introspection support
-have_gir = false
-
-introspection_option = get_option('enable-introspection')
-if introspection_option != 'no'
- gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: (introspection_option ==
'yes'))
-
- if gir_dep.found()
- have_gir = true
- endif
+enable_introspection = get_option('introspection')
+if enable_introspection
+ gir_req_version = '>= 0.6.7'
+ assert(dependency('gobject-introspection-1.0', version: gir_req_version, required: false).found(),
+ 'gobject-introspection-1.0 ' + gir_req_version + ' required for introspection support')
endif
# missing plugins support
-missing_plugins_deps = []
-
-easy_codec_option = get_option('enable-easy-codec-installation')
-if easy_codec_option != 'no'
- have_easy_codec = false
-
- gst_pbutils_dep = dependency('gstreamer-pbutils-1.0', required: (easy_codec_option == 'yes'))
- if gst_pbutils_dep.found()
- have_easy_codec = true
- endif
-
- missing_plugins_deps += gst_pbutils_dep
- config_h.set('ENABLE_MISSING_PLUGIN_INSTALLATION', have_easy_codec,
- description: 'Whether we can and want to do installation of missing plugins')
+enable_easy_codec_installation = get_option('easy_codec_installation')
+if enable_easy_codec_installation
+ gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
endif
+config_h.set('ENABLE_MISSING_PLUGIN_INSTALLATION', enable_easy_codec_installation,
+ description: 'Whether we can and want to do installation of missing plugins')
# python support
-have_python = false
-python_deps = []
-
-python_option = get_option('enable-python')
-if python_option != 'no'
- python = import('python3').find_python()
- if python.found()
- python_req_version = '>= 3.0'
+enable_python = get_option('python')
+if enable_python
+ py3 = import('python3')
- r = run_command([python, '--version'])
- python_version = r.stdout().split(' ')[1]
+ assert(py3.find_python().found(), 'python3 required for python support')
+ assert(find_program('pylint-3', 'pylint3', 'pylint', required: false).found(), 'pylint required for python
support')
- pygobject_dep = dependency('pygobject-3.0', version: '>= 2.90.3', required: false)
- pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
+ pygobject_dep = dependency('pygobject-3.0', version: '>= 2.90.3')
- if python_version.version_compare(python_req_version) and pygobject_dep.found() and pylint.found()
- have_python = true
- python_deps += pygobject_dep
- meson.add_install_script('meson_compile_python.py')
- endif
- endif
-
- if not have_python
- str = 'python ' + python_req_version + ', pygobject or pylint not found'
- if python_option == 'yes'
- error(str)
- endif
- message(str + ', disabling Python support')
- endif
+ meson.add_install_script('meson_compile_python.py')
endif
# vala support
-have_vala = false
-
-vala_option = get_option('enable-vala')
-if vala_option != 'no'
- if have_gir
- if add_languages('vala', required: false)
- vala_req_version = '>= 0.14.1'
- if meson.get_compiler('vala').version().version_compare(vala_req_version)
- have_vala = true
- endif
- endif
-
- if not have_vala
- str = 'you need vala ' + vala_req_version + ' installed to use vala plugins'
- endif
- else
- str = 'you need introspection support for the vala plugins'
- endif
+enable_vapi = get_option('vapi')
+if enable_vapi
+ vala_req_version = '>= 0.14.1'
- if not have_vala
- if vala_options == 'yes' or introspection_option == 'yes'
- error(str)
- endif
- message(str)
- endif
+ assert(enable_introspection, 'introspection support required for the vala plugins')
+ assert(add_languages('vala', required: false) and
meson.get_compiler('vala').version().version_compare(vala_req_version),
+ 'vala ' + vala_req_version + ' required for the vala plugins')
endif
# nautilus support
-have_nautilus = false
-
-if get_option('enable-nautilus') != 'no'
+enable_nautilus = get_option('nautilus')
+if enable_nautilus
libnautilus_ext_dep = dependency('libnautilus-extension', version: '>= 2.91.3', required: false)
- if libnautilus_ext_dep.found()
- nautilusdir = get_option('with-nautilusdir')
- if nautilusdir == ''
- nautilusdir = libnautilus_ext_dep.get_pkgconfig_variable('extensiondir')
- endif
+ assert(libnautilus_ext_dep.found(), 'libnautilus-extension required for nautilus support')
- have_nautilus = true
- message('installing nautilus plugin in ' + nautilusdir)
- else
- if get_option('enable-nautilus') == 'yes'
- error('nautilus support enabled but libnautilus-extension missing')
- else
- message('libnautilus-extension missing so disabling nautilus supportt')
- endif
+ nautilusdir = get_option('nautilusdir')
+ if nautilusdir == ''
+ nautilusdir = libnautilus_ext_dep.get_pkgconfig_variable('extensiondir')
endif
endif
@@ -289,49 +229,22 @@ subdir('data')
subdir('help')
subdir('src')
-if get_option('enable-gtk-doc')
+if get_option('gtk_doc')
subdir('docs')
endif
meson.add_install_script('meson_post_install.py')
message('Totem was configured with the following options:')
-message('** Using the GStreamer-1.0 backend')
-
-str = 'Easy codec installation support'
-if have_easy_codec
- message('** ' + str + ' enabled')
-else
- message(' ' + str + ' disabled')
-endif
-
-str = 'Python plugin support'
-if have_python
- message('** ' + str + ' enabled')
-else
- message(' ' + str + ' disabled')
-endif
-
-str = 'Vala plugin support'
-if have_vala
- message('** ' + str + ' enabled')
-else
- message(' ' + str + ' disabled')
+message('Using the GStreamer-1.0 backend')
+message('Easy codec installation support: ' + enable_easy_codec_installation.to_string())
+message('Python plugin support: ' + enable_python.to_string())
+message('Vala plugin support: ' + enable_vapi.to_string())
+message('Nautilus properties page: ' + enable_nautilus.to_string())
+if enable_nautilus
+ message('installing nautilus plugin in: ' + nautilusdir)
endif
-
foreach plugin: allowed_plugins
- if plugins.contains(plugin)
- message('** ' + plugin + ' plugin enabled')
- else
- message(' ' + plugin + ' plugin disabled')
- endif
+ message('Plugin ' + plugin + ': ' + plugins.contains(plugin).to_string())
endforeach
-
-str = 'Nautilus properties page'
-if have_nautilus
- message('** ' + str + ' enabled')
-else
- message(' ' + str + ' disabled')
-endif
-
message('End options')
diff --git a/meson_options.txt b/meson_options.txt
index 3b6ff67..4b8797b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,8 +1,12 @@
-option('enable-easy-codec-installation', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto',
description: 'Whether to enable easy codec installation support for GStreamer')
-option('enable-python', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'Enable
python support')
-option('enable-vala', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'whether
Vala plugin support is requested')
-option('with-plugins', type: 'combo', choices: ['all', 'none', 'auto'], value: 'auto', description: 'Which
Totem plugins to compile (default: auto; "all", "none" and "auto" are valid)')
-option('enable-nautilus', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description:
'compile the nautilus plugin')
-option('with-nautilusdir', type: 'string', value: '', description: 'Installation path for Nautilus
extension')
-option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
-option('enable-introspection', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description:
'Enable GObject Introspection (depends on GObject)')
+option('easy_codec_installation', type: 'boolean', value: true, description: 'Whether to enable easy codec
installation support for GStreamer')
+option('python', type: 'boolean', value: true, description: 'Enable python support')
+option('vapi', type: 'boolean', value: true, description: 'whether Vala plugin support is requested')
+
+option('plugins_set', type: 'combo', choices: ['all', 'base', 'none'], value: 'all', description:
'Predefined sets of plugins to compile')
+option('plugins', type: 'array', value: [], description: 'Comma separated list of Totem plugins to compile')
+
+option('nautilus', type: 'boolean', value: true, description: 'compile the nautilus plugin')
+option('nautilusdir', type: 'string', value: '', description: 'Installation path for Nautilus extension')
+
+option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on
GObject)')
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 28c8e12..ca0fda9 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -71,7 +71,7 @@ libbacon_video_widget_incs = [
gst_inc
]
-libbacon_video_widget_deps = missing_plugins_deps + [
+libbacon_video_widget_deps = [
gst_dep,
dependency('gstreamer-base-1.0', version: gst_req_version),
dependency('gstreamer-plugins-base-1.0', version: gst_req_version),
@@ -93,6 +93,10 @@ libbacon_video_widget_cflags = common_flags + warn_flags + [
'-DDATADIR="@0@"'.format(totem_pkgdatadir)
]
+if enable_easy_codec_installation
+ libbacon_video_widget_deps += gst_pbutils_dep
+endif
+
libbacon_video_widget = static_library(
'baconvideowidget',
sources: sources + libbacon_gen_sources,
@@ -108,7 +112,7 @@ libbacon_video_widget_dep = declare_dependency(
sources: libbacon_gen_sources
)
-if have_easy_codec
+if enable_easy_codec_installation
backend_test = 'bvw-test'
executable(
diff --git a/src/meson.build b/src/meson.build
index 1e79c2e..7b552a5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -53,7 +53,7 @@ totem_common_incs = [
plugins_inc
]
-totem_common_deps = libbacon_video_widget_deps + python_deps + [
+totem_common_deps = libbacon_video_widget_deps + [
glib_dep,
gio_dep,
gtk_dep,
@@ -77,6 +77,10 @@ totem_common_cflags = common_flags + warn_flags + [
'-DGTKBUILDERDIR=""'
]
+if enable_python
+ totem_common_deps += pygobject_dep
+endif
+
headers = files(
'plugins/totem-plugin.h',
'plugins/totem-dirs.h',
@@ -253,13 +257,13 @@ executable(
install_dir: totem_libexecdir
)
-if have_nautilus
+if enable_nautilus
libtotem_properties_page_sources = files(
'totem-properties-main.c',
'totem-properties-view.c'
)
- libtotem_properties_page_deps = missing_plugins_deps + [
+ libtotem_properties_page_deps = [
gtk_dep,
dependency('gthread-2.0'),
libnautilus_ext_dep,
@@ -267,6 +271,10 @@ if have_nautilus
libbacon_video_widget_properties_dep
]
+ if enable_easy_codec_installation
+ libtotem_properties_page_deps += gst_pbutils_dep
+ endif
+
libtotem_properties_page = shared_module(
'totem-properties-page',
sources: libtotem_properties_page_sources + gen_sources,
@@ -312,7 +320,7 @@ executable(
c_args: totem_common_cflags
)
-if have_gir
+if enable_introspection
gir_sources = libtotem_sources + libtotem_player_sources + headers
gir_incs = [
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 6c884dc..77e2e03 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -12,138 +12,111 @@ plugins_cflags = common_flags + warn_flags + [
plugins_conf = configuration_data()
plugins_conf.set('GETTEXT_PACKAGE', meson.project_name())
-allowed_plugins = [
+base_plugins = [
'apple-trailers',
'autoload-subtitles',
- 'brasero-disc-recorder',
- 'dbusservice',
- 'gromit',
'im-status',
- 'lirc',
'media-player-keys',
'ontop',
- 'opensubtitles',
'properties',
- 'pythonconsole',
'recent',
- 'rotation',
- 'sample-vala',
- 'samplepython',
- 'save-file',
'screensaver',
'screenshot',
'skipto',
'variable-rate',
- 'vimeo',
+ 'vimeo'
+]
+
+brasero_plugins = ['brasero-disc-recorder']
+
+lirc_plugins = ['lirc']
+
+nautilus_plugins = ['save-file']
+
+python_plugins = [
+ 'dbusservice',
+ 'opensubtitles',
+ 'pythonconsole',
+ 'samplepython'
+]
+
+vala_plugins = [
+ 'rotation',
+ 'sample-vala',
'zeitgeist-dp'
]
-plugins = []
+x11_plugins = ['gromit']
-plugins_option = get_option('with-plugins')
-if plugins_option != 'none'
- plugins += [
- 'apple-trailers',
- 'autoload-subtitles',
- 'im-status',
- 'media-player-keys',
- 'ontop',
- 'properties',
- 'recent',
- 'screensaver',
- 'screenshot',
- 'skipto',
- 'variable-rate',
- 'vimeo'
- ]
+allowed_plugins = base_plugins + brasero_plugins + lirc_plugins + nautilus_plugins + python_plugins +
vala_plugins + x11_plugins
+
+if get_option('plugins_set') == 'all'
+ enable_plugins = allowed_plugins
+elif get_option('plugins_set') == 'base'
+ enable_plugins = base_plugins
+else
+ enable_plugins = []
+endif
- plugin_error = (plugins_option == 'all')
-
- gdk_targets = gtk_dep.get_pkgconfig_variable('targets')
- if gdk_targets.contains('x11')
- plugins += 'gromit'
- else
- str = 'the gromit plugin is not supported on non-X11 targets'
- if plugin_error
- error(str)
- endif
- message(str)
+enable_plugins += get_option('plugins')
+
+# Sanity check: Make sure enabled extensions are valid and also remove duplicates
+plugins = []
+foreach plugin: enable_plugins
+ assert(allowed_plugins.contains(plugin), 'Invalid plugin: ' + plugin)
+ if not plugins.contains(plugin)
+ plugins += plugin
endif
+endforeach
+if plugins.contains('gromit')
+ assert(gtk_dep.get_pkgconfig_variable('targets').contains('x11'), 'the gromit plugin is not supported on
non-X11 targets')
+endif
+
+if plugins.contains('lirc')
lirc_dep = dependency('lirc', required: false)
- if lirc_dep.found() and cc.has_function('lirc_init', dependencies: lirc_dep) and
cc.has_header('lirc/lirc_client.h')
- plugins += 'lirc'
- else
- str = 'you need lirc_client installed for the lirc plugin'
- if plugin_error
- error(str)
- endif
- message(str)
- endif
+ assert(lirc_dep.found() and cc.has_function('lirc_init', dependencies: lirc_dep) and
cc.has_header('lirc/lirc_client.h'),
+ 'lirc_client is required for the lirc plugin')
+endif
+if plugins.contains('brasero-disc-recorder')
libxml_req_version = '>= 2.6.0'
libxml_dep = dependency('libxml-2.0', version: libxml_req_version, required: false)
gtk_x11_dep = dependency('gtk+-x11-3.0', version: gtk_req_version, required: false)
- if libxml_dep.found() and gtk_x11_dep.found()
- plugins += 'brasero-disc-recorder'
- else
- str = 'you need libxml-2.0 ' + libxml_req_version + ' and gtk+-x11-3.0 to use the brasero-disc-recorder
plugin'
- if plugin_error
- error(str)
- endif
- message(str)
- endif
+ assert(libxml_dep.found() and gtk_x11_dep.found(), 'libxml-2.0 ' + libxml_req_version + ' and gtk+-x11-3.0
is required for the brasero-disc-recorder plugin')
+endif
- if have_nautilus
- plugins += 'save-file'
- else
- str = 'you need libnautilus-extension to use the save-file plugin'
- if plugin_error
- error(str)
- endif
- message(str)
- endif
+if plugins.contains('save-file')
+ assert(enable_nautilus, 'nautilus support required for the save-file plugin')
+endif
- if have_python
- plugins += [
- 'dbusservice',
- 'opensubtitles',
- 'pythonconsole',
- 'samplepython'
- ]
- endif
+foreach plugin: python_plugins
+ assert(enable_python or not plugins.contains(plugin), 'python support required for the ' + plugin + '
plugin')
+endforeach
+
+foreach plugin: vala_plugins
+ assert(enable_vapi or not plugins.contains(plugin), 'vala support required for the ' + plugin + ' plugin')
+endforeach
+
+if enable_vapi
+ plugins_vala_deps = [declare_dependency(sources: libtotem_gir[0])]
+
+ plugins_vala_flags = [
+ '-Wno-unused-but-set-variable',
+ '-Wno-unused-function',
+ '-Wno-unused-variable'
+ ]
+
+ plugins_vala_args = [
+ '--girdir=' + join_paths(meson.build_root(), 'src'),
+ '--pkg=@0@-@1@'.format(totem_gir_ns, totem_api_version)
+ ]
+
+ if plugins.contains('zeitgeist-dp')
+ zeitgeist_req_version = '>= 0.9.12'
- if have_vala
- plugins_vala_deps = [
- declare_dependency(sources: libtotem_gir[0])
- ]
-
- plugins_vala_flags = [
- '-Wno-unused-but-set-variable',
- '-Wno-unused-function',
- '-Wno-unused-variable'
- ]
-
- plugins_vala_args = [
- '--girdir=' + join_paths(meson.build_root(), 'src'),
- '--pkg=@0@-@1@'.format(totem_gir_ns, totem_api_version)
- ]
-
- plugins += [
- 'rotation',
- 'sample-vala'
- ]
-
- zeitgeist_dep = dependency('zeitgeist-2.0', version: '>= 0.9.12', required: false)
- if zeitgeist_dep.found()
- plugins += 'zeitgeist-dp'
- else
- str = 'you need zeitgeist-2.0 >= 0.9.12 to use the zeitgeist-dp plugin'
- if plugin_error
- error(str)
- endif
- message(str)
- endif
+ zeitgeist_dep = dependency('zeitgeist-2.0', version: zeitgeist_req_version, required: false)
+ assert(zeitgeist_dep.found(), 'zeitgeist-2.0 ' + zeitgeist_req_version + ' support required for the
zeitgeist-dp plugin')
endif
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]