From 8f807477ebb324703172aaee1660ad21a5683fb7 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 25 Jul 2018 07:35:28 +0530 Subject: [PATCH] meson: Add feature options for all plugins 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 --- ext/aalib/meson.build | 17 ++++- ext/cairo/meson.build | 2 +- ext/dv/meson.build | 3 +- ext/flac/meson.build | 2 +- ext/gdk_pixbuf/meson.build | 2 +- ext/gtk/meson.build | 4 +- ext/jack/meson.build | 2 +- ext/jpeg/meson.build | 2 +- ext/lame/meson.build | 14 +++- ext/libcaca/meson.build | 2 +- ext/libpng/meson.build | 2 +- ext/mpg123/meson.build | 2 +- ext/pulse/meson.build | 2 +- ext/qt/meson.build | 11 +++- ext/raw1394/meson.build | 6 +- ext/shout2/meson.build | 2 +- ext/soup/meson.build | 2 +- ext/speex/meson.build | 2 +- ext/taglib/meson.build | 4 +- ext/twolame/meson.build | 2 +- ext/vpx/meson.build | 5 +- ext/wavpack/meson.build | 2 +- gst/matroska/meson.build | 5 +- gst/meson.build | 56 ++++------------ meson.build | 66 +++++-------------- meson_options.txt | 92 ++++++++++++++++++++++++--- sys/directsound/meson.build | 12 +++- sys/meson.build | 4 +- sys/oss/meson.build | 19 ++++-- sys/oss4/meson.build | 19 ++++-- sys/v4l2/meson.build | 26 +++++--- sys/ximage/meson.build | 2 +- tests/examples/qt/qmlsink/meson.build | 5 +- tests/examples/qt/qmlsrc/meson.build | 6 +- tests/icles/meson.build | 3 +- tests/meson.build | 4 +- 36 files changed, 246 insertions(+), 165 deletions(-) diff --git a/ext/aalib/meson.build b/ext/aalib/meson.build index 12cdf72f4d..a9d0d19388 100644 --- a/ext/aalib/meson.build +++ b/ext/aalib/meson.build @@ -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, diff --git a/ext/cairo/meson.build b/ext/cairo/meson.build index 0de51eec3c..26d73fbf31 100644 --- a/ext/cairo/meson.build +++ b/ext/cairo/meson.build @@ -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', diff --git a/ext/dv/meson.build b/ext/dv/meson.build index e012a08e76..1df2ae5ebf 100644 --- a/ext/dv/meson.build +++ b/ext/dv/meson.build @@ -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], diff --git a/ext/flac/meson.build b/ext/flac/meson.build index a533b09733..5bede52e69 100644 --- a/ext/flac/meson.build +++ b/ext/flac/meson.build @@ -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', diff --git a/ext/gdk_pixbuf/meson.build b/ext/gdk_pixbuf/meson.build index 1906083db7..76c2992ead 100644 --- a/ext/gdk_pixbuf/meson.build +++ b/ext/gdk_pixbuf/meson.build @@ -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', diff --git a/ext/gtk/meson.build b/ext/gtk/meson.build index 22e4f5d6a6..62b65b0d01 100644 --- a/ext/gtk/meson.build +++ b/ext/gtk/meson.build @@ -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 diff --git a/ext/jack/meson.build b/ext/jack/meson.build index 173f2d4c31..1f591f2fe7 100644 --- a/ext/jack/meson.build +++ b/ext/jack/meson.build @@ -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', diff --git a/ext/jpeg/meson.build b/ext/jpeg/meson.build index 5108d420bc..2222491dfb 100644 --- a/ext/jpeg/meson.build +++ b/ext/jpeg/meson.build @@ -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', diff --git a/ext/lame/meson.build b/ext/lame/meson.build index 23faa2c22e..6581f42a92 100644 --- a/ext/lame/meson.build +++ b/ext/lame/meson.build @@ -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'] diff --git a/ext/libcaca/meson.build b/ext/libcaca/meson.build index 5ff8714ca5..dbcb8ea76d 100644 --- a/ext/libcaca/meson.build +++ b/ext/libcaca/meson.build @@ -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', diff --git a/ext/libpng/meson.build b/ext/libpng/meson.build index f6511f43d5..e520886113 100644 --- a/ext/libpng/meson.build +++ b/ext/libpng/meson.build @@ -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', diff --git a/ext/mpg123/meson.build b/ext/mpg123/meson.build index 3e659d527b..668ef1d9ca 100644 --- a/ext/mpg123/meson.build +++ b/ext/mpg123/meson.build @@ -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', diff --git a/ext/pulse/meson.build b/ext/pulse/meson.build index 28b4d616ae..be8fea4367 100644 --- a/ext/pulse/meson.build +++ b/ext/pulse/meson.build @@ -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', diff --git a/ext/qt/meson.build b/ext/qt/meson.build index 976768ebfc..6fee167afd 100644 --- a/ext/qt/meson.build +++ b/ext/qt/meson.build @@ -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'] diff --git a/ext/raw1394/meson.build b/ext/raw1394/meson.build index 27a6a5ab22..6f030e3412 100644 --- a/ext/raw1394/meson.build +++ b/ext/raw1394/meson.build @@ -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() diff --git a/ext/shout2/meson.build b/ext/shout2/meson.build index cd67b4c302..c5b8da53db 100644 --- a/ext/shout2/meson.build +++ b/ext/shout2/meson.build @@ -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', diff --git a/ext/soup/meson.build b/ext/soup/meson.build index d231330572..93d46bc58b 100644 --- a/ext/soup/meson.build +++ b/ext/soup/meson.build @@ -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', diff --git a/ext/speex/meson.build b/ext/speex/meson.build index 931d7bb447..d7dacd4e10 100644 --- a/ext/speex/meson.build +++ b/ext/speex/meson.build @@ -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', diff --git a/ext/taglib/meson.build b/ext/taglib/meson.build index 5a93ff3b80..1e5767da64 100644 --- a/ext/taglib/meson.build +++ b/ext/taglib/meson.build @@ -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') diff --git a/ext/twolame/meson.build b/ext/twolame/meson.build index cb406f908f..2be888c5bc 100644 --- a/ext/twolame/meson.build +++ b/ext/twolame/meson.build @@ -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', diff --git a/ext/vpx/meson.build b/ext/vpx/meson.build index 7a8ac85460..6ed4407283 100644 --- a/ext/vpx/meson.build +++ b/ext/vpx/meson.build @@ -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 diff --git a/ext/wavpack/meson.build b/ext/wavpack/meson.build index 51294d8625..4a8c0b4c7d 100644 --- a/ext/wavpack/meson.build +++ b/ext/wavpack/meson.build @@ -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', diff --git a/gst/matroska/meson.build b/gst/matroska/meson.build index 41fafe4e08..4bdab6720b 100644 --- a/gst/matroska/meson.build +++ b/gst/matroska/meson.build @@ -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, ) diff --git a/gst/meson.build b/gst/meson.build index 61df5f5e6e..cbc28caf2d 100644 --- a/gst/meson.build +++ b/gst/meson.build @@ -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 diff --git a/meson.build b/meson.build index 8e4f6f183e..d3fea429cf 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index a7266e8862..8c10e55ce6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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, diff --git a/sys/directsound/meson.build b/sys/directsound/meson.build index bffaba115c..7deaed5698 100644 --- a/sys/directsound/meson.build +++ b/sys/directsound/meson.build @@ -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', diff --git a/sys/meson.build b/sys/meson.build index 031ee783d0..c226db5643 100644 --- a/sys/meson.build +++ b/sys/meson.build @@ -1,4 +1,6 @@ -subdir('directsound') +if host_system == 'windows' + subdir('directsound') +endif subdir('oss') subdir('oss4') subdir('v4l2') diff --git a/sys/oss/meson.build b/sys/oss/meson.build index 1176e78b45..1cd97822f2 100644 --- a/sys/oss/meson.build +++ b/sys/oss/meson.build @@ -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', diff --git a/sys/oss4/meson.build b/sys/oss4/meson.build index 491266e896..c33bfbd169 100644 --- a/sys/oss4/meson.build +++ b/sys/oss4/meson.build @@ -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.') diff --git a/sys/v4l2/meson.build b/sys/v4l2/meson.build index 721d53d15f..8b9364adf7 100644 --- a/sys/v4l2/meson.build +++ b/sys/v4l2/meson.build @@ -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, ) diff --git a/sys/ximage/meson.build b/sys/ximage/meson.build index 91654654ef..16d46a2728 100644 --- a/sys/ximage/meson.build +++ b/sys/ximage/meson.build @@ -1,4 +1,4 @@ -x11_dep = dependency('x11', required : false) +x11_dep = dependency('x11', required : get_option('x11')) if x11_dep.found() x_args = [] diff --git a/tests/examples/qt/qmlsink/meson.build b/tests/examples/qt/qmlsink/meson.build index d59109cba8..2f444372d3 100644 --- a/tests/examples/qt/qmlsink/meson.build +++ b/tests/examples/qt/qmlsink/meson.build @@ -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, diff --git a/tests/examples/qt/qmlsrc/meson.build b/tests/examples/qt/qmlsrc/meson.build index 5df98cefad..122e4a6176 100644 --- a/tests/examples/qt/qmlsrc/meson.build +++ b/tests/examples/qt/qmlsrc/meson.build @@ -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, diff --git a/tests/icles/meson.build b/tests/icles/meson.build index ec2aa958cf..3d75c33e92 100644 --- a/tests/icles/meson.build +++ b/tests/icles/meson.build @@ -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 diff --git a/tests/meson.build b/tests/meson.build index f7f0e5b672..6649601b2d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -4,4 +4,6 @@ subdir('check') endif subdir('icles') -subdir('examples') +if not get_option('examples').disabled() + subdir('examples') +endif