meson: Add feature options for all plugins
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 25 Jul 2018 02:05:28 +0000 (07:35 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 27 Jul 2018 13:12:54 +0000 (18:42 +0530)
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

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

36 files changed:
ext/aalib/meson.build
ext/cairo/meson.build
ext/dv/meson.build
ext/flac/meson.build
ext/gdk_pixbuf/meson.build
ext/gtk/meson.build
ext/jack/meson.build
ext/jpeg/meson.build
ext/lame/meson.build
ext/libcaca/meson.build
ext/libpng/meson.build
ext/mpg123/meson.build
ext/pulse/meson.build
ext/qt/meson.build
ext/raw1394/meson.build
ext/shout2/meson.build
ext/soup/meson.build
ext/speex/meson.build
ext/taglib/meson.build
ext/twolame/meson.build
ext/vpx/meson.build
ext/wavpack/meson.build
gst/matroska/meson.build
gst/meson.build
meson.build
meson_options.txt
sys/directsound/meson.build
sys/meson.build
sys/oss/meson.build
sys/oss4/meson.build
sys/v4l2/meson.build
sys/ximage/meson.build
tests/examples/qt/qmlsink/meson.build
tests/examples/qt/qmlsrc/meson.build
tests/icles/meson.build
tests/meson.build

index 12cdf72..a9d0d19 100644 (file)
@@ -1,7 +1,18 @@
 # Very much not going to implement all kinds of logic around aalib-config
-# or cater for non-standard prefixes.
-if cc.has_header('aalib.h')
-  libaa_dep = cc.find_library('aa', required : false)
+
+have_aalib = false
+
+# TODO: https://github.com/mesonbuild/meson/issues/3940
+aalib_option = get_option('aalib')
+if not aalib_option.disabled()
+  have_aalib = cc.has_header('aalib.h')
+  if not have_aalib and aalib_option.enabled()
+    error('aalib plugin enabled, but aalib.h not found')
+  endif
+endif
+
+if have_aalib
+  libaa_dep = cc.find_library('aa', required : aalib_option)
   if libaa_dep.found()
     library('gstaasink', 'gstaasink.c',
       c_args : gst_plugins_good_args,
index 0de51ee..26d73fb 100644 (file)
@@ -1,4 +1,4 @@
-cairo_dep = dependency('cairo-gobject', version : '>=1.10.0', required : false)
+cairo_dep = dependency('cairo-gobject', version : '>=1.10.0', required : get_option('cairo'))
 
 if cairo_dep.found()
   gstcairo = library('gstcairo',
index e012a08..1df2ae5 100644 (file)
@@ -6,7 +6,7 @@ dv_sources = [
   'smpte_test.c',
 ]
 
-dv_dep = dependency('libdv', version : '>= 0.100', required : false)
+dv_dep = dependency('libdv', version : '>= 0.100', required : get_option('dv'))
 
 if dv_dep.found()
   gstdv = library('gstdv',
@@ -19,6 +19,7 @@ if dv_dep.found()
   )
   pkgconfig.generate(gstdv, install_dir : plugins_pkgconfig_install_dir)
 
+  # FIXME
   #executable('smpte_test',
   #  'smpte_test.c', 'gstsmptetimecode.c',
   #  dependencies : [gstbase_dep, gsttag_dep, gstaudio_dep, gstvideo_dep, dv_dep],
index a533b09..5bede52 100644 (file)
@@ -5,7 +5,7 @@ flac_sources = [
   'gstflactag.c',
 ]
 
-flac_dep = dependency('flac', version : '>=1.1.4', required : false)
+flac_dep = dependency('flac', version : '>=1.1.4', required : get_option('flac'))
 
 if flac_dep.found()
   gstflac = library('gstflac',
index 1906083..76c2992 100644 (file)
@@ -5,7 +5,7 @@ pixbuf_sources = [
   'gstgdkpixbufsink.c',
 ]
 
-gdkpixbuf_dep = dependency('gdk-pixbuf-2.0', version : '>=2.8.0', required : false)
+gdkpixbuf_dep = dependency('gdk-pixbuf-2.0', version : '>=2.8.0', required : get_option('gdk-pixbuf'))
 
 if gdkpixbuf_dep.found()
   gstgdkpixbuf = library('gstgdkpixbuf',
index 22e4f5d..62b65b0 100644 (file)
@@ -10,12 +10,13 @@ gtk_sources = [
 gtk_defines = []
 optional_deps = []
 
-gtk_dep = dependency('gtk+-3.0', required : false)
+gtk_dep = dependency('gtk+-3.0', required : get_option('gtk3'))
 if gtk_dep.found()
   if build_gstgl and gstgl_dep.found() and gtk_dep.version().version_compare('>=3.15.0')
     have_gtk3_gl_windowing = false
 
     if gst_gl_have_window_x11 and gst_gl_have_platform_glx
+      # FIXME: automagic
       gtk_x11_dep = dependency('gtk+-x11-3.0', required : false)
       if gtk_x11_dep.found()
         optional_deps += gtk_x11_dep
@@ -24,6 +25,7 @@ if gtk_dep.found()
     endif
 
     if gst_gl_have_window_wayland and gst_gl_have_platform_egl
+      # FIXME: automagic
       gtk_wayland_dep = dependency('gtk+-wayland-3.0', required : false)
       if gtk_wayland_dep.found()
         optional_deps += gtk_wayland_dep
index 173f2d4..1f591f2 100644 (file)
@@ -6,7 +6,7 @@ jack_sources = [
   'gstjackutil.c',
 ]
 
-libjack_dep = dependency('jack', version : '>= 1.9.7', required : false)
+libjack_dep = dependency('jack', version : '>= 1.9.7', required : get_option('jack'))
 
 if libjack_dep.found()
   gstjack = library('gstjack',
index 5108d42..2222491 100644 (file)
@@ -4,7 +4,7 @@ jpeg_sources = [
   'gstjpegdec.c',
 ]
 
-jpeglib = cc.find_library('jpeg', required : false)
+jpeglib = cc.find_library('jpeg', required : get_option('jpeg'))
 
 if jpeglib.found()
   gstjpeg = library('gstjpeg',
index 23faa2c..6581f42 100644 (file)
@@ -1,6 +1,16 @@
-lame_dep = cc.find_library('mp3lame', required : false)
+lame_option = get_option('lame')
+lame_dep = cc.find_library('mp3lame', required : lame_option)
+have_lame = lame_dep.found()
 
-if lame_dep.found() and cc.has_header_symbol('lame/lame.h', 'lame_init')
+# TODO: https://github.com/mesonbuild/meson/issues/3940
+if have_lame
+  have_lame = cc.has_header_symbol('lame/lame.h', 'lame_init')
+  if not have_lame and lame_option.enabled()
+    error('Found libmp3lame but lame.h was not usable')
+  endif
+endif
+
+if have_lame
   lame_extra_c_args = []
   if cc.has_header_symbol('lame/lame.h', 'lame_set_VBR_quality')
     lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY']
index 5ff8714..dbcb8ea 100644 (file)
@@ -1,4 +1,4 @@
-libcaca_dep = dependency('caca', required : false)
+libcaca_dep = dependency('caca', required : get_option('caca'))
 
 if libcaca_dep.found()
   library('gstcacasink', 'gstcacasink.c',
index f6511f4..e520886 100644 (file)
@@ -4,7 +4,7 @@ png_sources = [
   'gstpngdec.c',
 ]
 
-libpng_dep = dependency('libpng', version : '>=1.2', required : false)
+libpng_dep = dependency('libpng', version : '>=1.2', required : get_option('png'))
 
 if libpng_dep.found()
   gstpng = library('gstpng',
index 3e659d5..668ef1d 100644 (file)
@@ -1,4 +1,4 @@
-mpg123_dep = dependency('libmpg123', version : '>= 1.3', required : false)
+mpg123_dep = dependency('libmpg123', version : '>= 1.3', required : get_option('mpg123'))
 
 if mpg123_dep.found()
   gstmpg123 = library('gstmpg123',
index 28b4d61..be8fea4 100644 (file)
@@ -6,7 +6,7 @@ pulse_sources = [
   'pulseutil.c',
 ]
 
-libpulse_dep = dependency('libpulse', version : '>=2.0', required : false)
+libpulse_dep = dependency('libpulse', version : '>=2.0', required : get_option('pulse'))
 
 if libpulse_dep.found()
   gstpulse = library('gstpulseaudio',
index 976768e..6fee167 100644 (file)
@@ -14,12 +14,14 @@ moc_headers = [
   'gstqsgtexture.h',
 ]
 
+# FIXME: -Dqt5=enabled is silently ignored if a c++ compiler is not found
 if have_cxx and build_gstgl
   qt5_mod = import('qt5')
-  qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'], required: false)
+  qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
+                          required: get_option('qt5'))
 
   # FIXME Add a way to get that information out of the qt5 module
-  moc = find_program('moc-qt5', 'moc', required : false)
+  moc = find_program('moc-qt5', 'moc', required : get_option('qt5'))
   if qt5qml_dep.found() and moc.found()
     optional_deps = []
     qt_defines = []
@@ -30,6 +32,7 @@ if have_cxx and build_gstgl
     # This semi-matches what meson does internally with the qt5 module
     # FIXME Add a way to get some of this information out of the qt5 module
     if not have_qpa_include
+      # FIXME: automagic
       qt5core_dep = dependency('Qt5Core', required: false)
       if qt5core_dep.found() and qt5core_dep.type_name() == 'pkgconfig'
         qt_version = qt5core_dep.version()
@@ -64,6 +67,7 @@ if have_cxx and build_gstgl
     # Try to come up with all the platform/winsys combinations that will work
 
     if gst_gl_have_window_x11 and gst_gl_have_platform_glx
+      # FIXME: automagic
       qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false)
       if qt5x11extras.found()
         optional_deps += qt5x11extras
@@ -75,6 +79,7 @@ if have_cxx and build_gstgl
     if gst_gl_have_platform_egl
       if have_qpa_include
         if gst_gl_have_window_wayland
+          # FIXME: automagic
           qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], required : false)
           if qt5waylandextras.found()
             optional_deps += qt5waylandextras
@@ -83,6 +88,7 @@ if have_cxx and build_gstgl
           endif
         endif
         if gst_gl_have_window_android
+          # FIXME: automagic
           # FIXME: untested
           qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], required : false)
           if qt5androidextras.found()
@@ -98,6 +104,7 @@ if have_cxx and build_gstgl
 
     if gst_gl_have_platform_wgl and gst_gl_have_window_win32
       # for wglMakeCurrent()
+      # FIXME: automagic
       opengl32_dep = cc.find_library('opengl32', required : false)
       if opengl32_dep.found()
         qt_defines += ['-DHAVE_QT_WIN32']
index 27a6a5a..6f030e3 100644 (file)
@@ -1,6 +1,6 @@
-raw1394_dep = dependency('libraw1394', version: '>= 2.0.0', required: false)
-avc1394_dep = dependency('libavc1394', version: '>= 0.5.4', required: false)
-iec61883_dep = dependency('libiec61883', version: '>= 1.0.0', required: false)
+raw1394_dep = dependency('libraw1394', version: '>= 2.0.0', required: get_option('dv1394'))
+avc1394_dep = dependency('libavc1394', version: '>= 0.5.4', required: get_option('dv1394'))
+iec61883_dep = dependency('libiec61883', version: '>= 1.0.0', required: get_option('dv1394'))
 
 have_1394 = false
 if raw1394_dep.found() and iec61883_dep.found() and avc1394_dep.found()
index cd67b4c..c5b8da5 100644 (file)
@@ -1,6 +1,6 @@
 shout2_sources = ['gstshout2.c']
 
-shout2_dep = dependency('shout', version : '>= 2.0', required : false)
+shout2_dep = dependency('shout', version : '>= 2.0', required : get_option('shout2'))
 
 if shout2_dep.found()
   gstshout2 = library('gstshout2',
index d231330..93d46bc 100644 (file)
@@ -10,7 +10,7 @@ soup_args = [
   '-DSOUP_VERSION_MAX_ALLOWED=SOUP_DEPRECATED_IN_2_48',
 ]
 
-libsoup_dep = dependency('libsoup-2.4', version : '>=2.48', required : false)
+libsoup_dep = dependency('libsoup-2.4', version : '>=2.48', required : get_option('soup'))
 
 if libsoup_dep.found()
   gstsouphttpsrc = library('gstsoup',
index 931d7bb..d7dacd4 100644 (file)
@@ -4,7 +4,7 @@ speex_sources = [
   'gstspeexenc.c',
 ]
 
-speex_dep = dependency('speex', version : '>=1.1.6', required : false)
+speex_dep = dependency('speex', version : '>=1.1.6', required : get_option('speex'))
 
 if speex_dep.found()
   gstspeex = library('gstspeex',
index 5a93ff3..1e5767d 100644 (file)
@@ -4,9 +4,9 @@ taglib_sources = [
   'gsttaglibplugin.c',
 ]
 
-taglib_dep = dependency('taglib', version : '>= 1.5', required : false)
+taglib_dep = dependency('taglib', version : '>= 1.5', required : get_option('taglib'))
 
-if taglib_dep.found() and add_languages('cpp', required : false)
+if taglib_dep.found() and add_languages('cpp')
   extra_args = []
   cxx = meson.get_compiler('cpp')
   if cxx.has_argument('-fvisibility=hidden')
index cb406f9..2be888c 100644 (file)
@@ -1,4 +1,4 @@
-twolame_dep = dependency('twolame', version : '>= 0.3.10', required : false)
+twolame_dep = dependency('twolame', version : '>= 0.3.10', required : get_option('twolame'))
 
 if twolame_dep.found()
   twolame = library('gsttwolame',
index 7a8ac85..6ed4407 100644 (file)
@@ -16,7 +16,7 @@ vpx_features = [
   [ 'vpx/vp8dx.h', 'vpx_codec_vp9_dx_algo', '-DHAVE_VP9_DECODER', 'VP9 decoder' ],
 ]
 
-vpx_dep = dependency('vpx', version : '>=1.3.0', required : false)
+vpx_dep = dependency('vpx', version : '>=1.3.0', required : get_option('vpx'))
 
 if vpx_dep.found()
   vpx_args = []
@@ -29,8 +29,7 @@ if vpx_dep.found()
                      const vpx_codec_iface_t *c = &@1@;
                      return c != 0;
                    }'''.format(header,codec_iface)
-    # FIXME: should take dependencies : vpx_dep argument
-    if cc.links(link_code, args : ['-lvpx'])
+    if cc.links(link_code, dependencies : vpx_dep)
       vpx_args += extra_define
       message('libvpx provides @0@ interface (@1@)'.format(f.get(3),f.get(1)))
       have_vpx_feature = true
index 51294d8..4a8c0b4 100644 (file)
@@ -6,7 +6,7 @@ wavpack_sources = [
   'gstwavpackstreamreader.c',
 ]
 
-wavpack_dep = dependency('wavpack', version : '>= 4.60.0', required : false)
+wavpack_dep = dependency('wavpack', version : '>= 4.60.0', required : get_option('wavpack'))
 
 if wavpack_dep.found()
   gstwavpack = library('gstwavpack',
index 41fafe4..4bdab67 100644 (file)
@@ -11,6 +11,9 @@ matroska_sources = [
   'lzo.c',
 ]
 
+bz2_dep = cc.find_library('bz2', required : get_option('bz2'))
+cdata.set('HAVE_BZ2', bz2_dep.found())
+
 gstmatroska = library('gstmatroska',
   matroska_sources,
   c_args : gst_plugins_good_args,
@@ -18,7 +21,7 @@ gstmatroska = library('gstmatroska',
   include_directories : [configinc],
   dependencies : [gstpbutils_dep, gstaudio_dep, gstriff_dep,
                   gstvideo_dep, gsttag_dep, gstbase_dep,
-                  gst_dep, zlib_dep, bz2lib, libm],
+                  gst_dep, zlib_dep, bz2_dep, libm],
   install : true,
   install_dir : plugins_install_dir,
 )
index 61df5f5..cbc28ca 100644 (file)
@@ -1,43 +1,13 @@
-subdir('alpha')
-subdir('apetag')
-subdir('audiofx')
-subdir('audioparsers')
-subdir('auparse')
-subdir('autodetect')
-subdir('avi')
-subdir('cutter')
-subdir('debugutils')
-subdir('deinterlace')
-subdir('dtmf')
-subdir('effectv')
-subdir('equalizer')
-subdir('flv')
-subdir('flx')
-subdir('goom')
-subdir('goom2k1')
-subdir('icydemux')
-subdir('id3demux')
-subdir('imagefreeze')
-subdir('interleave')
-subdir('isomp4')
-subdir('law')
-subdir('level')
-subdir('matroska')
-subdir('monoscope')
-subdir('multifile')
-subdir('multipart')
-subdir('replaygain')
-subdir('rtp')
-subdir('rtpmanager')
-subdir('rtsp')
-subdir('shapewipe')
-subdir('smpte')
-subdir('spectrum')
-subdir('udp')
-subdir('videobox')
-subdir('videocrop')
-subdir('videofilter')
-subdir('videomixer')
-subdir('wavenc')
-subdir('wavparse')
-subdir('y4m')
+foreach plugin : ['alpha', 'apetag', 'audiofx', 'audioparsers', 'auparse',
+                  'autodetect', 'avi', 'cutter', 'debugutils', 'deinterlace',
+                  'dtmf', 'effectv', 'equalizer', 'flv', 'flx', 'goom',
+                  'goom2k1', 'icydemux', 'id3demux', 'imagefreeze',
+                  'interleave', 'isomp4', 'law', 'level', 'matroska',
+                  'monoscope', 'multifile', 'multipart', 'replaygain', 'rtp',
+                  'rtpmanager', 'rtsp', 'shapewipe', 'smpte', 'spectrum',
+                  'udp', 'videobox', 'videocrop', 'videofilter', 'videomixer',
+                  'wavenc', 'wavparse', 'y4m']
+  if not get_option(plugin).disabled()
+    subdir(plugin)
+  endif
+endforeach
index 8e4f6f1..d3fea42 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-plugins-good', 'c',
   version : '1.15.0.1',
-  meson_version : '>= 0.46.0',
+  meson_version : '>= 0.47',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
@@ -15,9 +15,11 @@ else
   gst_version_nano = 0
 endif
 
+# FIXME: automagic
 have_cxx = add_languages('cpp', required : false)
 
 glib_req = '>= 2.40.0'
+orc_req = '>= 0.4.17'
 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
 
 api_version = '1.0'
@@ -25,6 +27,7 @@ api_version = '1.0'
 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
 
 cc = meson.get_compiler('c')
+host_system = host_machine.system()
 
 if cc.get_id() == 'msvc'
   # Ignore several spurious warnings for things gstreamer does very commonly
@@ -149,9 +152,6 @@ cdata.set_quoted('GST_LICENSE', 'LGPL')
 cdata.set_quoted('PACKAGE', 'gst-plugins-good')
 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-good-1.0')
 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',
@@ -211,7 +211,7 @@ gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
   fallback : ['gstreamer', 'gst_base_dep'])
 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
   fallback : ['gstreamer', 'gst_net_dep'])
-if host_machine.system() != 'windows'
+if host_system != 'windows'
   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
     fallback : ['gstreamer', 'gst_check_dep'])
 endif
@@ -242,6 +242,7 @@ gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
     fallback : ['gst-plugins-base', 'video_dep'])
 
 # GStreamer OpenGL
+# FIXME: automagic
 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
     fallback : ['gst-plugins-base', 'gstgl_dep'], required: false)
 
@@ -276,41 +277,12 @@ if build_gstgl
   endforeach
 endif
 
-zlib_dep = dependency('zlib', required : false)
-bz2lib = cc.find_library('bz2', required : false)
+zlib_dep = dependency('zlib', fallback: ['zlib', 'zlib_dep'])
 glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']),
              dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])]
 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
 
 cdata.set('HAVE_ZLIB', zlib_dep.found())
-cdata.set('HAVE_BZ2', bz2lib.found())
-
-# Check all of the things.
-# TODO: None of these are actually used yet because
-# the build files haven't been written
-deps = [
-  ['gtk_dep','gtk+-3.0', '', ''],
-  ['gtkx_dep','gtk+-x11-3.0', '', ''],
-  ['caca_dep','caca', '', ''],
-  ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
-  ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
-]
-
-foreach d : deps
-  varname = d[0]
-  depname = d[1]
-  version = d[2]
-  confhname = d[3]
-  if version == ''
-    curdep = dependency(depname, required : false)
-  else
-    curdep = dependency(depname, required : false, version : version)
-  endif
-  set_variable(varname, curdep)
-  if curdep.found() and confhname != ''
-    cdata.set(confhname, 1)
-  endif
-endforeach
 
 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
 configinc = include_directories('.')
@@ -318,20 +290,15 @@ libsinc = include_directories('gst-libs')
 
 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', version : '>= 0.4.17', 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', version : orc_req, 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, will use backup C code')
   cdata.set('DISABLE_ORC', 1)
 endif
 
@@ -375,7 +342,8 @@ subdir('tests')
 subdir('pkgconfig')
 
 # 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
 
index a7266e8..8c10e55 100644 (file)
@@ -1,13 +1,89 @@
-# Enable V4L2 plugin to probe devices at plugin load
-option('v4l2-probe', type : 'boolean', value : true,
-       description : 'Probe v4l2 devices when the v4l2 plugin is loaded')
-option('libv4l2', type : 'boolean', value : true,
-       description : 'Use libv4l2 for some obscure format conversions')
+# Feature options for plugins without external deps
+option('alpha', type : 'feature', value : 'auto')
+option('apetag', type : 'feature', value : 'auto')
+option('audiofx', type : 'feature', value : 'auto')
+option('audioparsers', type : 'feature', value : 'auto')
+option('auparse', type : 'feature', value : 'auto')
+option('autodetect', type : 'feature', value : 'auto')
+option('avi', type : 'feature', value : 'auto')
+option('cutter', type : 'feature', value : 'auto')
+option('debugutils', type : 'feature', value : 'auto')
+option('deinterlace', type : 'feature', value : 'auto')
+option('dtmf', type : 'feature', value : 'auto')
+option('effectv', type : 'feature', value : 'auto')
+option('equalizer', type : 'feature', value : 'auto')
+option('flv', type : 'feature', value : 'auto')
+option('flx', type : 'feature', value : 'auto')
+option('goom', type : 'feature', value : 'auto')
+option('goom2k1', type : 'feature', value : 'auto')
+option('icydemux', type : 'feature', value : 'auto')
+option('id3demux', type : 'feature', value : 'auto')
+option('imagefreeze', type : 'feature', value : 'auto')
+option('interleave', type : 'feature', value : 'auto')
+option('isomp4', type : 'feature', value : 'auto')
+option('law', type : 'feature', value : 'auto')
+option('level', type : 'feature', value : 'auto')
+option('matroska', type : 'feature', value : 'auto')
+option('monoscope', type : 'feature', value : 'auto')
+option('multifile', type : 'feature', value : 'auto')
+option('multipart', type : 'feature', value : 'auto')
+option('replaygain', type : 'feature', value : 'auto')
+option('rtp', type : 'feature', value : 'auto')
+option('rtpmanager', type : 'feature', value : 'auto')
+option('rtsp', type : 'feature', value : 'auto')
+option('shapewipe', type : 'feature', value : 'auto')
+option('smpte', type : 'feature', value : 'auto')
+option('spectrum', type : 'feature', value : 'auto')
+option('udp', type : 'feature', value : 'auto')
+option('videobox', type : 'feature', value : 'auto')
+option('videocrop', type : 'feature', value : 'auto')
+option('videofilter', type : 'feature', value : 'auto')
+option('videomixer', type : 'feature', value : 'auto')
+option('wavenc', type : 'feature', value : 'auto')
+option('wavparse', type : 'feature', value : 'auto')
+option('y4m', type : 'feature', value : 'auto')
+
+# Feature options for plugins with external deps
+option('aalib', type : 'feature', value : 'auto', description : 'aalib text console video sink plugin')
+option('bz2', type : 'feature', value : 'auto', description : 'libbz2 support in the matroska plugin')
+option('caca', type : 'feature', value : 'auto', description : 'libcaca text console video sink plugin')
+option('cairo', type : 'feature', value : 'auto', description : 'Cairo overlay plugin')
+option('directsound', type : 'feature', value : 'auto', description : 'Directsound audio source/sink plugin')
+option('dv', type : 'feature', value : 'auto', description : 'Digital video decoder and demuxer plugin')
+option('dv1394', type : 'feature', value : 'auto', description : 'Digital IEEE1394 interface video source plugin')
+option('flac', type : 'feature', value : 'auto', description : 'FLAC audio codec plugin')
+option('gdk-pixbuf', type : 'feature', value : 'auto', description : 'gdk-pixbuf image decoder, overlay, and sink plugin')
+option('gtk3', type : 'feature', value : 'auto', description : 'GTK+ video sink plugin')
+option('jack', type : 'feature', value : 'auto', description : 'JACK audio source/sink plugin')
+option('jpeg', type : 'feature', value : 'auto', description : 'JPEG image codec plugin')
+option('lame', type : 'feature', value : 'auto', description : 'LAME mp3 audio encoder plugin')
+option('mpg123', type : 'feature', value : 'auto', description : 'mpg123 mp3 audio decoder plugin')
+option('oss', type : 'feature', value : 'auto', description : 'OSS audio source/sink plugin')
+option('oss4', type : 'feature', value : 'auto', description : 'OSSv4 audio source/sink plugin')
+option('png', type : 'feature', value : 'auto', description : 'PNG image codec plugin')
+option('pulse', type : 'feature', value : 'auto', description : 'Pulseaudio audio source/sink plugin')
+option('qt5', type : 'feature', value : 'auto', description : 'Qt5 QML video sink plugin')
+option('shout2', type : 'feature', value : 'auto', description : 'Shout-casting network sink plugin based on libshout2')
+option('soup', type : 'feature', value : 'auto', description : 'libsoup HTTP client source/sink plugin')
+option('speex', type : 'feature', value : 'auto', description : 'Speex audio codec plugin')
+option('taglib', type : 'feature', value : 'auto', description : 'Tag-writing plugin based on taglib')
+option('twolame', type : 'feature', value : 'auto', description : 'twolame mp2 audio encoder plugin')
+option('vpx', type : 'feature', value : 'auto', description : 'VP8 and VP9 video codec plugin')
+option('wavpack', type : 'feature', value : 'auto', description : 'Wavpack audio codec plugin')
+option('x11', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin')
+
+# v4l2 plugin options
+option('v4l2', type : 'feature', value : 'auto', description : 'Build video4linux2 source/sink plugin')
+option('v4l2-probe', type : 'boolean', value : true, description : 'Probe v4l2 devices when the v4l2 plugin is loaded')
+option('v4l2-libv4l2', type : 'feature', value : 'auto', description : 'Use libv4l2 for some obscure format conversions')
+option('v4l2-gudev', type : 'feature', value : 'auto', description : 'Use libgudev for probing v4l2 devices')
+
+# Common feature options
+option('examples', type : 'feature', value : 'auto', yield : true)
+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')
 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 bffaba1..7deaed5 100644 (file)
@@ -11,7 +11,17 @@ directsoundsink_device_flags = [
   '-DGstDirectSoundDeviceClass=GstDirectSoundSinkDeviceClass',
 ]
 
-if host_machine.system() == 'windows' and cc.has_header('dsound.h')
+have_dsound = false
+# TODO: https://github.com/mesonbuild/meson/issues/3940
+dsound_option = get_option('directsound')
+if not dsound_option.disabled()
+  have_dsound = cc.has_header('dsound.h')
+  if not have_dsound and dsound_option.enabled()
+    error('directsound plugin was enabled but dsound.h was not found')
+  endif
+endif
+
+if have_dsound
   directsoundsink_dep = [cc.find_library('dsound'), cc.find_library('winmm'), cc.find_library('ole32')]
 
   gstdirectsoundsink = library('gstdirectsound',
index 031ee78..c226db5 100644 (file)
@@ -1,4 +1,6 @@
-subdir('directsound')
+if host_system == 'windows'
+  subdir('directsound')
+endif
 subdir('oss')
 subdir('oss4')
 subdir('v4l2')
index 1176e78..1cd9782 100644 (file)
@@ -8,14 +8,21 @@ oss_header_locations = [
 ]
 
 have_oss = false
-foreach hdr : oss_header_locations
-  if not have_oss
-    if cc.has_header(hdr[0])
-      cdata.set(hdr[1], 1, description: hdr[2])
-      have_oss = true
+oss_option = get_option('oss')
+if not oss_option.disabled()
+  foreach hdr : oss_header_locations
+    if not have_oss
+      if cc.has_header(hdr[0])
+        cdata.set(hdr[1], 1, description: hdr[2])
+        have_oss = true
+      endif
     endif
+  endforeach
+
+  if not have_oss and oss_option.enabled()
+    error('OSS plugin was enabled but soundcard.h was not found')
   endif
-endforeach
+endif
 
 if have_oss
   library('gstossaudio',
index 491266e..c33bfbd 100644 (file)
@@ -1,12 +1,19 @@
 have_oss4 = true
-message('Checking headers needed for Open Sound System 4 plugin...')
-foreach hdr : ['fcntl.h', 'sys/ioctl.h', 'sys/stat.h', 'sys/types.h']
-  if have_oss4
-    if not cc.has_header(hdr)
-      have_oss4 = false
+oss4_option = get_option('oss4')
+if not oss4_option.disabled()
+  message('Checking headers needed for Open Sound System 4 plugin...')
+  foreach hdr : ['fcntl.h', 'sys/ioctl.h', 'sys/stat.h', 'sys/types.h']
+    if have_oss4
+      if not cc.has_header(hdr)
+        have_oss4 = false
+      endif
     endif
+  endforeach
+
+  if not have_oss4 and oss4_option.enabled()
+    error('OSS4 plugin was enabled but headers were not found')
   endif
-endforeach
+endif
 
 if have_oss4
   message('Required headers found, building Open Sound System 4 plugin.')
index 721d53d..8b9364a 100644 (file)
@@ -25,29 +25,35 @@ v4l2_sources = [
   'tunernorm.c'
 ]
 
+v4l2 = get_option('v4l2')
+if v4l2.disabled()
+  build_v4l2 = false
+  message('V4L2 plugin is disabled')
+else
+  have_v4l2 = cc.has_header('linux/videodev2.h') or cc.has_header('sys/videodev2.h') or cc.has_header('sys/videoio.h')
+  if v4l2.enabled() and not have_v4l2
+    error('V4L2 is requested but headers were not found')
+  endif
+endif
+
 cdata.set('GST_V4L2_ENABLE_PROBE', get_option('v4l2-probe'))
 
-if cc.has_header('linux/videodev2.h') or cc.has_header('sys/videodev2.h') or cc.has_header('sys/videoio.h')
+if have_v4l2
   message('building v4l2 plugin')
   cdata.set('HAVE_GST_V4L2', true)
-  gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
+  gudev_dep = dependency('gudev-1.0', version : '>=147', required : get_option('v4l2-gudev'))
   cdata.set('HAVE_GUDEV', gudev_dep.found())
 
   # libv4l2 is only needed for converting some obscure formats
   # FIXME: Add a full list of the formats here
-  if get_option('libv4l2')
-    libv4l2_dep = dependency('libv4l2', required : false)
-    cdata.set('HAVE_LIBV4L2', libv4l2_dep.found())
-    libv4l2_deps = [libv4l2_dep]
-  else
-    libv4l2_deps = []
-  endif
+  libv4l2_dep = dependency('libv4l2', required : get_option('v4l2-libv4l2'))
+  cdata.set('HAVE_LIBV4L2', libv4l2_dep.found())
 
   gstv4l2 = library('gstvideo4linux2',
     v4l2_sources,
     c_args : gst_plugins_good_args,
     include_directories : [configinc, libsinc],
-    dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, gudev_dep] + libv4l2_deps,
+    dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, gudev_dep, libv4l2_dep],
     install : true,
     install_dir : plugins_install_dir,
   )
index 9165465..16d46a2 100644 (file)
@@ -1,4 +1,4 @@
-x11_dep = dependency('x11', required : false)
+x11_dep = dependency('x11', required : get_option('x11'))
 
 if x11_dep.found()
   x_args = []
index d59109c..2f44437 100644 (file)
@@ -4,10 +4,11 @@ sources = [
 
 if have_cxx and build_gstgl and gstgl_dep.found()
   qt5_mod = import('qt5')
-  qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'], required: false)
+  qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
+                           required: get_option('examples'))
 
   # FIXME Add a way to get that information out of the qt5 module
-  moc = find_program('moc-qt5', 'moc', required : false)
+  moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
   if qt5qml_deps.found() and moc.found()
     qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsink.qrc')
     executable('qmlsink', sources, qt_preprocessed,
index 5df98ce..122e4a6 100644 (file)
@@ -4,10 +4,10 @@ sources = [
 
 if have_cxx and build_gstgl and gstgl_dep.found()
   qt5_mod = import('qt5')
-  qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'], required: false)
-
+  qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
+                           required: get_option('examples'))
   # FIXME Add a way to get that information out of the qt5 module
-  moc = find_program('moc-qt5', 'moc', required : false)
+  moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
   if qt5qml_deps.found() and moc.found()
     qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsrc.qrc')
     executable('qmlsrc', sources, qt_preprocessed,
index ec2aa95..3d75c33 100644 (file)
@@ -7,7 +7,6 @@ tests = [
   ['videocrop2-test'],
 ]
 
-gtk_dep = dependency('gtk+-3.0', version : '>= 3.0.0', required : false)
 if gtk_dep.found()
   tests += [
     ['gdkpixbufsink-test', gtk_dep],
@@ -19,7 +18,7 @@ if get_variable('have_oss4', false)
   tests += [['test-oss4']]
 endif
 
-if get_variable('x11_dep', dependency('', required: false)).found()
+if x11_dep.found()
   tests += [['ximagesrc-test']]
 endif
 
index f7f0e5b..6649601 100644 (file)
@@ -4,4 +4,6 @@ subdir('check')
 endif
 
 subdir('icles')
-subdir('examples')
+if not get_option('examples').disabled()
+  subdir('examples')
+endif