meson: Add feature options for many plugins
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 25 Jul 2018 11:42:00 +0000 (17:12 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 27 Jul 2018 13:13:52 +0000 (18:43 +0530)
The rest will be converted later, these are necessary for gst-build to
set options correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=795107

ext/meson.build
gst/meson.build
meson.build
meson_options.txt
tests/examples/waylandsink/meson.build
tests/meson.build

index 231b395..fbd73ff 100644 (file)
@@ -1,3 +1,4 @@
+# FIXME implement these
 subdir('assrender')
 subdir('aom')
 subdir('bs2b')
index b6cba95..9809f1a 100644 (file)
@@ -1,63 +1,18 @@
-subdir('accurip')
-subdir('adpcmdec')
-subdir('adpcmenc')
-subdir('aiff')
-subdir('asfmux')
-subdir('audiobuffersplit')
-subdir('audiofxbad')
-subdir('audiomixmatrix')
-subdir('audiolatency')
-subdir('audiovisualizers')
-subdir('autoconvert')
-subdir('bayer')
-subdir('camerabin2')
-subdir('coloreffects')
-subdir('compositor')
-subdir('debugutils')
-subdir('dvbsuboverlay')
-subdir('dvdspu')
-subdir('faceoverlay')
-subdir('festival')
-subdir('fieldanalysis')
-subdir('freeverb')
-subdir('frei0r')
-subdir('gaudieffects')
-subdir('gdp')
-subdir('geometrictransform')
-subdir('id3tag')
-subdir('inter')
-subdir('interlace')
-subdir('ivfparse')
-subdir('ivtc')
-subdir('jp2kdecimator')
-subdir('jpegformat')
-subdir('librfb')
-subdir('midi')
-subdir('mpegdemux')
-subdir('mpegpsmux')
-subdir('mpegtsdemux')
-subdir('mpegtsmux')
-subdir('mxf')
-subdir('netsim')
-subdir('onvif')
-subdir('pcapparse')
-subdir('pnm')
-subdir('proxy')
-subdir('rawparse')
-subdir('removesilence')
-subdir('sdp')
-subdir('segmentclip')
-subdir('siren')
-subdir('smooth')
-#subdir('smoothwave')
-subdir('speed')
-subdir('stereo')
-subdir('subenc')
-subdir('timecode')
-subdir('videofilters')
-subdir('videoframe_audiolevel')
-subdir('videoparsers')
-subdir('videosignal')
-subdir('vmnc')
-subdir('y4m')
-subdir('yadif')
+foreach plugin : ['accurip', 'adpcmdec', 'adpcmenc', 'aiff', 'asfmux',
+                  'audiobuffersplit', 'audiofxbad', 'audiomixmatrix',
+                  'audiolatency', 'audiovisualizers', 'autoconvert', 'bayer',
+                  'camerabin2', 'coloreffects', 'compositor', 'debugutils',
+                  'dvbsuboverlay', 'dvdspu', 'faceoverlay', 'festival',
+                  'fieldanalysis', 'freeverb', 'frei0r', 'gaudieffects', 'gdp',
+                  'geometrictransform', 'id3tag', 'inter', 'interlace',
+                  'ivfparse', 'ivtc', 'jp2kdecimator', 'jpegformat', 'librfb',
+                  'midi', 'mpegdemux', 'mpegpsmux', 'mpegtsdemux', 'mpegtsmux',
+                  'mxf', 'netsim', 'onvif', 'pcapparse', 'pnm', 'proxy',
+                  'rawparse', 'removesilence', 'sdp', 'segmentclip', 'siren',
+                  'smooth', 'speed', 'stereo', 'subenc', 'timecode',
+                  'videofilters', 'videoframe_audiolevel', 'videoparsers',
+                  'videosignal', 'vmnc', 'y4m', 'yadif']
+  if not get_option(plugin).disabled()
+    subdir(plugin)
+  endif
+endforeach
index 9c8f894..9978f85 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-plugins-bad', 'c', 'cpp',
   version : '1.15.0.1',
-  meson_version : '>= 0.46',
+  meson_version : '>= 0.47',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
@@ -273,9 +273,6 @@ cdata.set_quoted('GST_API_VERSION', api_version)
 cdata.set_quoted('GST_LICENSE', 'LGPL')
 cdata.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
-if get_option('nls')
-  cdata.set('ENABLE_NLS', 1)
-endif
 
 warning_flags = [
   '-Wmissing-declarations',
@@ -460,20 +457,15 @@ endif
 
 have_orcc = false
 orcc_args = []
-if get_option('orc') != 'no'
-  need_orc = get_option('orc') == 'yes'
-  # Used by various libraries/elements that use Orc code
-  orc_dep = dependency('orc-0.4', required : need_orc)
-  orcc = find_program('orcc', required : need_orc)
-  if orc_dep.found() and orcc.found()
-    have_orcc = true
-    orcc_args = [orcc, '--include', 'glib.h']
-    cdata.set('HAVE_ORC', 1)
-  else
-    message('Orc Compiler not found, will use backup C code')
-    cdata.set('DISABLE_ORC', 1)
-  endif
+# Used by various libraries/elements that use Orc code
+orc_dep = dependency('orc-0.4', required : get_option('orc'))
+orcc = find_program('orcc', required : get_option('orc'))
+if orc_dep.found() and orcc.found()
+  have_orcc = true
+  orcc_args = [orcc, '--include', 'glib.h']
+  cdata.set('HAVE_ORC', 1)
 else
+  message('Orc Compiler not found or disabled, will use backup C code')
   cdata.set('DISABLE_ORC', 1)
 endif
 
@@ -495,9 +487,9 @@ libsinc = include_directories('gst-libs')
 
 python3 = import('python3').find_python()
 
-gir = find_program('g-ir-scanner', required : false)
+gir = find_program('g-ir-scanner', required : get_option('introspection'))
 gnome = import('gnome')
-build_gir = gir.found() and not meson.is_cross_build() and get_option('introspection')
+build_gir = gir.found() and not meson.is_cross_build()
 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
     'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
@@ -518,11 +510,12 @@ subdir('ext')
 subdir('tests')
 subdir('pkgconfig')
 
-configure_file(output : 'config.h', configuration : cdata)
-
 # xgettext is optional (on Windows for instance)
-if get_option('nls') and find_program('xgettext', required : false).found()
+if find_program('xgettext', required : get_option('nls')).found()
+  cdata.set('ENABLE_NLS', 1)
   subdir('po')
 endif
 
+configure_file(output : 'config.h', configuration : cdata)
+
 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
index 6380411..4b9ab7b 100644 (file)
@@ -1,12 +1,77 @@
 option('gst_player_tests', type: 'boolean', value: false,
        description: 'Enable GstPlayer tests that need network access')
 
+# Feature options for plugins without external deps
+option('accurip', type : 'feature', value : 'auto')
+option('adpcmdec', type : 'feature', value : 'auto')
+option('adpcmenc', type : 'feature', value : 'auto')
+option('aiff', type : 'feature', value : 'auto')
+option('asfmux', type : 'feature', value : 'auto')
+option('audiobuffersplit', type : 'feature', value : 'auto')
+option('audiofxbad', type : 'feature', value : 'auto')
+option('audiomixmatrix', type : 'feature', value : 'auto')
+option('audiolatency', type : 'feature', value : 'auto')
+option('audiovisualizers', type : 'feature', value : 'auto')
+option('autoconvert', type : 'feature', value : 'auto')
+option('bayer', type : 'feature', value : 'auto')
+option('camerabin2', type : 'feature', value : 'auto')
+option('coloreffects', type : 'feature', value : 'auto')
+option('compositor', type : 'feature', value : 'auto')
+option('debugutils', type : 'feature', value : 'auto')
+option('dvbsuboverlay', type : 'feature', value : 'auto')
+option('dvdspu', type : 'feature', value : 'auto')
+option('faceoverlay', type : 'feature', value : 'auto')
+option('festival', type : 'feature', value : 'auto')
+option('fieldanalysis', type : 'feature', value : 'auto')
+option('freeverb', type : 'feature', value : 'auto')
+option('frei0r', type : 'feature', value : 'auto')
+option('gaudieffects', type : 'feature', value : 'auto')
+option('gdp', type : 'feature', value : 'auto')
+option('geometrictransform', type : 'feature', value : 'auto')
+option('id3tag', type : 'feature', value : 'auto')
+option('inter', type : 'feature', value : 'auto')
+option('interlace', type : 'feature', value : 'auto')
+option('ivfparse', type : 'feature', value : 'auto')
+option('ivtc', type : 'feature', value : 'auto')
+option('jp2kdecimator', type : 'feature', value : 'auto')
+option('jpegformat', type : 'feature', value : 'auto')
+option('librfb', type : 'feature', value : 'auto')
+option('midi', type : 'feature', value : 'auto')
+option('mpegdemux', type : 'feature', value : 'auto')
+option('mpegpsmux', type : 'feature', value : 'auto')
+option('mpegtsdemux', type : 'feature', value : 'auto')
+option('mpegtsmux', type : 'feature', value : 'auto')
+option('mxf', type : 'feature', value : 'auto')
+option('netsim', type : 'feature', value : 'auto')
+option('onvif', type : 'feature', value : 'auto')
+option('pcapparse', type : 'feature', value : 'auto')
+option('pnm', type : 'feature', value : 'auto')
+option('proxy', type : 'feature', value : 'auto')
+option('rawparse', type : 'feature', value : 'auto')
+option('removesilence', type : 'feature', value : 'auto')
+option('sdp', type : 'feature', value : 'auto')
+option('segmentclip', type : 'feature', value : 'auto')
+option('siren', type : 'feature', value : 'auto')
+option('smooth', type : 'feature', value : 'auto')
+option('speed', type : 'feature', value : 'auto')
+option('stereo', type : 'feature', value : 'auto')
+option('subenc', type : 'feature', value : 'auto')
+option('timecode', type : 'feature', value : 'auto')
+option('videofilters', type : 'feature', value : 'auto')
+option('videoframe_audiolevel', type : 'feature', value : 'auto')
+option('videoparsers', type : 'feature', value : 'auto')
+option('videosignal', type : 'feature', value : 'auto')
+option('vmnc', type : 'feature', value : 'auto')
+option('y4m', type : 'feature', value : 'auto')
+option('yadif', type : 'feature', value : 'auto')
+
+# Common feature options
+option('examples', type : 'feature', value : 'auto', yield : true)
+option('introspection', type : 'feature', value : 'auto', yield : true, description : 'Generate gobject-introspection bindings')
+option('nls', type : 'feature', value : 'auto', yield: true, description : 'Enable native language support (translations)')
+option('orc', type : 'feature', value : 'auto', yield : true)
+
 # Common options
-option('nls', type : 'boolean', value : true, yield: true,
-        description : 'Enable native language support (translations)')
-option('orc', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', yield : true)
-option('introspection', type : 'boolean', value : true, yield : true,
-        description : 'Generate gobject-introspection bindings')
 option('package-name', type : 'string', yield : true,
        description : 'package name to use in plugins')
 option('package-origin', type : 'string', value : 'Unknown package origin', yield : true,
index 9dd183b..258fc5e 100644 (file)
@@ -1,5 +1,5 @@
-gtk_dep = dependency('gtk+-3.0', required : false)
-gtk_wayland_dep = dependency('gtk+-wayland-3.0', required : false)
+gtk_dep = dependency('gtk+-3.0', required : get_option('examples'))
+gtk_wayland_dep = dependency('gtk+-wayland-3.0', required : get_option('examples'))
 
 if use_wayland and gtk_dep.found() and gtk_wayland_dep.found()
   executable('waylandsink',
index ffab51e..f15fe4d 100644 (file)
@@ -2,5 +2,6 @@
 if host_machine.system() != 'windows'
   subdir('check')
 endif
-
-subdir('examples')
+if not get_option('examples').disabled()
+  subdir('examples')
+endif