From eadedc68f8ed7b8684ad7024712562c5d5491b07 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 25 Jul 2018 07:35:05 +0530 Subject: [PATCH] meson: Add feature options for all plugins GL dependency detection is still automagic. https://bugzilla.gnome.org/show_bug.cgi?id=795107 --- docs/libs/meson.build | 2 +- ext/alsa/meson.build | 2 +- ext/cdparanoia/meson.build | 7 +-- ext/libvisual/meson.build | 3 +- ext/meson.build | 5 ++- ext/ogg/meson.build | 2 +- ext/opus/meson.build | 2 +- ext/pango/meson.build | 2 +- ext/theora/meson.build | 4 +- ext/vorbis/meson.build | 6 +-- gst-libs/gst/meson.build | 1 + gst-libs/gst/rtsp/meson.build | 8 +++- gst-libs/gst/tag/meson.build | 1 + gst/meson.build | 28 ++++-------- meson.build | 68 +++++++++++++++--------------- meson_options.txt | 50 ++++++++++++++++++---- sys/meson.build | 2 +- sys/xvimage/meson.build | 2 +- tests/examples/gl/sdl/meson.build | 2 +- tests/examples/overlay/meson.build | 7 +-- tests/meson.build | 2 +- 21 files changed, 119 insertions(+), 87 deletions(-) diff --git a/docs/libs/meson.build b/docs/libs/meson.build index 55ce7f2b1d..8356fe6c16 100644 --- a/docs/libs/meson.build +++ b/docs/libs/meson.build @@ -2,7 +2,7 @@ # but then what about the other files (sections, sgml) types = configure_file(input : 'gst-plugins-base-libs.types', output : 'gst-plugins-base-libs.types', - configuration : configuration_data()) + copy : true) ignored_headers = ['pbutils-private.h', 'gsttageditingprivate.h', 'id3v2.h', 'kiss_fft_f32.h', 'kiss_fft_f64.h', 'kiss_fftr_f32.h', 'kiss_fftr_f64.h', diff --git a/ext/alsa/meson.build b/ext/alsa/meson.build index 7e57429f7f..7ad4ed7412 100644 --- a/ext/alsa/meson.build +++ b/ext/alsa/meson.build @@ -7,7 +7,7 @@ alsa_sources = [ 'gstalsasrc.c', ] -alsa_dep = dependency('alsa', version : '>=0.9.1', required : false) +alsa_dep = dependency('alsa', version : '>=0.9.1', required : get_option('alsa')) if alsa_dep.found() gstalsa = library('gstalsa', diff --git a/ext/cdparanoia/meson.build b/ext/cdparanoia/meson.build index 1752923aee..364b57cec9 100644 --- a/ext/cdparanoia/meson.build +++ b/ext/cdparanoia/meson.build @@ -2,13 +2,14 @@ cdparanoia_deps = [] cdparanoia_found = false # cdparanoia upstream has a pkg-config file only in post-10.2 SVN so far, no release yet -cdparanoia_dep = dependency('cdparanoia-3', version : '>=10.2', required : false) +cdparanoia_dep = dependency('cdparanoia-3', version : '>=10.2', + required : get_option('cdparanoia')) if cdparanoia_dep.found() cdparanoia_deps = [cdparanoia_dep] cdparanoia_found = true else - cdparanoia_dep = cc.find_library('cdda_paranoia', required : false) - cdinterface_dep = cc.find_library('cdda_interface', required : false) + cdparanoia_dep = cc.find_library('cdda_paranoia', required : get_option('cdparanoia')) + cdinterface_dep = cc.find_library('cdda_interface', required : get_option('cdparanoia')) if cdparanoia_dep.found() and cdinterface_dep.found() cdparanoia_deps = [cdparanoia_dep, cdinterface_dep] cdparanoia_found = true diff --git a/ext/libvisual/meson.build b/ext/libvisual/meson.build index 55c0e75e2b..48498c28ea 100644 --- a/ext/libvisual/meson.build +++ b/ext/libvisual/meson.build @@ -3,7 +3,8 @@ libvisual_sources = [ 'plugin.c', ] -libvisual_dep = dependency('libvisual-0.4', version : '>= 0.4.0', required : false) +libvisual_dep = dependency('libvisual-0.4', version : '>= 0.4.0', + required : get_option('libvisual')) if libvisual_dep.found() core_conf.set_quoted('LIBVISUAL_PLUGINSBASEDIR', libvisual_dep.get_pkgconfig_variable('pluginsbasedir')) diff --git a/ext/meson.build b/ext/meson.build index 31c016e153..2366fdf5e8 100644 --- a/ext/meson.build +++ b/ext/meson.build @@ -1,9 +1,10 @@ subdir('alsa') subdir('cdparanoia') +# FIXME: gl deps are automagic subdir('gl') if cc.get_id() != 'msvc' - # libvisual has MinGW-specific headers which are not compatible with MSVC - # If we want to build this with MSVC, we must build libvisual with it too + # FIXME: libvisual has MinGW-specific headers which are not compatible with + # MSVC. Need to either fix the headers or build libvisual with MSVC too. subdir('libvisual') endif subdir('ogg') diff --git a/ext/ogg/meson.build b/ext/ogg/meson.build index ecbbee73cc..1ab0430c29 100644 --- a/ext/ogg/meson.build +++ b/ext/ogg/meson.build @@ -10,7 +10,7 @@ ogg_sources = [ 'vorbis_parse.c', ] -ogg_dep = dependency('ogg', version : '>=1.0', required : false) +ogg_dep = dependency('ogg', version : '>=1.0', required : get_option('ogg')) core_conf.set('HAVE_OGG', ogg_dep.found()) if ogg_dep.found() diff --git a/ext/opus/meson.build b/ext/opus/meson.build index 3dbc26bc3f..86abba0f7a 100644 --- a/ext/opus/meson.build +++ b/ext/opus/meson.build @@ -6,7 +6,7 @@ opus_sources = [ 'gstopusheader.c', ] -opus_dep = dependency('opus', version : '>= 0.9.4', required : false) +opus_dep = dependency('opus', version : '>= 0.9.4', required : get_option('opus')) if opus_dep.found() gstopus = library('gstopus', diff --git a/ext/pango/meson.build b/ext/pango/meson.build index d157264970..01baa31288 100644 --- a/ext/pango/meson.build +++ b/ext/pango/meson.build @@ -6,7 +6,7 @@ pango_sources = [ 'gsttimeoverlay.c', ] -pango_dep = dependency('pangocairo', version : '>=1.22.0', required : false) +pango_dep = dependency('pangocairo', version : '>=1.22.0', required : get_option('pango')) if pango_dep.found() gstpango = library('gstpango', diff --git a/ext/theora/meson.build b/ext/theora/meson.build index 5616cff37f..cd5e30a19a 100644 --- a/ext/theora/meson.build +++ b/ext/theora/meson.build @@ -3,8 +3,8 @@ theora_sources = [ 'gsttheoraparse.c', ] -theoradec_dep = dependency('theoradec', version : '>=1.1', required : false) -theoraenc_dep = dependency('theoraenc', version : '>=1.1', required : false) +theoradec_dep = dependency('theoradec', version : '>=1.1', required : get_option('theora')) +theoraenc_dep = dependency('theoraenc', version : '>=1.1', required : get_option('theora')) core_conf.set('HAVE_THEORA', theoradec_dep.found() and theoraenc_dep.found()) theora_deps = [] diff --git a/ext/vorbis/meson.build b/ext/vorbis/meson.build index b883227e86..8f112431e0 100644 --- a/ext/vorbis/meson.build +++ b/ext/vorbis/meson.build @@ -15,9 +15,9 @@ vorbisidec_sources = [ 'gstvorbiscommon.c', ] -vorbis_dep = dependency('vorbis', version : '>=1.0', required : false) -vorbisenc_dep = dependency('vorbisenc', version : '>=1.0', required : false) -vorbisidec_dep = dependency('vorbisidec', required : false) +vorbis_dep = dependency('vorbis', version : '>=1.0', required : get_option('vorbis')) +vorbisenc_dep = dependency('vorbisenc', version : '>=1.0', required : get_option('vorbis')) +vorbisidec_dep = dependency('vorbisidec', required : get_option('vorbis')) if vorbis_dep.found() or vorbisidec_dep.found() if cc.has_header_symbol('vorbis/codec.h', 'vorbis_synthesis_restart') diff --git a/gst-libs/gst/meson.build b/gst-libs/gst/meson.build index c38fe76891..cd3b5b0436 100644 --- a/gst-libs/gst/meson.build +++ b/gst-libs/gst/meson.build @@ -9,4 +9,5 @@ subdir('pbutils') subdir('riff') subdir('app') subdir('allocators') +# FIXME: gl deps are automagic subdir('gl') diff --git a/gst-libs/gst/rtsp/meson.build b/gst-libs/gst/rtsp/meson.build index d19975abf4..f45fde7090 100644 --- a/gst-libs/gst/rtsp/meson.build +++ b/gst-libs/gst/rtsp/meson.build @@ -31,9 +31,13 @@ rtsp_enums = gnome.mkenums_simple('gstrtsp-enumtypes', gstrtsp_c = rtsp_enums[0] gstrtsp_h = rtsp_enums[1] -winsock2 = cc.find_library('ws2_32', required : false) - +if host_system == 'windows' + winsock2 = cc.find_library('ws2_32') +else + winsock2 = [] +endif gstrtsp_deps = [gst_base_dep, gst_dep, gio_dep, libm, winsock2] + gst_rtsp = library('gstrtsp-@0@'.format(api_version), rtsp_sources, gstrtsp_h, gstrtsp_c, diff --git a/gst-libs/gst/tag/meson.build b/gst-libs/gst/tag/meson.build index 5691a6bf72..cac2dd8a84 100644 --- a/gst-libs/gst/tag/meson.build +++ b/gst-libs/gst/tag/meson.build @@ -49,6 +49,7 @@ gst_tag_args = [ 'license-translations.dict')) ] +# FIXME: optional zlib support? tag_deps = [gst_base_dep, libm] gsttag = library('gsttag-@0@'.format(api_version), tag_sources, gsttag_h, gsttag_c, diff --git a/gst/meson.build b/gst/meson.build index ef75ee2f5f..4a98db1723 100644 --- a/gst/meson.build +++ b/gst/meson.build @@ -1,20 +1,8 @@ -subdir('adder') -subdir('app') -subdir('audioconvert') -subdir('audiomixer') -subdir('audiorate') -subdir('audioresample') -subdir('audiotestsrc') -subdir('encoding') -subdir('gio') -subdir('pbtypes') -subdir('playback') -subdir('rawparse') -subdir('subparse') -subdir('tcp') -subdir('typefind') -subdir('videoconvert') -subdir('videorate') -subdir('videoscale') -subdir('videotestsrc') -subdir('volume') +foreach plugin : ['adder', 'app', 'audioconvert', 'audiomixer', 'audiorate', 'audioresample', + 'audiotestsrc', 'encoding', 'gio', 'pbtypes', 'playback', 'rawparse', + 'subparse', 'tcp', 'typefind', 'videoconvert', 'videorate', 'videoscale', + 'videotestsrc', 'volume'] + if not get_option(plugin).disabled() + subdir(plugin) + endif +endforeach diff --git a/meson.build b/meson.build index a0e77c8667..4393440fa0 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('gst-plugins-base', 'c', version : '1.15.0.1', - meson_version : '>= 0.46.0', + meson_version : '>= 0.47', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) @@ -31,6 +31,7 @@ libversion = '@0@.@1@.0'.format(soversion, gst_version_minor * 100 + gst_version 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 @@ -112,9 +113,6 @@ core_conf.set('SIZEOF_LONG', cc.sizeof('long')) core_conf.set('SIZEOF_SHORT', cc.sizeof('short')) core_conf.set('SIZEOF_VOIDP', cc.sizeof('void*')) -if get_option('nls') - core_conf.set('ENABLE_NLS', 1) -endif core_conf.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-base-1.0') core_conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) core_conf.set_quoted('PACKAGE', 'gst-plugins-base') @@ -208,24 +206,32 @@ if get_option('default_library') == 'static' endif # X11 checks are for sys/ and tests/ -x11_dep = dependency('x11', required : false) +x11_dep = dependency('x11', required : get_option('x11')) # GLib checks are for the entire project -giounix_dep = dependency('gio-unix-2.0', version : glib_req, required : false) # Almost everything that uses glib also uses gobject glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']), dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])] +# GIO is used by the GIO plugin, and by the TCP, SDP, and RTSP plugins gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep']) +giounix_dep = dependency('gio-unix-2.0', version : glib_req, required : host_system != 'windows', + fallback: ['glib', 'libgiounix_dep']) -# some of the examples want GTK+ -gtk_dep = dependency('gtk+-3.0', version : '>= 3.10', required : false) -gtk_x11_dep = dependency('gtk+-x11-3.0', version : '>= 3.10', required : false) -gtk_quartz_dep = dependency('gtk+-quartz-3.0', version : '>= 3.10', required : false) -gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', required : false) +# some of the examples can use gdk-pixbuf and GTK+3 +gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', required : get_option('examples')) +gtk_dep = dependency('gtk+-3.0', version : '>= 3.10', required : get_option('examples')) +# TODO: https://github.com/mesonbuild/meson/issues/3941 +if not get_option('x11').disabled() + gtk_x11_dep = dependency('gtk+-x11-3.0', version : '>= 3.10', required : get_option('examples')) +endif +# gtk+ quartz backend is only available on macOS +if host_system == 'darwin' + gtk_quartz_dep = dependency('gtk+-quartz-3.0', version : '>= 3.10', required : get_option('examples')) +else + gtk_quartz_dep = dependency('', required : false) +endif core_conf.set('HAVE_X', x11_dep.found()) -core_conf.set('HAVE_GIO_UNIX_2_0', - (gio_dep.type_name() != 'pkgconfig' and host_machine.system() != 'windows') - or giounix_dep.found()) +core_conf.set('HAVE_GIO_UNIX_2_0', giounix_dep.found()) if gio_dep.type_name() == 'pkgconfig' core_conf.set_quoted('GIO_MODULE_DIR', @@ -253,7 +259,7 @@ gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req, fallback : ['gstreamer', 'gst_base_dep']) gst_net_dep = dependency('gstreamer-net-1.0', version : gst_req, fallback : ['gstreamer', 'gst_net_dep']) -if host_machine.system() != 'windows' +if host_system != 'windows' gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req, fallback : ['gstreamer', 'gst_check_dep']) endif @@ -262,20 +268,15 @@ gst_controller_dep = dependency('gstreamer-controller-1.0', version : gst_req, 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 : orc_req, 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'] - core_conf.set('HAVE_ORC', 1) - else - message('Orc Compiler not found, will use backup C code') - core_conf.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'] + core_conf.set('HAVE_ORC', 1) else + message('Orc Compiler not found or disabled, will use backup C code') core_conf.set('DISABLE_ORC', 1) endif @@ -312,9 +313,9 @@ else endif endif -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_DISABLE", "yes", TRUE);' + \ 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \ @@ -338,16 +339,15 @@ 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() + core_conf.set('ENABLE_NLS', 1) subdir('po') endif if build_machine.system() == 'windows' message('Disabling gtk-doc while building on Windows') -elif not get_option('gtk_doc') - message('gtk-doc is disabled via options') else - if find_program('gtkdoc-scan', required : false).found() + if find_program('gtkdoc-scan', required : get_option('gtk_doc')).found() subdir('docs') else message('Not building documentation as gtk-doc was not found') diff --git a/meson_options.txt b/meson_options.txt index 33d38f8e1d..906acb3851 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -17,15 +17,49 @@ option('gles2_module_name', type : 'string', value : '', option('install_plugins_helper', type: 'string', value: '', description: 'Path of distro helper script to call to install missing plugins') +# Feature options for plugins with no external deps +option('adder', type : 'feature', value : 'auto') +option('app', type : 'feature', value : 'auto') +option('audioconvert', type : 'feature', value : 'auto') +option('audiomixer', type : 'feature', value : 'auto') +option('audiorate', type : 'feature', value : 'auto') +option('audioresample', type : 'feature', value : 'auto') +option('audiotestsrc', type : 'feature', value : 'auto') +option('encoding', type : 'feature', value : 'auto') +option('gio', type : 'feature', value : 'auto') +option('pbtypes', type : 'feature', value : 'auto') +option('playback', type : 'feature', value : 'auto') +option('rawparse', type : 'feature', value : 'auto') +option('subparse', type : 'feature', value : 'auto') +option('tcp', type : 'feature', value : 'auto') +option('typefind', type : 'feature', value : 'auto') +option('videoconvert', type : 'feature', value : 'auto') +option('videorate', type : 'feature', value : 'auto') +option('videoscale', type : 'feature', value : 'auto') +option('videotestsrc', type : 'feature', value : 'auto') +option('volume', type : 'feature', value : 'auto') + +# Feature options for plugins with external deps +option('alsa', type : 'feature', value : 'auto', description : 'ALSA audio source/sink plugin') +option('cdparanoia', type : 'feature', value : 'auto', description : 'cdparanoia plugin') +option('libvisual', type : 'feature', value : 'auto', description : 'libvisual audio visualization plugin') +option('ogg', type : 'feature', value : 'auto', description : 'ogg parser, muxer, demuxer plugin') +option('opus', type : 'feature', value : 'auto', description : 'OPUS audio codec plugin') +option('pango', type : 'feature', value : 'auto', description : 'Pango text rendering and overlay plugin') +option('theora', type : 'feature', value : 'auto', description : 'Theora video parser and codec plugin') +option('vorbis', type : 'feature', value : 'auto', description : 'Vorbis audio parser, tagger, and codec plugin') +option('x11', type : 'feature', value : 'auto', description : 'X11 ximagesink plugin, and X11 support in libraries, plugins, examples') +option('xshm', type : 'feature', value : 'auto', description : 'X11 shared memory support for X11 plugins') +option('xvideo', type : 'feature', value : 'auto', description : 'X11 XVideo xvimagesink plugin') + +# Common feature options +option('examples', type : 'feature', value : 'auto', yield : true) +option('gtk_doc', type : 'feature', value : 'auto', yield : true, description : 'Build API documentation with gtk-doc') +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('orc', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', yield : true) -option('examples', type : 'boolean', value : true, yield : true) -option('gtk_doc', type : 'boolean', value : true, yield : true, - description : 'Build API documentation with gtk-doc') -option('introspection', type : 'boolean', value : true, yield : true, - description : 'Generate gobject-introspection bindings') -option('nls', type : 'boolean', value : true, yield: true, - description : 'Enable native language support (translations)') 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/meson.build b/sys/meson.build index da6dc24005..7637c1c8ed 100644 --- a/sys/meson.build +++ b/sys/meson.build @@ -1,7 +1,7 @@ if x11_dep.found() # XShm is only used by ximage and xvimage # FIXME: Need to check for XShmAttach inside libXext - xshm_dep = dependency('xext', required : false) + xshm_dep = dependency('xext', required : get_option('xshm')) core_conf.set('HAVE_XSHM', xshm_dep.found()) subdir('ximage') diff --git a/sys/xvimage/meson.build b/sys/xvimage/meson.build index 216c0ecf86..2f48645750 100644 --- a/sys/xvimage/meson.build +++ b/sys/xvimage/meson.build @@ -6,7 +6,7 @@ xvimage_sources = [ 'xvimagesink.c', ] -xvideo_dep = dependency('xv', required : false) +xvideo_dep = dependency('xv', required : get_option('xvideo')) core_conf.set('HAVE_XVIDEO', x11_dep.found() and xvideo_dep.found()) if xvideo_dep.found() diff --git a/tests/examples/gl/sdl/meson.build b/tests/examples/gl/sdl/meson.build index 4262210da9..dd35c013dc 100644 --- a/tests/examples/gl/sdl/meson.build +++ b/tests/examples/gl/sdl/meson.build @@ -1,4 +1,4 @@ -sdl_dep = dependency('sdl', version : '>=1.2.0', required : false) +sdl_dep = dependency('sdl', version : '>=1.2.0', required : get_option('examples')) if sdl_dep.found() and build_gstgl executable('sdlshare', 'sdlshare.c', diff --git a/tests/examples/overlay/meson.build b/tests/examples/overlay/meson.build index 2be262ebd3..885e9d07be 100644 --- a/tests/examples/overlay/meson.build +++ b/tests/examples/overlay/meson.build @@ -1,4 +1,4 @@ -if x11_dep.found() # FIXME: originally if USE_X +if x11_dep.found() if gtk_x11_dep.found() executable('gtk-videooverlay', 'gtk-videooverlay.c', c_args : gst_plugins_base_args, @@ -9,10 +9,11 @@ if x11_dep.found() # FIXME: originally if USE_X if have_cxx # check for C++ support qt5_mod = import('qt5') - qt5widgets_dep = dependency('qt5', modules : ['Gui', 'Widgets'], required: false) + qt5widgets_dep = dependency('qt5', modules : ['Gui', 'Widgets'], + required: get_option('examples')) # FIXME Add a way to get that information out of the qt5 module - moc = find_program('moc-qt5', required : false) + moc = find_program('moc-qt5', required : get_option('examples')) if qt5widgets_dep.found() and moc.found() executable('qt-videooverlay', 'qt-videooverlay.cpp', cpp_args : gst_plugins_base_args, diff --git a/tests/meson.build b/tests/meson.build index 3dd389be3d..382f8f8efc 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -2,7 +2,7 @@ if host_machine.system() != 'windows' subdir('check') endif -if get_option('examples') +if not get_option('examples').disabled() subdir('examples') endif #subdir('files')