From b55dfb5313f1df702a3637efbd372b90cd12a300 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 27 Jul 2018 18:59:23 +0530 Subject: [PATCH] Add feature options for almost all plugins The only plugins remaining are those that haven't been ported to Meson yet, and msdk. Also, the tests are still automagic. https://bugzilla.gnome.org/show_bug.cgi?id=795107 --- ext/aom/meson.build | 2 +- ext/assrender/meson.build | 3 +- ext/bs2b/meson.build | 2 +- ext/bz2/meson.build | 2 +- ext/chromaprint/meson.build | 2 +- ext/closedcaption/meson.build | 3 +- ext/dash/meson.build | 2 +- ext/directfb/meson.build | 2 +- ext/dtls/meson.build | 3 +- ext/dts/meson.build | 16 +++++++-- ext/faac/meson.build | 8 +++-- ext/faad/meson.build | 4 +-- ext/fdkaac/meson.build | 2 +- ext/flite/meson.build | 12 +++++-- ext/fluidsynth/meson.build | 2 +- ext/gl/meson.build | 2 +- ext/gsm/meson.build | 16 +++++++-- ext/hls/meson.build | 44 ++++++++++++++++++------ ext/iqa/meson.build | 2 +- ext/kate/meson.build | 4 +-- ext/ladspa/meson.build | 16 +++++++-- ext/libde265/meson.build | 2 +- ext/libmms/meson.build | 2 +- ext/lv2/meson.build | 4 +-- ext/meson.build | 2 +- ext/mpeg2enc/meson.build | 40 +++++++++++----------- ext/mplex/meson.build | 34 +++++++++---------- ext/openh264/meson.build | 6 ++-- ext/openjpeg/meson.build | 7 ++++ ext/opus/meson.build | 2 +- ext/resindvd/meson.build | 4 +-- ext/rsvg/meson.build | 2 +- ext/rtmp/meson.build | 2 +- ext/sbc/meson.build | 2 +- ext/smoothstreaming/meson.build | 2 +- ext/soundtouch/meson.build | 6 ++++ ext/spandsp/meson.build | 2 +- ext/srt/meson.build | 8 ++++- ext/srtp/meson.build | 6 ++++ ext/ttml/meson.build | 12 +++---- ext/voaacenc/meson.build | 2 +- ext/vulkan/meson.build | 13 ++++++-- ext/webp/meson.build | 2 +- ext/webrtc/meson.build | 2 +- ext/webrtcdsp/meson.build | 3 +- ext/x265/meson.build | 2 +- ext/zbar/meson.build | 2 +- gst-libs/gst/opencv/meson.build | 5 +-- gst-libs/gst/wayland/meson.build | 10 +++--- gst/mpegtsdemux/meson.build | 2 +- meson.build | 35 +++++-------------- meson_options.txt | 72 ++++++++++++++++++++++++++++++++++++++++ sys/bluez/meson.build | 21 +++++------- sys/d3dvideosink/meson.build | 15 +++++++-- sys/decklink/meson.build | 10 ++++-- sys/directsound/meson.build | 16 +++++++-- sys/dvb/meson.build | 26 +++++++++------ sys/fbdev/meson.build | 11 +++++- sys/ipcpipeline/meson.build | 20 +++++++++-- sys/kms/meson.build | 3 +- sys/msdk/meson.build | 1 + sys/shm/meson.build | 32 ++++++++++++------ sys/uvch264/meson.build | 7 ++-- sys/wasapi/meson.build | 20 ++++++++--- sys/winks/meson.build | 9 +++-- sys/winscreencap/meson.build | 15 +++++++-- tests/check/meson.build | 1 + 67 files changed, 444 insertions(+), 207 deletions(-) diff --git a/ext/aom/meson.build b/ext/aom/meson.build index a16afcf..355411c 100644 --- a/ext/aom/meson.build +++ b/ext/aom/meson.build @@ -1,4 +1,4 @@ -aom_dep = dependency('aom', required: false) +aom_dep = dependency('aom', required: get_option('aom')) if aom_dep.found() gstaom = library('gstaom', ['gstaom.c', 'gstav1enc.c', 'gstav1dec.c'], diff --git a/ext/assrender/meson.build b/ext/assrender/meson.build index fa5f189..9c8d82c 100644 --- a/ext/assrender/meson.build +++ b/ext/assrender/meson.build @@ -1,5 +1,4 @@ -ass_dep = dependency('libass', version : '>= 0.10.2', required : false) - +ass_dep = dependency('libass', version : '>= 0.10.2', required : get_option('assrender')) if ass_dep.found() gstassrender = library('gstassrender', 'gstassrender.c', diff --git a/ext/bs2b/meson.build b/ext/bs2b/meson.build index 9b5cd4c..1d0d25e 100644 --- a/ext/bs2b/meson.build +++ b/ext/bs2b/meson.build @@ -1,6 +1,6 @@ bs2b_sources = [ 'gstbs2b.c', ] -bs2b_dep = dependency('libbs2b', version : '>=3.1.0', required : false) +bs2b_dep = dependency('libbs2b', version : '>=3.1.0', required : get_option('bs2b')) if bs2b_dep.found() gstbs2b = library('gstbs2b', diff --git a/ext/bz2/meson.build b/ext/bz2/meson.build index 48a2dd9..cbab41b 100644 --- a/ext/bz2/meson.build +++ b/ext/bz2/meson.build @@ -4,7 +4,7 @@ bz2_sources = [ 'gstbz2enc.c', ] -bz2_dep = cc.find_library('bz2', required : false) +bz2_dep = cc.find_library('bz2', required : get_option('bz2')) if bz2_dep.found() and cc.has_header_symbol('bzlib.h', 'BZ2_bzlibVersion') gstbz2 = library('gstbz2', diff --git a/ext/chromaprint/meson.build b/ext/chromaprint/meson.build index 1c6af77..05df501 100644 --- a/ext/chromaprint/meson.build +++ b/ext/chromaprint/meson.build @@ -1,4 +1,4 @@ -chromaprint_dep = dependency('libchromaprint', required : false) +chromaprint_dep = dependency('libchromaprint', required : get_option('chromaprint')) if chromaprint_dep.found() gstchromaprint = library('gstchromaprint', diff --git a/ext/closedcaption/meson.build b/ext/closedcaption/meson.build index 4e1ed3a..cf15638 100644 --- a/ext/closedcaption/meson.build +++ b/ext/closedcaption/meson.build @@ -1,4 +1,5 @@ -pangocairo_dep = dependency('pangocairo', version : '>= 1.22.0', required : false) +pangocairo_dep = dependency('pangocairo', version : '>= 1.22.0', + required : get_option('closedcaption')) zvbi_sources = [ 'bit_slicer.c', diff --git a/ext/dash/meson.build b/ext/dash/meson.build index 3d7a015..3a167d8 100644 --- a/ext/dash/meson.build +++ b/ext/dash/meson.build @@ -4,7 +4,7 @@ dash_sources = [ 'gstplugin.c', ] -xml2_dep = dependency('libxml-2.0', version : '>= 2.8', required : false) +xml2_dep = dependency('libxml-2.0', version : '>= 2.8', required : get_option('dash')) if xml2_dep.found() gstsouphttpsrc = library('gstdashdemux', dash_sources, diff --git a/ext/directfb/meson.build b/ext/directfb/meson.build index 686807d..b4b777a 100644 --- a/ext/directfb/meson.build +++ b/ext/directfb/meson.build @@ -1,4 +1,4 @@ -directfb_dep = dependency('directfb', version : '>= 0.9.24', required : false) +directfb_dep = dependency('directfb', version : '>= 0.9.24', required : get_option('directfb')) if directfb_dep.found() gstdirectfb = library('gstdirectfb', diff --git a/ext/dtls/meson.build b/ext/dtls/meson.build index 846d1fa..da8d886 100644 --- a/ext/dtls/meson.build +++ b/ext/dtls/meson.build @@ -11,7 +11,8 @@ dtls_sources = [ 'plugin.c', ] -libcrypto_dep = dependency('libcrypto', required : false) +openssl_dep = dependency('openssl', version : '>= 1.0.1', required : get_option('dtls')) +libcrypto_dep = dependency('libcrypto', required : get_option('dtls')) if openssl_dep.found() and libcrypto_dep.found() gstdtls = library('gstdtls', diff --git a/ext/dts/meson.build b/ext/dts/meson.build index 567f035..1e4b3e2 100644 --- a/ext/dts/meson.build +++ b/ext/dts/meson.build @@ -1,7 +1,17 @@ -dca_dep = dependency('libdca', required : false) +# Don't do any dependency checks if disabled +if get_option('dts').disabled() + subdir_done() +endif -if not dca_dep.found() and cc.has_header_symbol('dca.h', 'dca_init') - dca_dep = cc.find_library('dca', required : false) +# Detect libdca using a pkg-config file, or manually +dca_dep = dependency('libdca', required : false) +if not dca_dep.found() + if cc.has_header_symbol('dca.h', 'dca_init') + dca_dep = cc.find_library('dca', required : false) + endif + if not dca_dep.found() and get_option('dts').enabled() + error('DTS plugin enabled, but libdca not found') + endif endif # autotools didn't use the libdca pkg-config cflags, and they diff --git a/ext/faac/meson.build b/ext/faac/meson.build index e23edaf..f5f1e8c 100644 --- a/ext/faac/meson.build +++ b/ext/faac/meson.build @@ -1,6 +1,10 @@ -faac_dep = cc.find_library('faac', required : false) +faac_dep = cc.find_library('faac', required : get_option('faac')) +have_faac_h = cc.has_header_symbol('faac.h', 'faacEncOpen') +if not have_faac_h and get_option('faac').enabled() + error('faac plugin enabled: found libfaac, but not faac.h') +endif -if faac_dep.found() and cc.has_header_symbol('faac.h', 'faacEncOpen') +if faac_dep.found() and have_faac_h gstfaac = library('gstfaac', 'gstfaac.c', c_args : gst_plugins_bad_args, diff --git a/ext/faad/meson.build b/ext/faad/meson.build index 9bd8e2d..533c11c 100644 --- a/ext/faad/meson.build +++ b/ext/faad/meson.build @@ -2,11 +2,11 @@ faad_args = [ ] have_faad = cc.has_header_symbol('neaacdec.h', 'NeAACDecOpen') have_faad_2_7 = have_faad and cc.has_header_symbol('neaacdec.h', 'LATM') -if have_faad and not have_faad_2_7 +if have_faad and not have_faad_2_7 and get_option('faad').enabled() message('Found faad2, but too old (< v2.7.0)') endif -faad_dep = cc.find_library('faad', required : false) +faad_dep = cc.find_library('faad', required : get_option('faad')) if faad_dep.found() and have_faad_2_7 gstfaad = library('gstfaad', diff --git a/ext/fdkaac/meson.build b/ext/fdkaac/meson.build index 399704c..27c16a5 100644 --- a/ext/fdkaac/meson.build +++ b/ext/fdkaac/meson.build @@ -1,4 +1,4 @@ -fdkaac_dep = dependency('fdk-aac', required : false) +fdkaac_dep = dependency('fdk-aac', required : get_option('fdkaac')) if fdkaac_dep.found() fdkaac_defines = [] diff --git a/ext/flite/meson.build b/ext/flite/meson.build index 4470ab6..10dd2e0 100644 --- a/ext/flite/meson.build +++ b/ext/flite/meson.build @@ -10,15 +10,23 @@ flite_libs = [ 'flite_cmulex' ] +if get_option('flite').disabled() + subdir_done() +endif + flite_deps = [ ] foreach flite_lib : flite_libs - flite_lib_dep = cc.find_library(flite_lib, required : false) + flite_lib_dep = cc.find_library(flite_lib, required : get_option('flite')) if flite_lib_dep.found() flite_deps += [flite_lib_dep] endif endforeach +have_flite_h = cc.has_header_symbol('flite/flite.h', 'flite_init') +if not have_flite_h and get_option('flite').enabled() + error('flite plugin enabled, but flite.h not found') +endif -if flite_deps.length() == flite_libs.length() and cc.has_header_symbol('flite/flite.h', 'flite_init') +if flite_deps.length() == flite_libs.length() and have_flite_h gstflite = library('gstflite', flite_sources, c_args : gst_plugins_bad_args, diff --git a/ext/fluidsynth/meson.build b/ext/fluidsynth/meson.build index 740d1f6..09f3975 100644 --- a/ext/fluidsynth/meson.build +++ b/ext/fluidsynth/meson.build @@ -1,4 +1,4 @@ -fluidsynth_dep = dependency('fluidsynth', version : '>= 1.0', required : false) +fluidsynth_dep = dependency('fluidsynth', version : '>= 1.0', required : get_option('fluidsynth')) if fluidsynth_dep.found() gstfluidsynth = library('gstfluidsynthmidi', diff --git a/ext/gl/meson.build b/ext/gl/meson.build index 3a4d5cd..3fb9239 100644 --- a/ext/gl/meson.build +++ b/ext/gl/meson.build @@ -8,7 +8,7 @@ opengl_sources = [ 'gstglutils.c', ] -if build_gstgl and gstgl_dep.found() +if gstgl_dep.found() optional_deps = [] opengl_defines = ['-DGST_USE_UNSTABLE_API'] # for videoaggregator diff --git a/ext/gsm/meson.build b/ext/gsm/meson.build index ef36d19..a5ad2d4 100644 --- a/ext/gsm/meson.build +++ b/ext/gsm/meson.build @@ -1,7 +1,17 @@ -gsm_dep = cc.find_library('gsm', required : false) +if get_option('gsm').disabled() + subdir_done() +endif + +gsm_dep = cc.find_library('gsm', required : get_option('gsm')) +have_gsm_create = cc.has_header_symbol('gsm.h', 'gsm_create') +if not have_gsm_create + have_gsm_create = cc.has_header_symbol('gsm/smg.h', 'gsm_create') + if not have_gsm_create and get_option('gsm').enabled() + error('GSM plugin is enabled: found libgsm but no headers') + endif +endif -if gsm_dep.found() and (cc.has_header_symbol('gsm.h', 'gsm_create') or - cc.has_header_symbol('gsm/smg.h', 'gsm_create')) +if gsm_dep.found() and have_gsm_create gstgsm = library('gstgsm', ['gstgsm.c', 'gstgsmenc.c', 'gstgsmdec.c'], c_args : gst_plugins_bad_args, diff --git a/ext/hls/meson.build b/ext/hls/meson.build index e631958..1f5f58d 100644 --- a/ext/hls/meson.build +++ b/ext/hls/meson.build @@ -10,23 +10,45 @@ hls_sources = [ hls_cargs = ['-DGST_USE_UNSTABLE_API'] -# FIXME: Add an option for selecting the library, and fail if it's not found -hls_crypto_dep = dependency('nettle', required : false) -if hls_crypto_dep.found() - hls_cargs += ['-DHAVE_NETTLE'] -else - hls_crypto_dep = cc.find_library('gcrypt', required : false) - if hls_crypto_dep.found() - hls_cargs += ['-DHAVE_LIBGCRYPT'] - else - hls_crypto_dep = openssl_dep +hls_crypto = get_option('hls-crypto') +hls_option = get_option('hls') + +have_hls_crypto = false +if not hls_option.disabled() + if ['auto', 'nettle'].contains(hls_crypto) + hls_crypto_dep = dependency('nettle', required : false) + if hls_crypto_dep.found() + have_hls_crypto = true + hls_cargs += ['-DHAVE_NETTLE'] + endif + endif + + if not hls_crypto_dep.found() and ['auto', 'libgcrypt'].contains(hls_crypto) + hls_crypto_dep = cc.find_library('gcrypt', required : false) + if hls_crypto_dep.found() + have_hls_crypto = true + hls_cargs += ['-DHAVE_LIBGCRYPT'] + endif + endif + + if not hls_crypto_dep.found() and ['auto', 'openssl'].contains(hls_crypto) + hls_crypto_dep = dependency('openssl', required : false) if hls_crypto_dep.found() + have_hls_crypto = true hls_cargs += ['-DHAVE_OPENSSL'] endif endif + + if not have_hls_crypto and hls_option.enabled() + if hls_crypto == 'auto' + error('HLS plugin enabled, but found none of nettle, libgcrypt, or openssl') + else + error('HLS plugin enabled, but crypto library "@0@" not found'.format(hls_crypto)) + endif + endif endif -if hls_crypto_dep.found() +if have_hls_crypto gsthls = library('gsthls', hls_sources, c_args : gst_plugins_bad_args + hls_cargs, diff --git a/ext/iqa/meson.build b/ext/iqa/meson.build index adf351d..c5d1c1c 100644 --- a/ext/iqa/meson.build +++ b/ext/iqa/meson.build @@ -1,4 +1,4 @@ -dssim_dep = dependency('dssim', required : false, +dssim_dep = dependency('dssim', required : get_option('iqa'), fallback: ['dssim', 'dssim_dep']) if dssim_dep.found() diff --git a/ext/kate/meson.build b/ext/kate/meson.build index 241fa4c..8c02b93 100644 --- a/ext/kate/meson.build +++ b/ext/kate/meson.build @@ -8,9 +8,9 @@ kate_sources = [ 'gstkatespu.c', ] -kate_dep = dependency('kate', version : '>=0.1.7', required : false) +kate_dep = dependency('kate', version : '>=0.1.7', required : get_option('kate')) # Not used -#tiger_dep = dependency('tiger', version : '>=0.3.2', required : false) +#tiger_dep = dependency('tiger', version : '>=0.3.2', required : get_option('kate')) if kate_dep.found() gstkate = library('gstkate', diff --git a/ext/ladspa/meson.build b/ext/ladspa/meson.build index 317f6d7..381ce2f 100644 --- a/ext/ladspa/meson.build +++ b/ext/ladspa/meson.build @@ -8,18 +8,28 @@ ladspa_sources = [ ladspa_cargs = [] -lrdf_dep = dependency('lrdf', required : false) +if get_option('ladspa').disabled() + subdir_done() +endif + +# This is an optional dep, but we make it optional only in auto mode +lrdf_dep = dependency('lrdf', required : get_option('ladspa')) if lrdf_dep.found() ladspa_cargs = ['-DHAVE_LRDF'] endif -if cc.has_header('ladspa.h') +have_ladspa_h = cc.has_header('ladspa.h') +if not have_ladspa_h and get_option('ladspa').enabled() + error('ladspa plugin is enabled but ladspa.h not found') +endif + +if have_ladspa_h gstladspa = library('gstladspa', ladspa_sources, c_args : gst_plugins_bad_args + ladspa_cargs, link_args : noseh_link_args, include_directories : [configinc, libsinc], - dependencies : [gstaudio_dep, gstbase_dep, gmodule_dep, lrdf_dep, mathlib], + dependencies : [gstaudio_dep, gstbase_dep, gmodule_dep, lrdf_dep, libm], install : true, install_dir : plugins_install_dir, ) diff --git a/ext/libde265/meson.build b/ext/libde265/meson.build index b638f63..8ae8b90 100644 --- a/ext/libde265/meson.build +++ b/ext/libde265/meson.build @@ -3,7 +3,7 @@ de265_sources = [ 'libde265-dec.c', ] -de265_dep = dependency('libde265', version : '>= 0.9', required : false) +de265_dep = dependency('libde265', version : '>= 0.9', required : get_option('libde265')) if de265_dep.found() gstde265 = library('gstde265', diff --git a/ext/libmms/meson.build b/ext/libmms/meson.build index 9604520..6bb1b3e 100644 --- a/ext/libmms/meson.build +++ b/ext/libmms/meson.build @@ -1,4 +1,4 @@ -mms_dep = dependency('libmms', version : '>= 0.4', required : false) +mms_dep = dependency('libmms', version : '>= 0.4', required : get_option('libmms')) if mms_dep.found() gstmms = library('gstmms', diff --git a/ext/lv2/meson.build b/ext/lv2/meson.build index 730fc09..741f3b8 100644 --- a/ext/lv2/meson.build +++ b/ext/lv2/meson.build @@ -5,14 +5,14 @@ lv2_sources = [ 'gstlv2utils.c', ] -lv2_dep = dependency('lilv-0', version : '>= 0.22', required : false) +lv2_dep = dependency('lilv-0', version : '>= 0.22', required : get_option('lv2')) if lv2_dep.found() gstrsvg = library('gstlv2', lv2_sources, c_args : gst_plugins_bad_args, link_args : noseh_link_args, include_directories : [configinc], - dependencies : [gstaudio_dep, gstbase_dep, lv2_dep, mathlib], + dependencies : [gstaudio_dep, gstbase_dep, lv2_dep, libm], install : true, install_dir : plugins_install_dir, ) diff --git a/ext/meson.build b/ext/meson.build index fbd73ff..7b51a82 100644 --- a/ext/meson.build +++ b/ext/meson.build @@ -64,8 +64,8 @@ subdir('voaacenc') #subdir('voamrwbenc') subdir('vulkan') subdir('wayland') -subdir('webrtcdsp') subdir('webrtc') +subdir('webrtcdsp') subdir('webp') subdir('x265') subdir('zbar') diff --git a/ext/mpeg2enc/meson.build b/ext/mpeg2enc/meson.build index 7f49b91..69011a4 100644 --- a/ext/mpeg2enc/meson.build +++ b/ext/mpeg2enc/meson.build @@ -1,20 +1,22 @@ -if mjpegtools_dep.found() - mpeg2enc_dep = cxx.find_library('mpeg2encpp', required : false) - - if mpeg2enc_dep.found() - gstmpeg2enc = library('gstmpeg2enc', - 'gstmpeg2enc.cc', - 'gstmpeg2encoptions.cc', - 'gstmpeg2encoder.cc', - 'gstmpeg2encstreamwriter.cc', - 'gstmpeg2encpicturereader.cc', - cpp_args : gst_plugins_bad_args + ['-DGST_MJPEGTOOLS_API=' + mjpegtools_api], - link_args : noseh_link_args, - include_directories : [configinc, libsinc], - dependencies : [gstvideo_dep, mjpegtools_dep, mpeg2enc_dep], - install : true, - install_dir : plugins_install_dir, - ) - pkgconfig.generate(gstmpeg2enc, install_dir : plugins_pkgconfig_install_dir) - endif +# mjpegtools upstream breaks API constantly and doesn't export the version in +# a header anywhere. The configure file has a lot of logic to support old +# versions, but it all seems untested and broken. Require 2.0.0. Can be changed +# if someone complains. +mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : get_option('mpeg2enc')) +mpeg2enc_dep = cxx.find_library('mpeg2encpp', required : get_option('mpeg2enc')) +if mjpegtools_dep.found() and mpeg2enc_dep.found() + gstmpeg2enc = library('gstmpeg2enc', + 'gstmpeg2enc.cc', + 'gstmpeg2encoptions.cc', + 'gstmpeg2encoder.cc', + 'gstmpeg2encstreamwriter.cc', + 'gstmpeg2encpicturereader.cc', + cpp_args : gst_plugins_bad_args + ['-DGST_MJPEGTOOLS_API=2000'], + link_args : noseh_link_args, + include_directories : [configinc, libsinc], + dependencies : [gstvideo_dep, mjpegtools_dep, mpeg2enc_dep], + install : true, + install_dir : plugins_install_dir, + ) + pkgconfig.generate(gstmpeg2enc, install_dir : plugins_pkgconfig_install_dir) endif diff --git a/ext/mplex/meson.build b/ext/mplex/meson.build index 01a5683..3bc697e 100644 --- a/ext/mplex/meson.build +++ b/ext/mplex/meson.build @@ -1,19 +1,19 @@ -if mjpegtools_dep.found() - mplex2_dep = cxx.find_library('mplex2', required : false) +# See: ext/mpeg2enc for note about mjpegtools dep +mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : get_option('mplex')) +mplex2_dep = cxx.find_library('mplex2', required : get_option('mplex')) - if mplex2_dep.found() - gstmplex2 = library('gstmplex', - 'gstmplex.cc', - 'gstmplexibitstream.cc', - 'gstmplexjob.cc', - 'gstmplexoutputstream.cc', - cpp_args : gst_plugins_bad_args + ['-DGST_MJPEGTOOLS_API=' + mjpegtools_api], - link_args : noseh_link_args, - include_directories : [configinc, libsinc], - dependencies : [gstaudio_dep, mjpegtools_dep, mplex2_dep], - install : true, - install_dir : plugins_install_dir, - ) - pkgconfig.generate(gstmplex2, install_dir : plugins_pkgconfig_install_dir) - endif +if mjpegtools_dep.found() and mplex2_dep.found() + gstmplex2 = library('gstmplex', + 'gstmplex.cc', + 'gstmplexibitstream.cc', + 'gstmplexjob.cc', + 'gstmplexoutputstream.cc', + cpp_args : gst_plugins_bad_args + ['-DGST_MJPEGTOOLS_API=2000'], + link_args : noseh_link_args, + include_directories : [configinc, libsinc], + dependencies : [gstaudio_dep, mjpegtools_dep, mplex2_dep], + install : true, + install_dir : plugins_install_dir, + ) + pkgconfig.generate(gstmplex2, install_dir : plugins_pkgconfig_install_dir) endif diff --git a/ext/openh264/meson.build b/ext/openh264/meson.build index 4a85d87..522857a 100644 --- a/ext/openh264/meson.build +++ b/ext/openh264/meson.build @@ -4,10 +4,10 @@ openh264_sources = [ 'gstopenh264plugin.c', ] -openh264_dep = dependency('openh264', version : '>= 1.3.0', required : false, - fallback: ['openh264', 'openh264_dep']) +openh264_dep = dependency('openh264', version : '>= 1.3.0', + required : get_option('openh264'), + fallback: ['openh264', 'openh264_dep']) -# FIXME: check if C++ compiler is available via new add_languages() semantics in meson git (~v30) if openh264_dep.found() gstopenh264 = library('gstopenh264', openh264_sources, diff --git a/ext/openjpeg/meson.build b/ext/openjpeg/meson.build index eef8c08..1c08bd1 100644 --- a/ext/openjpeg/meson.build +++ b/ext/openjpeg/meson.build @@ -6,12 +6,19 @@ openjpeg_sources = [ openjpeg_cargs = [] +if get_option('openjpeg').disabled() + subdir_done() +endif + openjpeg_dep = dependency('libopenjp2', version : '>=2.1', required : false) if not openjpeg_dep.found() # Fallback to v1.5 openjpeg_dep = dependency('libopenjpeg1', required : false) openjpeg_cargs += ['-DHAVE_OPENJPEG_1'] endif +if not openjpeg_dep.found() and get_option('openjpeg').enabled() + error('openjpeg plugin enabled, but neither libopenjp2 nor libopenjpeg1 not found') +endif if openjpeg_dep.found() gstopenjpeg = library('gstopenjpeg', diff --git a/ext/opus/meson.build b/ext/opus/meson.build index 9f7e0d3..7b14b4f 100644 --- a/ext/opus/meson.build +++ b/ext/opus/meson.build @@ -4,7 +4,7 @@ opus_sources = [ 'gstopusparse.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('gstopusparse', diff --git a/ext/resindvd/meson.build b/ext/resindvd/meson.build index 95d711f..4d18621 100644 --- a/ext/resindvd/meson.build +++ b/ext/resindvd/meson.build @@ -10,8 +10,8 @@ resindvd_sources = [ 'rsnparsetter.c', ] -dvdnav_dep = dependency('dvdnav', version : '>= 4.1.2', required : false) -dvdread_dep = dependency('dvdread', version : '>= 4.1.2', required : false) +dvdnav_dep = dependency('dvdnav', version : '>= 4.1.2', required : get_option('resindvd')) +dvdread_dep = dependency('dvdread', version : '>= 4.1.2', required : get_option('resindvd')) if dvdnav_dep.found() and dvdread_dep.found() gstresindvd = library('gstresindvd', diff --git a/ext/rsvg/meson.build b/ext/rsvg/meson.build index 109ec26..ebbf5ab 100644 --- a/ext/rsvg/meson.build +++ b/ext/rsvg/meson.build @@ -4,7 +4,7 @@ rsvg_sources = [ 'gstrsvgoverlay.c', ] -rsvg_dep = dependency('librsvg-2.0', version : '>= 2.36.2', required : false) +rsvg_dep = dependency('librsvg-2.0', version : '>= 2.36.2', required : get_option('rsvg')) if rsvg_dep.found() gstrsvg = library('gstrsvg', rsvg_sources, diff --git a/ext/rtmp/meson.build b/ext/rtmp/meson.build index 149df39..0efe416 100644 --- a/ext/rtmp/meson.build +++ b/ext/rtmp/meson.build @@ -4,7 +4,7 @@ rtmp_sources = [ 'gstrtmpsrc.c', ] -rtmp_dep = dependency('librtmp', required : false) +rtmp_dep = dependency('librtmp', required : get_option('rtmp')) if rtmp_dep.found() gstrtmp = library('gstrtmp', diff --git a/ext/sbc/meson.build b/ext/sbc/meson.build index 5fe7217..e0d3ed3 100644 --- a/ext/sbc/meson.build +++ b/ext/sbc/meson.build @@ -4,7 +4,7 @@ sbc_sources = [ 'gstsbcenc.c', ] -sbc_dep = dependency('sbc', version : '>= 1.0', required : false) +sbc_dep = dependency('sbc', version : '>= 1.0', required : get_option('sbc')) if sbc_dep.found() gstsbc = library('gstsbc', diff --git a/ext/smoothstreaming/meson.build b/ext/smoothstreaming/meson.build index e1358cf..17fd13d 100644 --- a/ext/smoothstreaming/meson.build +++ b/ext/smoothstreaming/meson.build @@ -5,7 +5,7 @@ smoothstreaming_sources = [ 'gstsmoothstreaming-plugin.c', ] -xml28_dep = dependency('libxml-2.0', version : '>= 2.8', required : false) +xml28_dep = dependency('libxml-2.0', version : '>= 2.8', required : get_option('smoothstreaming')) if xml28_dep.found() gstmss = library('gstsmoothstreaming', diff --git a/ext/soundtouch/meson.build b/ext/soundtouch/meson.build index 600182d..793ee4d 100644 --- a/ext/soundtouch/meson.build +++ b/ext/soundtouch/meson.build @@ -5,6 +5,9 @@ soundtouch_sources = [ ] soundtouch_cargs = ['-DHAVE_SOUNDTOUCH'] +if get_option('soundtouch').disabled() + subdir_done() +endif soundtouch_dep = dependency('soundtouch', required : false) if soundtouch_dep.found() @@ -19,6 +22,9 @@ else # Add them back once we know which distros use them. endif endif +if not soundtouch_dep.found() and get_option('soundtouch').enabled() + error('soundtouch plugin enabled but soundtouch library not found') +endif if soundtouch_dep.found() gstsoundtouch = library('gstsoundtouch', diff --git a/ext/spandsp/meson.build b/ext/spandsp/meson.build index 7998ff9..0f10172 100644 --- a/ext/spandsp/meson.build +++ b/ext/spandsp/meson.build @@ -8,7 +8,7 @@ spandsp_sources = [ 'gsttonegeneratesrc.h', ] -spandsp_dep = dependency('spandsp', version : '>= 0.0.6', required : false) +spandsp_dep = dependency('spandsp', version : '>= 0.0.6', required : get_option('spandsp')) if spandsp_dep.found() gstspandsp = library('gstspandsp', diff --git a/ext/srt/meson.build b/ext/srt/meson.build index d9ca1d5..0f328cc 100644 --- a/ext/srt/meson.build +++ b/ext/srt/meson.build @@ -7,12 +7,18 @@ srt_sources = [ 'gstsrtclientsink.c', 'gstsrtserversink.c', ] +srt_option = get_option('srt') +if srt_option.disabled() + subdir_done() +endif srt_dep = dependency('srt', required : false) - if not srt_dep.found() and cc.has_header_symbol('srt/srt.h', 'srt_startup') srt_dep = cc.find_library('srt', required : false) endif +if not srt_dep.found() and srt_option.enabled() + error('srt plugin enabled, but srt library not found') +endif if srt_dep.found() gstsrt = library('gstsrt', diff --git a/ext/srtp/meson.build b/ext/srtp/meson.build index a818b38..0a29686 100644 --- a/ext/srtp/meson.build +++ b/ext/srtp/meson.build @@ -5,6 +5,9 @@ srtp_sources = [ ] srtp_cargs = [] +if get_option('srtp').disabled() + subdir_done() +endif srtp_dep = dependency('libsrtp2', version : '>= 2.1.0', required : false) if srtp_dep.found() @@ -15,6 +18,9 @@ else srtp_dep = cc.find_library('srtp', required : false) endif endif +if not srtp_dep.found() and get_option('srtp').enabled() + error('srtp plugin enabled but libsrtp not found') +endif if srtp_dep.found() gstsrtp_enums = gnome.mkenums_simple('gstsrtp-enumtypes', diff --git a/ext/ttml/meson.build b/ext/ttml/meson.build index 0889895..a62fa28 100644 --- a/ext/ttml/meson.build +++ b/ext/ttml/meson.build @@ -1,9 +1,7 @@ -libxml_dep = dependency('libxml-2.0', version : '>= 2.9.2', required : false) -pango_dep = dependency('pango', required : false) -cairo_dep = dependency('cairo', required : false) -pangocairo_dep = dependency('pangocairo', required : false) -cc = meson.get_compiler('c') -m_dep = cc.find_library('m', required : false) +libxml_dep = dependency('libxml-2.0', version : '>= 2.9.2', required : get_option('ttml')) +pango_dep = dependency('pango', required : get_option('ttml')) +cairo_dep = dependency('cairo', required : get_option('ttml')) +pangocairo_dep = dependency('pangocairo', required : get_option('ttml')) if libxml_dep.found() and pango_dep.found() and cairo_dep.found() and pangocairo_dep.found() gstttmlsubs = library('gstttmlsubs', @@ -15,7 +13,7 @@ if libxml_dep.found() and pango_dep.found() and cairo_dep.found() and pangocairo 'gstttmlplugin.c'], c_args : gst_plugins_bad_args, include_directories : [configinc], - dependencies : [gstvideo_dep, libxml_dep, pango_dep, cairo_dep, pangocairo_dep, m_dep], + dependencies : [gstvideo_dep, libxml_dep, pango_dep, cairo_dep, pangocairo_dep, libm], install : true, install_dir : plugins_install_dir, ) diff --git a/ext/voaacenc/meson.build b/ext/voaacenc/meson.build index 16f3e48..72835b4 100644 --- a/ext/voaacenc/meson.build +++ b/ext/voaacenc/meson.build @@ -1,6 +1,6 @@ voaac_sources = ['gstvoaac.c', 'gstvoaacenc.c'] -voaac_dep = dependency('vo-aacenc', required : false) +voaac_dep = dependency('vo-aacenc', required : get_option('voaacenc')) if voaac_dep.found() gstbz2 = library('gstvoaacenc', diff --git a/ext/vulkan/meson.build b/ext/vulkan/meson.build index 873cfbb..8c9844c 100644 --- a/ext/vulkan/meson.build +++ b/ext/vulkan/meson.build @@ -20,15 +20,22 @@ vulkan_sources = [ vulkan_defines = [] optional_deps = [] +if get_option('vulkan').disabled() + subdir_done() +endif -vulkan_dep = cc.find_library('vulkan', required : false) +vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan')) has_vulkan_header = cc.has_header('vulkan/vulkan.h') +if not has_vulkan_header and get_option('vulkan').enabled() + error('vulkan plugin enabled, but vulkan.h not found') +endif + if vulkan_dep.found() and has_vulkan_header have_vulkan_windowing = false vkconf = configuration_data() - xcb_dep = dependency('xcb', version : '>=1.10', required : false) + xcb_dep = dependency('xcb', version : '>=1.10', required : get_option('x11')) if xcb_dep.found() vulkan_sources += [ 'xcb/vkdisplay_xcb.c', @@ -41,7 +48,7 @@ if vulkan_dep.found() and has_vulkan_header vkconf.set10('GST_VULKAN_HAVE_WINDOW_XCB', 1) endif - wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : false) + wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : get_option('wayland')) if wayland_client_dep.found() vulkan_sources += [ 'wayland/vkdisplay_wayland.c', diff --git a/ext/webp/meson.build b/ext/webp/meson.build index fab742c..f429e76 100644 --- a/ext/webp/meson.build +++ b/ext/webp/meson.build @@ -4,7 +4,7 @@ webp_sources = [ 'gstwebpenc.c', ] -webp_dep = dependency('libwebp', version : '>= 0.2.1', required : false) +webp_dep = dependency('libwebp', version : '>= 0.2.1', required : get_option('webp')) if webp_dep.found() gstwebp = library('gstwebp', diff --git a/ext/webrtc/meson.build b/ext/webrtc/meson.build index f098a40..1d64aa9 100644 --- a/ext/webrtc/meson.build +++ b/ext/webrtc/meson.build @@ -13,7 +13,7 @@ webrtc_sources = [ 'webrtctransceiver.c', ] -libnice_dep = dependency('nice', version : '>=0.1.14', required : false, +libnice_dep = dependency('nice', version : '>=0.1.14', required : get_option('webrtc'), fallback : ['libnice', 'libnice_dep'], default_options: ['tests=false']) diff --git a/ext/webrtcdsp/meson.build b/ext/webrtcdsp/meson.build index a5c4784..9d02a7f 100644 --- a/ext/webrtcdsp/meson.build +++ b/ext/webrtcdsp/meson.build @@ -3,7 +3,8 @@ webrtc_sources = [ 'gstwebrtcechoprobe.cpp' ] -webrtc_dep = dependency('webrtc-audio-processing', version : ['>= 0.2', '< 0.4'], required : false) +webrtc_dep = dependency('webrtc-audio-processing', version : ['>= 0.2', '< 0.4'], + required : get_option('webrtcdsp')) if webrtc_dep.found() gstwebrtcdsp = library('gstwebrtcdsp', diff --git a/ext/x265/meson.build b/ext/x265/meson.build index 249a653..37c98f9 100644 --- a/ext/x265/meson.build +++ b/ext/x265/meson.build @@ -1,4 +1,4 @@ -x265_dep = dependency('x265', required: false) +x265_dep = dependency('x265', required: get_option('x265')) if x265_dep.found() gstx265 = library('gstx265', 'gstx265enc.c', diff --git a/ext/zbar/meson.build b/ext/zbar/meson.build index 6371c2c..4360abc 100644 --- a/ext/zbar/meson.build +++ b/ext/zbar/meson.build @@ -1,4 +1,4 @@ -zbar_dep = dependency('zbar', version : '>= 0.9', required : false) +zbar_dep = dependency('zbar', version : '>= 0.9', required : get_option('zbar')) if zbar_dep.found() gstzbar = library('gstzbar', 'gstzbar.c', diff --git a/gst-libs/gst/opencv/meson.build b/gst-libs/gst/opencv/meson.build index ba132aa..b11e2ba 100644 --- a/gst-libs/gst/opencv/meson.build +++ b/gst-libs/gst/opencv/meson.build @@ -8,9 +8,8 @@ opencv_headers = [ 'gstopencvutils.h', 'gstopencvvideofilter.h', ] -install_headers(opencv_headers, subdir : 'gstreamer-1.0/gst/opencv') -opencv_dep = dependency('opencv', version : '>= 2.3.0', required : false) +opencv_dep = dependency('opencv', version : '>= 2.3.0', required : get_option('opencv')) if opencv_dep.found() gstopencv = library('gstopencv-' + api_version, opencv_sources, @@ -25,4 +24,6 @@ if opencv_dep.found() gstopencv_dep = declare_dependency(link_with: gstopencv, include_directories : [libsinc], dependencies : [gstvideo_dep, opencv_dep]) + + install_headers(opencv_headers, subdir : 'gstreamer-1.0/gst/opencv') endif diff --git a/gst-libs/gst/wayland/meson.build b/gst-libs/gst/wayland/meson.build index 7bff571..d174a9f 100644 --- a/gst-libs/gst/wayland/meson.build +++ b/gst-libs/gst/wayland/meson.build @@ -1,9 +1,9 @@ wl_req = '>= 1.4' -wl_client_dep = dependency('wayland-client', version: wl_req, required: false) -libdrm_dep = dependency('libdrm', version: '>= 2.4.55', required: false) -wl_protocol_dep = dependency('wayland-protocols', version: wl_req, - required: false) -wl_scanner = find_program('wayland-scanner', required: false) +wl_client_dep = dependency('wayland-client', version: wl_req, required: get_option('wayland')) +libdrm_dep = dependency('libdrm', version: '>= 2.4.55', required: get_option('wayland')) +wl_protocol_dep = dependency('wayland-protocols', version: wl_req, required: get_option('wayland')) +wl_scanner = find_program('wayland-scanner', required: get_option('wayland')) +# Also used in ext/wayland use_wayland = wl_protocol_dep.found() and wl_client_dep.found() and wl_scanner.found() and libdrm_dep.found() if use_wayland diff --git a/gst/mpegtsdemux/meson.build b/gst/mpegtsdemux/meson.build index 433f86e..09174cc 100644 --- a/gst/mpegtsdemux/meson.build +++ b/gst/mpegtsdemux/meson.build @@ -12,7 +12,7 @@ gstmpegtsdemux = library('gstmpegtsdemux', c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], include_directories : [configinc, libsinc], dependencies : [gstcodecparsers_dep, gstmpegts_dep, gsttag_dep, - gstpbutils_dep, gstaudio_dep, gstbase_dep, mathlib], + gstpbutils_dep, gstaudio_dep, gstbase_dep, libm], install : true, install_dir : plugins_install_dir, ) diff --git a/meson.build b/meson.build index 9978f85..5f1c430 100644 --- a/meson.build +++ b/meson.build @@ -387,11 +387,9 @@ endif # GStreamer OpenGL gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstgl_dep'], required: false) + fallback : ['gst-plugins-base', 'gstgl_dep'], required: get_option('gl')) -build_gstgl = gstgl_dep.found() # FIXME: add option? - -if build_gstgl +if gstgl_dep.found() if gstgl_dep.type_name() == 'pkgconfig' gst_gl_apis = gstgl_dep.get_pkgconfig_variable('gl_apis').split() gst_gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split() @@ -421,34 +419,17 @@ if build_gstgl endif libm = cc.find_library('m', required : false) -glib_dep = dependency('glib-2.0', version : glib_req, - fallback: ['glib', 'libglib_dep']) -gmodule_dep = dependency('gmodule-2.0', - fallback: ['glib', 'libgmodule_dep']) -gio_dep = dependency('gio-2.0', - fallback: ['glib', 'libgio_dep']) -x11_dep = dependency('x11', required : false) - -# Used by dtls and hls -openssl_dep = dependency('openssl', version : '>= 1.0.1', required : false) - -# Used by mpeg2enc and mplex -# mjpegtools upstream breaks API constantly and doesn't export the version in -# a header anywhere. The configure file has a lot of logic to support old -# versions, but it all seems untested and broken. Require 2.0.0. Can be changed -# if someone complains. -mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : false) -mjpegtools_api = '0' -if mjpegtools_dep.found() - mjpegtools_api = '20000' -endif +glib_dep = dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']) +gmodule_dep = dependency('gmodule-2.0', fallback: ['glib', 'libgmodule_dep']) +gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep']) +# gio-unix-2.0 is used by sys/bluez +# Optional dep of ext/gl and gst/librfb +x11_dep = dependency('x11', required : get_option('x11')) if x11_dep.found() cdata.set('HAVE_X11', 1) endif -mathlib = cc.find_library('m', required : false) - if host_machine.system() == 'windows' winsock2 = [cc.find_library('ws2_32')] else diff --git a/meson_options.txt b/meson_options.txt index 4b9ab7b..c535574 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -65,6 +65,78 @@ option('vmnc', type : 'feature', value : 'auto') option('y4m', type : 'feature', value : 'auto') option('yadif', type : 'feature', value : 'auto') +# Feature options for libraries that need external deps +option('opencv', type : 'feature', value : 'auto', description : 'OpenCV computer vision library support') + +# Feature options for optional deps in plugins +option('wayland', type : 'feature', value : 'auto', description : 'Wayland plugin/library, support in the Vulkan plugin') +option('x11', type : 'feature', value : 'auto', description : 'X11 support in Vulkan, GL and rfb plugins') + +# Feature options for plugins that need external deps +option('aom', type : 'feature', value : 'auto', description : 'AOM AV1 video codec plugin') +option('assrender', type : 'feature', value : 'auto', description : 'ASS/SSA subtitle renderer plugin') +option('bluez', type : 'feature', value : 'auto', description : 'Bluetooth audio A2DP/AVDTP sink, AVDTP source plugin') +option('bs2b', type : 'feature', value : 'auto', description : 'Bauer stereophonic-to-binaural audio plugin') +option('bz2', type : 'feature', value : 'auto', description : 'bz2 stream encoder and decoder plugin') +option('chromaprint', type : 'feature', value : 'auto', description : 'Chromaprint fingerprint audio plugin') +option('closedcaption', type : 'feature', value : 'auto', description : 'Closed caption extractor, decoder, and overlay plugin') +option('curl', type : 'feature', value : 'auto', description : 'cURL network source and sink plugin') +option('d3dvideosink', type : 'feature', value : 'auto', description : 'Direct3D video sink plugin') +option('dash', type : 'feature', value : 'auto', description : 'DASH demuxer plugin') +option('decklink', type : 'feature', value : 'auto', description : 'DeckLink audio/video source/sink plugin') +option('directfb', type : 'feature', value : 'auto', description : 'DirectFB video sink plugin') +option('directsound', type : 'feature', value : 'auto', description : 'Directsound audio source plugin') +option('dtls', type : 'feature', value : 'auto', description : 'DTLS encoder and decoder plugin') +option('dts', type : 'feature', value : 'auto', description : 'DTS audio decoder plugin') +option('dvb', type : 'feature', value : 'auto', description : 'DVB video bin and source plugin') +option('faac', type : 'feature', value : 'auto', description : 'Free AAC audio encoder plugin') +option('faad', type : 'feature', value : 'auto', description : 'Free AAC audio decoder plugin') +option('fbdev', type : 'feature', value : 'auto', description : 'Framebuffer video sink plugin') +option('fdkaac', type : 'feature', value : 'auto', description : 'Fraunhofer AAC audio codec plugin') +option('flite', type : 'feature', value : 'auto', description : 'Flite speech synthesizer source plugin') +option('fluidsynth', type : 'feature', value : 'auto', description : 'Fluidsynth MIDI decoder plugin') +option('gl', type : 'feature', value : 'auto', description : 'GStreamer OpenGL mixer plugin') +option('gsm', type : 'feature', value : 'auto', description : 'GSM encoder/decoder plugin') +option('ipcpipeline', type : 'feature', value : 'auto', description : 'Inter-process communication plugin') +option('iqa', type : 'feature', value : 'auto', description : 'Image quality assessment plugin') +option('kate', type : 'feature', value : 'auto', description : 'Kate subtitle parser, tagger, and codec plugin') +option('kms', type : 'feature', value : 'auto', description : 'KMS video sink plugin') +option('ladspa', type : 'feature', value : 'auto', description : 'LADSPA plugin bridge') +option('libde265', type : 'feature', value : 'auto', description : 'HEVC/H.265 video decoder plugin') +option('libmms', type : 'feature', value : 'auto', description : 'Microsoft multimedia server network source plugin') +option('lv2', type : 'feature', value : 'auto', description : 'LV2 audio plugin bridge') +option('mpeg2enc', type : 'feature', value : 'auto', description : 'mpeg2enc video encoder plugin') +option('mplex', type : 'feature', value : 'auto', description : 'mplex audio/video multiplexer plugin') +option('openh264', type : 'feature', value : 'auto', description : 'H.264 video codec plugin') +option('openjpeg', type : 'feature', value : 'auto', description : 'JPEG2000 image codec plugin') +option('opus', type : 'feature', value : 'auto', description : 'OPUS audio parser plugin') +option('resindvd', type : 'feature', value : 'auto', description : 'Resin DVD playback plugin') +option('rsvg', type : 'feature', value : 'auto', description : 'SVG overlayer and image decoder plugin') +option('rtmp', type : 'feature', value : 'auto', description : 'RTMP video network source and sink plugin') +option('sbc', type : 'feature', value : 'auto', description : 'SBC bluetooth audio codec plugin') +option('shm', type : 'feature', value : 'auto', description : 'Shared memory source/sink plugin') +option('smoothstreaming', type : 'feature', value : 'auto', description : 'Microsoft Smooth Streaming demuxer plugin') +option('soundtouch', type : 'feature', value : 'auto', description : 'Audio pitch controller & BPM detection plugin') +option('spandsp', type : 'feature', value : 'auto', description : 'Packet loss concealment audio plugin') +option('srt', type : 'feature', value : 'auto', description : 'Secure, Reliable, Transport client/server network source/sink plugin') +option('srtp', type : 'feature', value : 'auto', description : 'Secure RTP codec plugin') +option('ttml', type : 'feature', value : 'auto', description : 'TTML subtitle parser and renderer plugin') +option('uvch264', type : 'feature', value : 'auto', description : 'UVC compliant H.264 camera source plugin') +option('voaacenc', type : 'feature', value : 'auto', description : 'AAC audio encoder plugin') +option('vulkan', type : 'feature', value : 'auto', description : 'Vulkan video sink plugin') +option('wasapi', type : 'feature', value : 'auto', description : 'Windows Audio Session API source/sink plugin') +option('webp', type : 'feature', value : 'auto', description : 'WebP image codec plugin') +option('webrtc', type : 'feature', value : 'auto', description : 'WebRTC audio/video network bin plugin') +option('webrtcdsp', type : 'feature', value : 'auto', description : 'Plugin with various audio filters provided by the WebRTC audio processing library') +option('winscreencap', type : 'feature', value : 'auto', description : 'Windows Screen Capture video source plugin') +option('x265', type : 'feature', value : 'auto', description : 'HEVC/H.265 video encoder plugin') +option('zbar', type : 'feature', value : 'auto', description : 'Barcode image scanner plugin') + +# HLS plugin options +option('hls', type : 'feature', value : 'auto', description : 'HTTP Live Streaming plugin') +option('hls-crypto', type : 'combo', value : 'auto', choices : ['auto', 'nettle', 'libgcrypt', 'openssl'], + description: 'Crypto library to use for HLS plugin') + # Common feature options option('examples', type : 'feature', value : 'auto', yield : true) option('introspection', type : 'feature', value : 'auto', yield : true, description : 'Generate gobject-introspection bindings') diff --git a/sys/bluez/meson.build b/sys/bluez/meson.build index 373feae..19386f3 100644 --- a/sys/bluez/meson.build +++ b/sys/bluez/meson.build @@ -7,21 +7,16 @@ bluez_sources = [ 'gstavrcputil.c', ] -bluez_dep = dependency('bluez', version : '>= 5.0', required : false) -gio_unix_dep = dependency('gio-unix-2.0', version : glib_req, required : false) +bluez_dep = dependency('bluez', version : '>= 5.0', required : get_option('bluez')) +gio_unix_dep = dependency('gio-unix-2.0', version : glib_req, + fallback: ['glib', 'libgiounix_dep'], + required : get_option('bluez')) if bluez_dep.found() and gio_unix_dep.found() - # FIXME: do we really need the meson.current_build_dir() here? Shouldn't - # the custom command be executed with the current build directoy as working - # directory? Without this, bluez.[ch] are created in the top-level build dir! - bluez_ch = custom_target('bluez_ch', - output : [ 'bluez.h', 'bluez.c' ] , - input : 'org.bluez.xml', - command : [ find_program('gdbus-codegen'), - '--c-namespace=Bluez', - '--generate-c-code=' + meson.current_build_dir() + '/bluez', - '--interface-prefix=org.bluez', - '@INPUT@' ]) + bluez_ch = gnome.gdbus_codegen('bluez-interface', + sources : 'org.bluez.xml', + interface_prefix : 'org.bluez', + namespace : 'Bluez') gstbluez = library('gstbluez', bluez_sources, bluez_ch, diff --git a/sys/d3dvideosink/meson.build b/sys/d3dvideosink/meson.build index 26c34b7..c9230da 100644 --- a/sys/d3dvideosink/meson.build +++ b/sys/d3dvideosink/meson.build @@ -3,14 +3,23 @@ d3dvideosink_sources = [ 'd3dvideosink.c', ] -if host_system == 'windows' and cc.has_header('d3d9.h') - d3dvideosink_dep = [cc.find_library('d3d9'), cc.find_library('gdi32')] +if host_system != 'windows' or get_option('d3dvideosink').disabled() + subdir_done() +endif + +d3d_dep = cc.find_library('d3d9', required : get_option('d3dvideosink')) +gdi_dep = cc.find_library('gdi32', required : get_option('d3dvideosink')) +have_d3d9_h = cc.has_header('d3d9.h') +if not have_d3d9_h and get_option('d3dvideosink').enabled() + error('d3dvideosink plugin enabled but d3d9.h not found') +endif +if d3d_dep.found() and gdi_dep.found() and have_d3d9_h gstd3dvideosink = library('gstd3d', d3dvideosink_sources, c_args : gst_plugins_bad_args, include_directories : [configinc], - dependencies : [gstvideo_dep] + d3dvideosink_dep, + dependencies : [gstvideo_dep, d3d_dep, gdi_dep], install : true, install_dir : plugins_install_dir) pkgconfig.generate(gstd3dvideosink, install_dir : plugins_pkgconfig_install_dir) diff --git a/sys/decklink/meson.build b/sys/decklink/meson.build index 3cb4bda..7864437 100644 --- a/sys/decklink/meson.build +++ b/sys/decklink/meson.build @@ -6,15 +6,19 @@ decklink_sources = [ 'gstdecklinkvideosrc.cpp', ] +if get_option('decklink').disabled() + subdir_done() +endif + build_decklink = false decklink_ldflags = [] decklink_libs = [] -if host_machine.system() == 'windows' +if host_system == 'windows' decklink_sources += ['win/DeckLinkAPIDispatch.cpp', 'win/DeckLinkAPI_i.c'] if cxx.get_id() == 'msvc' # FIXME: Use commsuppwd.lib for debug builds? - comutil_dep = cxx.find_library('comsuppw') + comutil_dep = cxx.find_library('comsuppw', required : get_option('decklink')) if comutil_dep.found() build_decklink = true decklink_libs = [comutil_dep] @@ -23,7 +27,7 @@ if host_machine.system() == 'windows' build_decklink = true endif else - libdl = cc.find_library('dl', required: false) + libdl = cc.find_library('dl', required: get_option('decklink')) have_pthread_h = cdata.has('HAVE_PTHREAD_H') if libdl.found() and have_pthread_h decklink_libs = [libm, libdl, dependency('threads')] diff --git a/sys/directsound/meson.build b/sys/directsound/meson.build index 03ec447..9e7f132 100644 --- a/sys/directsound/meson.build +++ b/sys/directsound/meson.build @@ -12,14 +12,24 @@ directsoundsrc_device_flags = [ '-DGST_DIRECTSOUND_SRC_DEVICE_PROVIDER=1' ] -if host_system == 'windows' and cc.has_header('dsound.h') - directsoundsrc_dep = [cc.find_library('dsound'), cc.find_library('winmm'), cc.find_library('ole32')] +if host_system != 'windows' or get_option('directsound').disabled() + subdir_done() +endif + +dsound_dep = cc.find_library('dsound', required : get_option('directsound')) +winmm_dep = cc.find_library('winmm', required : get_option('directsound')) +ole32_dep = cc.find_library('ole32', required : get_option('directsound')) +have_dsound_h = cc.has_header('dsound.h') +if not have_dsound_h and get_option('directsound').enabled() + error('directsound plugin enabled but dsound.h not found') +endif +if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and have_dsound_h gstdirectsoundsrc = library('gstdirectsoundsrc', directsoundsrc_sources, c_args : gst_plugins_bad_args + directsoundsrc_device_flags, include_directories : [configinc], - dependencies : [gstaudio_dep] + directsoundsrc_dep, + dependencies : [gstaudio_dep, dsound_dep, winmm_dep, ole32_dep], install : true, install_dir : plugins_install_dir) pkgconfig.generate(gstdirectsoundsrc, install_dir : plugins_pkgconfig_install_dir) diff --git a/sys/dvb/meson.build b/sys/dvb/meson.build index 5d3e7d1..d8b496b 100644 --- a/sys/dvb/meson.build +++ b/sys/dvb/meson.build @@ -15,18 +15,22 @@ dvb_sources = [ 'parsechannels.c', ] -dvb_check_code_lines = [ - '#include \n\n', - '#if DVB_API_VERSION < 5 || (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR <= 4)\n\n', - '#error "Incompatible dvb API"\n\n', - '#endif', -] -dvb_check_code='' -foreach l : dvb_check_code_lines - dvb_check_code = dvb_check_code + l -endforeach +if get_option('dvb').disabled() + subdir_done() +endif + +dvb_check_code = ''' +#include +#if DVB_API_VERSION < 5 || (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR <= 4) +#error "Incompatible dvb API" +#endif' +''' +have_dvb = cc.compiles(dvb_check_code) +if not have_dvb and get_option('dvb').enabled() + error('DVB plugin enabled but dvb headers not found') +endif -if cc.compiles(dvb_check_code) +if have_dvb gstdvb = library('gstdvb', dvb_sources, c_args : gst_plugins_bad_args + [ '-DGST_USE_UNSTABLE_API' ], diff --git a/sys/fbdev/meson.build b/sys/fbdev/meson.build index 1aed2ad..84ee057 100644 --- a/sys/fbdev/meson.build +++ b/sys/fbdev/meson.build @@ -2,7 +2,16 @@ fbdevsink_sources = [ 'gstfbdevsink.c', ] -if cc.has_header('linux/fb.h') +if get_option('fbdev').disabled() + subdir_done() +endif + +have_fb_h = cc.has_header('linux/fb.h') +if not have_fb_h and get_option('fbdev').enabled() + error('fbdev plugin enabled but fb.h not found') +endif + +if have_fb_h gstfbdevsink = library('gstfbdevsink', fbdevsink_sources, c_args : gst_plugins_bad_args, diff --git a/sys/ipcpipeline/meson.build b/sys/ipcpipeline/meson.build index 3ebf58e..1ea4c69 100644 --- a/sys/ipcpipeline/meson.build +++ b/sys/ipcpipeline/meson.build @@ -6,8 +6,25 @@ ipcpipeline_sources = [ 'gstipcslavepipeline.c' ] -if cc.has_header ('sys/socket.h') and cc.has_function ('pipe') and cc.has_function ('socketpair') +if get_option('ipcpipeline').disabled() + subdir_done() +endif +have_socket_h = cc.has_header('sys/socket.h') +if not have_socket_h and get_option('ipcpipeline').enabled() + error('ipcpipeline plugin enabled but socket.h not found') +endif +have_pipe = cc.has_function('pipe') +if not have_pipe and get_option('ipcpipeline').enabled() + error('ipcpipeline plugin enabled but pipe() not found') +endif +have_socketpair = cc.has_function('socketpair') +if not have_socketpair and get_option('ipcpipeline').enabled() + error('ipcpipeline plugin enabled but socketpair() not found') +endif + + +if have_socket_h and have_pipe and have_socketpair gstipcpipeline = library('gstipcpipeline', ipcpipeline_sources, c_args : gst_plugins_bad_args, @@ -17,5 +34,4 @@ if cc.has_header ('sys/socket.h') and cc.has_function ('pipe') and cc.has_functi install_dir : plugins_install_dir, ) pkgconfig.generate(gstipcpipeline, install_dir : plugins_pkgconfig_install_dir) - endif diff --git a/sys/kms/meson.build b/sys/kms/meson.build index 4a3f543..fbc1861 100644 --- a/sys/kms/meson.build +++ b/sys/kms/meson.build @@ -5,8 +5,7 @@ kmssink_sources = [ 'gstkmsutils.c', ] -libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false) - +libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : get_option('kms')) if libdrm_dep.found() gstkmssink = library('gstkms', kmssink_sources, diff --git a/sys/msdk/meson.build b/sys/msdk/meson.build index 049d17f..a08d8ca 100644 --- a/sys/msdk/meson.build +++ b/sys/msdk/meson.build @@ -30,6 +30,7 @@ else msdk_sources += ['msdk_libva.c', 'gstmsdkallocator_libva.c'] endif +# FIXME: automagic msdk_root = run_command(python3, '-c', 'import os; print(os.environ.get("INTELMEDIASDKROOT", os.environ.get("MFX_HOME", "")))').stdout().strip() have_msdk = false diff --git a/sys/shm/meson.build b/sys/shm/meson.build index 7ae72f3..6f573cf 100644 --- a/sys/shm/meson.build +++ b/sys/shm/meson.build @@ -6,25 +6,35 @@ shm_sources = [ 'gstshmsink.c', ] -shm_enabled = false +if get_option('shm').disabled() + subdir_done() +endif + shm_deps = [] -rt_dep = cc.find_library ('rt', required: false) +if ['osx', 'bsd'].contains(host_system) + rt_dep = [] + shm_enabled = true +else + rt_dep = cc.find_library ('rt', required: false) + shm_enabled = rt_dep.found() +endif -if cc.has_header ('sys/socket.h') and (host_system == 'osx' or - host_system == 'bsd' or rt_dep.found()) +if shm_enabled + shm_enabled = cc.has_header('sys/socket.h') +elif get_option('shm').enabled() + error('shm plugin enabled but librt not found') +endif - shm_enabled = true - shm_deps = [gstbase_dep] +if not shm_enabled and get_option('shm').enabled() + error('shm plugin enabled but socket.h not found') +endif - if rt_dep.found() - shm_deps += [rt_dep] - endif - +if shm_enabled gstshm = library('gstshm', shm_sources, c_args : gst_plugins_bad_args + ['-DSHM_PIPE_USE_GLIB'], include_directories : [configinc], - dependencies : shm_deps, + dependencies : [gstbase_dep, rt_dep], install : true, install_dir : plugins_install_dir, ) diff --git a/sys/uvch264/meson.build b/sys/uvch264/meson.build index c4f1001..f2cc313 100644 --- a/sys/uvch264/meson.build +++ b/sys/uvch264/meson.build @@ -5,9 +5,12 @@ uvch264_sources = [ 'uvc_h264.c', ] -libgudev_dep = dependency('gudev-1.0', required : false) -libusb_dep = dependency('libusb-1.0', required : false) +libgudev_dep = dependency('gudev-1.0', required : get_option('uvch264')) +libusb_dep = dependency('libusb-1.0', required : get_option('uvch264')) has_uvcvideo_h = cc.has_header('linux/uvcvideo.h') +if not has_uvcvideo_h and get_option('uvch264').enabled() + error('uvch264 plugin enabled but uvcvideo.h not found') +endif if libgudev_dep.found() and libusb_dep.found() and has_uvcvideo_h gstuvch264 = library('gstuvch264', diff --git a/sys/wasapi/meson.build b/sys/wasapi/meson.build index c5b47dd..cf57d87 100644 --- a/sys/wasapi/meson.build +++ b/sys/wasapi/meson.build @@ -6,15 +6,27 @@ wasapi_sources = [ 'gstwasapidevice.c', ] -if host_system == 'windows' and cc.has_header('audioclient.h') - wasapi_dep = [cc.find_library('ole32'), cc.find_library('ksuser'), - cc.find_library('avrt', required : false)] +if host_system != 'windows' + if get_option('wasapi').disabled() + subdir_done() + elif get_option('wasapi').enabled() + error('Cannot build wasapi plugin when not building for Windows') + endif +endif + +ole32_dep = cc.find_library('ole32', required : get_option('wasapi')) +ksuser_dep = cc.find_library('ksuser', required : get_option('wasapi')) +have_audioclient_h = cc.has_header('audioclient.h') +if not have_audioclient_h and get_option('wasapi').enabled() + error('wasapi plugin enabled but audioclient.h not found') +endif +if ole32_dep.found() and ksuser_dep.found() and have_audioclient_h gstwasapi = library('gstwasapi', wasapi_sources, c_args : gst_plugins_bad_args + ['-DCOBJMACROS'], include_directories : [configinc], - dependencies : [gstaudio_dep] + wasapi_dep, + dependencies : [gstaudio_dep, ole32_dep, ksuser_dep], install : true, install_dir : plugins_install_dir) pkgconfig.generate(gstwasapi, install_dir : plugins_pkgconfig_install_dir) diff --git a/sys/winks/meson.build b/sys/winks/meson.build index 59036a1..eea1a31 100644 --- a/sys/winks/meson.build +++ b/sys/winks/meson.build @@ -8,9 +8,12 @@ winks_sources = [ ] if host_system == 'windows' - winks_dep = [cc.find_library('ksuser'), cc.find_library('uuid'), - cc.find_library('strmiids'), cc.find_library('dxguid'), - cc.find_library('setupapi'), cc.find_library('ole32')] + winks_dep = [cc.find_library('ksuser', required : get_option('winks')), + cc.find_library('uuid', required : get_option('winks')), + cc.find_library('strmiids', required : get_option('winks')), + cc.find_library('dxguid', required : get_option('winks')), + cc.find_library('setupapi', required : get_option('winks')), + cc.find_library('ole32', required : get_option('winks'))] gstwinks = library('gstwinks', winks_sources, diff --git a/sys/winscreencap/meson.build b/sys/winscreencap/meson.build index ad1a2e2..6f3511c 100644 --- a/sys/winscreencap/meson.build +++ b/sys/winscreencap/meson.build @@ -4,14 +4,23 @@ winscreencap_sources = [ 'gstwinscreencap.c', ] -if host_system == 'windows' and cc.has_header('d3d9.h') - winscreencap_dep = [cc.find_library('d3d9'), cc.find_library('gdi32')] +if host_system != 'windows' or get_option('winscreencap').disabled() + subdir_done() +endif + +d3d_dep = cc.find_library('d3d9', required : get_option('winscreencap')) +gdi_dep = cc.find_library('gdi32', required : get_option('winscreencap')) +have_d3d9_h = cc.has_header('d3d9.h') +if not have_d3d9_h and get_option('winscreencap').enabled() + error('winscreencap plugin enabled but d3d9.h not found') +endif +if d3d_dep.found() and gdi_dep.found() and have_d3d9_h gstwinscreencap = library('gstwinscreencap', winscreencap_sources, c_args : gst_plugins_bad_args, include_directories : [configinc], - dependencies : [gstbase_dep, gstvideo_dep] + winscreencap_dep, + dependencies : [gstbase_dep, gstvideo_dep, d3d_dep, gdi_dep], install : true, install_dir : plugins_install_dir, ) diff --git a/tests/check/meson.build b/tests/check/meson.build index b7bbf05..2758957 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -9,6 +9,7 @@ libparser = static_library('parser', libparser_dep = declare_dependency(link_with: libparser, sources: ['elements/parser.h']) +# FIXME: automagic exif_dep = dependency('libexif', version : '>= 0.6.16', required : false) enable_gst_player_tests = get_option('gst_player_tests') -- 2.7.4