From d4bdbeaa0da971c9dbc4cbf20e3f4476905e1961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 19 Sep 2021 00:55:34 +0100 Subject: [PATCH] meson: add 'gpl' option and only build plugins with (A)GPL deps if explicitly enabled Require explicit opt-in to build plugins with (A)GPL dependencies. Keep ugly/bad options on 'auto' for now so cerbero doesn't fail. Part-of: --- .gitlab-ci.yml | 1 + README.md | 24 ++++++++++++ ci/docker/windows/install_gst.ps1 | 5 ++- meson_options.txt | 4 ++ .../gst-plugins-bad/ext/dts/meson.build | 9 ++++- .../gst-plugins-bad/ext/faad/meson.build | 14 ++++++- subprojects/gst-plugins-bad/ext/iqa/iqa.c | 1 + .../gst-plugins-bad/ext/iqa/meson.build | 7 +++- .../gst-plugins-bad/ext/mpeg2enc/meson.build | 29 ++++++++------ .../gst-plugins-bad/ext/mplex/meson.build | 11 ++++-- .../gst-plugins-bad/ext/resindvd/meson.build | 9 ++++- .../gst-plugins-bad/ext/x265/meson.build | 7 +++- subprojects/gst-plugins-bad/meson.build | 8 +++- subprojects/gst-plugins-bad/meson_options.txt | 18 +++++---- .../gst-plugins-ugly/ext/a52dec/meson.build | 38 ++++++++++--------- .../gst-plugins-ugly/ext/cdio/meson.build | 7 +++- .../gst-plugins-ugly/ext/dvdread/meson.build | 7 +++- .../gst-plugins-ugly/ext/mpeg2dec/meson.build | 7 +++- .../gst-plugins-ugly/ext/sidplay/meson.build | 8 ++-- .../gst-plugins-ugly/ext/x264/meson.build | 7 +++- subprojects/gst-plugins-ugly/meson.build | 8 +++- .../gst-plugins-ugly/meson_options.txt | 18 +++++---- 22 files changed, 180 insertions(+), 67 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a94b712646..b1c9780f71 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,7 @@ variables: -Drtsp_server=enabled -Dvaapi=enabled -Dsharp=disabled + -Dgpl=enabled MESON_GST_WERROR: > -Dgstreamer:werror=true diff --git a/README.md b/README.md index 270c570f0e..591f3f3abc 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,30 @@ the build files to find `libmfx`. The plugin will be automatically enabled if possible, but you can ensure it by passing `-Dbad=enabled -Dgst-plugins-bad:msdk=enabled` to `meson`. +### Building plugins with (A)GPL-licensed dependencies + +Some plugins have GPL- or AGPL-licensed dependencies and will only be built +if you have explicitly opted in to allow (A)GPL-licensed dependencies by +passing `-Dgpl=enabled` to Meson. + +List of plugins with (A)GPL-licensed dependencies (non-exhaustive) in gst-plugins-bad: + - dts (DTS audio decoder plugin) + - faad (Free AAC audio decoder plugin) + - iqa (Image quality assessment plugin based on dssim-c) + - mpeg2enc (MPEG-2 video encoder plugin) + - mplex (audio/video multiplexer plugin) + - ofa (Open Fingerprint Architecture library plugin) + - resindvd (Resin DVD playback plugin) + - x265 (HEVC/H.265 video encoder plugin) + +List of plugins with (A)GPL-licensed dependencies (non-exhaustive) in gst-plugins-ugly: + - a52dec (Dolby Digital (AC-3) audio decoder plugin) + - cdio (CD audio source plugin based on libcdio) + - dvdread (DVD video source plugin based on libdvdread) + - mpeg2dec (MPEG-2 video decoder plugin based on libmpeg2) + - sidplay (Commodore 64 audio decoder plugin based on libsidplay) + - x264 (H.264 video encoder plugin based on libx264) + ### Static build Since *1.18.0* when doing a static build using `--default-library=static`, a diff --git a/ci/docker/windows/install_gst.ps1 b/ci/docker/windows/install_gst.ps1 index 6105f3623b..7d961cddb6 100644 --- a/ci/docker/windows/install_gst.ps1 +++ b/ci/docker/windows/install_gst.ps1 @@ -53,7 +53,8 @@ $env:MESON_ARGS = "-Dglib:installed_tests=false " + "-Dlibav=disabled " + "-Dvaapi=disabled " + "-Dgst-plugins-base:pango=enabled " + - "-Dgst-plugins-good:cairo=enabled " + "-Dgst-plugins-good:cairo=enabled " + + "-Dgpl=enabled " Write-Output "Building gst" cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson _build $env:MESON_ARGS && meson compile -C _build && ninja -C _build install" @@ -68,4 +69,4 @@ git clean -fdxx if (!$?) { Write-Host "Failed to git clean" Exit 1 -} \ No newline at end of file +} diff --git a/meson_options.txt b/meson_options.txt index 1fa3c6d63b..3037d5307b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -34,6 +34,10 @@ option('gst-full-device-providers', type : 'string', value : '', option('gst-full-dynamic-types', type : 'string', value : '', description : '''List of dynamic types to expose in gstreamer-full's ABI with the syntax plugin:dt1,dt2. By default '' will export all device provider of the enabled plugin.''') +# License-related feature options +option('gpl', type: 'feature', value: 'disabled', + description: 'Allow build of plugins that have (A)GPL-licensed dependencies') + # Common options, automatically inherited by subprojects option('tests', type : 'feature', value : 'auto', description : 'Build tests') option('examples', type : 'feature', value : 'auto', description : 'Build examples') diff --git a/subprojects/gst-plugins-bad/ext/dts/meson.build b/subprojects/gst-plugins-bad/ext/dts/meson.build index 8ab3fc917f..e4a5bcbfef 100644 --- a/subprojects/gst-plugins-bad/ext/dts/meson.build +++ b/subprojects/gst-plugins-bad/ext/dts/meson.build @@ -1,5 +1,10 @@ +dts_opt = get_option('dts').require(gpl_allowed, error_message: ''' + Plugin dts explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + # Don't do any dependency checks if disabled -if get_option('dts').disabled() +if dts_opt.disabled() subdir_done() endif @@ -9,7 +14,7 @@ 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() + if not dca_dep.found() and dts_opt.enabled() error('DTS plugin enabled, but libdca not found') endif endif diff --git a/subprojects/gst-plugins-bad/ext/faad/meson.build b/subprojects/gst-plugins-bad/ext/faad/meson.build index e3aefc9076..2e633bd531 100644 --- a/subprojects/gst-plugins-bad/ext/faad/meson.build +++ b/subprojects/gst-plugins-bad/ext/faad/meson.build @@ -1,12 +1,22 @@ +faad_opt = get_option('faad').require(gpl_allowed, error_message: ''' + Plugin faad explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +if faad_opt.disabled() + faad_dep = dependency('', required: false) + subdir_done() +endif + 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 and get_option('faad').enabled() +if have_faad and not have_faad_2_7 and faad_opt.enabled() message('Found faad2, but too old (< v2.7.0)') endif -faad_dep = cc.find_library('faad', required : get_option('faad')) +faad_dep = cc.find_library('faad', required : faad_opt) if faad_dep.found() and have_faad_2_7 gstfaad = library('gstfaad', diff --git a/subprojects/gst-plugins-bad/ext/iqa/iqa.c b/subprojects/gst-plugins-bad/ext/iqa/iqa.c index afe83b9f76..9362fd8459 100644 --- a/subprojects/gst-plugins-bad/ext/iqa/iqa.c +++ b/subprojects/gst-plugins-bad/ext/iqa/iqa.c @@ -516,6 +516,7 @@ plugin_init (GstPlugin * plugin) return GST_ELEMENT_REGISTER (iqa, plugin); } +// FIXME: effective iqa plugin license should be AGPL3+ ! GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, iqa, diff --git a/subprojects/gst-plugins-bad/ext/iqa/meson.build b/subprojects/gst-plugins-bad/ext/iqa/meson.build index 75e07fc445..08d37a3509 100644 --- a/subprojects/gst-plugins-bad/ext/iqa/meson.build +++ b/subprojects/gst-plugins-bad/ext/iqa/meson.build @@ -1,4 +1,9 @@ -dssim_dep = dependency('dssim', required : get_option('iqa'), +iqa_opt = get_option('iqa').require(gpl_allowed, error_message: ''' + Plugin iqa explicitly required via options but (A)GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow (A)GPL-licensed plugins to be built. + ''') + +dssim_dep = dependency('dssim', required: iqa_opt, fallback: ['dssim', 'dssim_dep']) if dssim_dep.found() diff --git a/subprojects/gst-plugins-bad/ext/mpeg2enc/meson.build b/subprojects/gst-plugins-bad/ext/mpeg2enc/meson.build index af99bd564c..325df936dc 100644 --- a/subprojects/gst-plugins-bad/ext/mpeg2enc/meson.build +++ b/subprojects/gst-plugins-bad/ext/mpeg2enc/meson.build @@ -1,21 +1,26 @@ +mpeg2enc_opt = get_option('mpeg2enc').require(gpl_allowed, error_message: ''' + Plugin mpeg2enc explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + # 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')) - -no_warn_args = [] -foreach arg : [ - '-Wno-mismatched-tags', # mjpeg headers get class/struct mixed up - '-Wno-header-guard', - ] - if cxx.has_argument(arg) - no_warn_args += [arg] - endif -endforeach +mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : mpeg2enc_opt) +mpeg2enc_dep = cxx.find_library('mpeg2encpp', required : mpeg2enc_opt) if mjpegtools_dep.found() and mpeg2enc_dep.found() + no_warn_args = [] + foreach arg : [ + '-Wno-mismatched-tags', # mjpeg headers get class/struct mixed up + '-Wno-header-guard', + ] + if cxx.has_argument(arg) + no_warn_args += [arg] + endif + endforeach + gstmpeg2enc = library('gstmpeg2enc', 'gstmpeg2enc.cc', 'gstmpeg2encoptions.cc', diff --git a/subprojects/gst-plugins-bad/ext/mplex/meson.build b/subprojects/gst-plugins-bad/ext/mplex/meson.build index a1ac6ac57d..38a017e12f 100644 --- a/subprojects/gst-plugins-bad/ext/mplex/meson.build +++ b/subprojects/gst-plugins-bad/ext/mplex/meson.build @@ -1,6 +1,11 @@ -# 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')) +mplex_opt = get_option('mplex').require(gpl_allowed, error_message: ''' + Plugin mplex explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +# See: ext/mplex for note about mjpegtools dep +mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : mplex_opt) +mplex2_dep = cxx.find_library('mplex2', required : mplex_opt) if mjpegtools_dep.found() and mplex2_dep.found() gstmplex2 = library('gstmplex', diff --git a/subprojects/gst-plugins-bad/ext/resindvd/meson.build b/subprojects/gst-plugins-bad/ext/resindvd/meson.build index 06c216a33b..b7c901b505 100644 --- a/subprojects/gst-plugins-bad/ext/resindvd/meson.build +++ b/subprojects/gst-plugins-bad/ext/resindvd/meson.build @@ -1,3 +1,8 @@ +resindvd_opt = get_option('resindvd').require(gpl_allowed, error_message: ''' + Plugin resindvd explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + resindvd_sources = [ 'gstmpegdemux.c', 'gstmpegdesc.c', @@ -10,8 +15,8 @@ resindvd_sources = [ 'rsnparsetter.c', ] -dvdnav_dep = dependency('dvdnav', version : '>= 4.1.2', required : get_option('resindvd')) -dvdread_dep = dependency('dvdread', version : '>= 4.1.2', required : get_option('resindvd')) +dvdnav_dep = dependency('dvdnav', version : '>= 4.1.2', required : resindvd_opt) +dvdread_dep = dependency('dvdread', version : '>= 4.1.2', required : resindvd_opt) if dvdnav_dep.found() and dvdread_dep.found() gstresindvd = library('gstresindvd', diff --git a/subprojects/gst-plugins-bad/ext/x265/meson.build b/subprojects/gst-plugins-bad/ext/x265/meson.build index b664caebf8..9743803868 100644 --- a/subprojects/gst-plugins-bad/ext/x265/meson.build +++ b/subprojects/gst-plugins-bad/ext/x265/meson.build @@ -1,4 +1,9 @@ -x265_dep = dependency('x265', required: get_option('x265')) +x265_opt = get_option('x265').require(gpl_allowed, error_message: ''' + Plugin x265 explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +x265_dep = dependency('x265', required: x265_opt) if x265_dep.found() gstx265 = library('gstx265', 'gstx265enc.c', diff --git a/subprojects/gst-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index 6701d9ad8f..474397e8ba 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -486,6 +486,8 @@ pkgconfig.generate( description : 'Streaming media framework, bad plugins libraries', ) +gpl_allowed = get_option('gpl').allowed() + subdir('gst-libs') subdir('gst') subdir('sys') @@ -559,5 +561,9 @@ if meson.version().version_compare('>= 0.54') plugin_names += [plugin.name()] endif endforeach - summary({'Plugins':plugin_names}, list_sep: ', ') + + summary({ + 'Plugins': plugin_names, + '(A)GPL license allowed': gpl_allowed, + }, list_sep: ', ') endif diff --git a/subprojects/gst-plugins-bad/meson_options.txt b/subprojects/gst-plugins-bad/meson_options.txt index f30c9a7fc6..c5f2e8b333 100644 --- a/subprojects/gst-plugins-bad/meson_options.txt +++ b/subprojects/gst-plugins-bad/meson_options.txt @@ -101,10 +101,10 @@ option('decklink', type : 'feature', value : 'auto', description : 'DeckLink aud 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('dts', type : 'feature', value : 'auto', description : 'DTS audio decoder plugin (GPL - only built if gpl option is also enabled!)') 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('faad', type : 'feature', value : 'auto', description : 'Free AAC audio decoder plugin (GPL - only built if gpl option is also enabled!)') 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') @@ -114,7 +114,7 @@ option('gme', type : 'feature', value : 'auto', description : 'libgme gaming con option('gs', type : 'feature', value : 'auto', description : 'Google Cloud Storage source and sink 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('iqa', type : 'feature', value : 'auto', description : 'Image quality assessment plugin (AGPL - only built if gpl option is also enabled!)') 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') @@ -126,8 +126,8 @@ option('lv2', type : 'feature', value : 'auto', description : 'LV2 audio plugin option('mediafoundation', type : 'feature', value : 'auto', description : 'Microsoft Media Foundation plugin') option('microdns', type : 'feature', value : 'auto', description : 'libmicrodns-based device provider') option('modplug', type : 'feature', value : 'auto', description : 'ModPlug audio decoder plugin') -option('mpeg2enc', type : 'feature', value : 'auto', description : 'mpeg2enc video encoder plugin') -option('mplex', type : 'feature', value : 'auto', description : 'mplex audio/video multiplexer plugin') +option('mpeg2enc', type : 'feature', value : 'auto', description : 'mpeg2enc video encoder plugin (GPL - only built if gpl option is also enabled!)') +option('mplex', type : 'feature', value : 'auto', description : 'mplex audio/video multiplexer plugin (GPL - only built if gpl option is also enabled!)') option('msdk', type : 'feature', value : 'auto', description : 'Intel Media SDK video encoder/decoder plugin') option('musepack', type : 'feature', value : 'auto', description : 'libmpcdec Musepack decoder plugin') option('neon', type : 'feature', value : 'auto', description : 'NEON HTTP source plugin') @@ -141,7 +141,7 @@ option('openmpt', type : 'feature', value : 'auto', description : 'OpenMPT modul option('openni2', type : 'feature', value : 'auto', description : 'OpenNI2 library plugin') option('opensles', type : 'feature', value : 'auto', description : 'OpenSL ES audio source/sink plugin') option('opus', type : 'feature', value : 'auto', description : 'OPUS audio parser plugin') -option('resindvd', type : 'feature', value : 'auto', description : 'Resin DVD playback plugin') +option('resindvd', type : 'feature', value : 'auto', description : 'Resin DVD playback plugin (GPL - only built if gpl option is also enabled!)') 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') @@ -171,7 +171,7 @@ option('webrtcdsp', type : 'feature', value : 'auto', description : 'Plugin with option('wildmidi', type : 'feature', value : 'auto', description : 'WildMidi midi soft synth plugin') option('winks', type : 'feature', value : 'auto', description : 'Windows Kernel Streaming video source plugin') 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('x265', type : 'feature', value : 'auto', description : 'HEVC/H.265 video encoder plugin (GPL - only built if gpl option is also enabled!)') option('zbar', type : 'feature', value : 'auto', description : 'Barcode image scanner plugin using zbar library') option('zxing', type : 'feature', value : 'auto', description : 'Barcode image scanner plugin using zxing-cpp library') option('wpe', type : 'feature', value : 'auto', description : 'WPE Web browser plugin') @@ -192,6 +192,10 @@ option('sctp-internal-usrsctp', type: 'feature', value : 'enabled', option('mfx_api', type : 'combo', choices : ['MSDK', 'oneVPL', 'auto'], value : 'auto', description : 'Select MFX API to build against') +# License-related feature options +option('gpl', type: 'feature', value: 'auto', yield: true, # FIXME: disable by default + description: 'Allow build plugins that have (A)GPL-licensed dependencies') + # Common feature options option('examples', type : 'feature', value : 'auto', yield : true) option('tests', type : 'feature', value : 'auto', yield : true) diff --git a/subprojects/gst-plugins-ugly/ext/a52dec/meson.build b/subprojects/gst-plugins-ugly/ext/a52dec/meson.build index 843bef0910..68908a7e7f 100644 --- a/subprojects/gst-plugins-ugly/ext/a52dec/meson.build +++ b/subprojects/gst-plugins-ugly/ext/a52dec/meson.build @@ -1,22 +1,24 @@ -if get_option('a52dec').disabled() - subdir_done() -endif +a52dec_opt = get_option('a52dec').require(gpl_allowed, error_message: ''' + Plugin a52dec explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') a52_dep = cc.find_library('a52', required : get_option('a52dec')) -have_a52_h = cc.has_header_symbol('a52dec/a52.h', 'a52_init', prefix : '#include ') -if not have_a52_h and get_option('a52dec').enabled() - error('a52dec plugin enabled but a52.h not found') -endif +if a52_dep.found() + have_a52_h = cc.has_header_symbol('a52dec/a52.h', 'a52_init', prefix : '#include ') -if a52_dep.found() and have_a52_h - a52dec = library('gsta52dec', - 'gsta52dec.c', - c_args : ugly_args, - include_directories : [configinc], - dependencies : [gstaudio_dep, orc_dep, a52_dep], - install : true, - install_dir : plugins_install_dir, - ) - pkgconfig.generate(a52dec, install_dir : plugins_pkgconfig_install_dir) - plugins += [a52dec] + if have_a52_h + a52dec = library('gsta52dec', + 'gsta52dec.c', + c_args : ugly_args, + include_directories : [configinc], + dependencies : [gstaudio_dep, orc_dep, a52_dep], + install : true, + install_dir : plugins_install_dir, + ) + pkgconfig.generate(a52dec, install_dir : plugins_pkgconfig_install_dir) + plugins += [a52dec] + elif a52dec_opt.enabled() + error('a52dec plugin enabled but a52.h not found') + endif endif diff --git a/subprojects/gst-plugins-ugly/ext/cdio/meson.build b/subprojects/gst-plugins-ugly/ext/cdio/meson.build index 054d02627c..4b21e36012 100644 --- a/subprojects/gst-plugins-ugly/ext/cdio/meson.build +++ b/subprojects/gst-plugins-ugly/ext/cdio/meson.build @@ -1,4 +1,9 @@ -cdio_dep = dependency('libcdio', version : '>= 0.76', required : get_option('cdio')) +cdio_opt = get_option('cdio').require(gpl_allowed, error_message: ''' + Plugin cdio explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +cdio_dep = dependency('libcdio', version : '>= 0.76', required : cdio_opt) if cdio_dep.found() cdio = library('gstcdio', diff --git a/subprojects/gst-plugins-ugly/ext/dvdread/meson.build b/subprojects/gst-plugins-ugly/ext/dvdread/meson.build index f075d8462b..a1cbfdcb38 100644 --- a/subprojects/gst-plugins-ugly/ext/dvdread/meson.build +++ b/subprojects/gst-plugins-ugly/ext/dvdread/meson.build @@ -1,4 +1,9 @@ -dvdread_dep = dependency('dvdread', version : '>= 0.5.0', required : get_option('dvdread')) +dvdread_opt = get_option('dvdread').require(gpl_allowed, error_message: ''' + Plugin dvdread explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +dvdread_dep = dependency('dvdread', version : '>= 0.5.0', required : dvdread_opt) if gmodule_dep.found() and dvdread_dep.found() dvdread = library('gstdvdread', diff --git a/subprojects/gst-plugins-ugly/ext/mpeg2dec/meson.build b/subprojects/gst-plugins-ugly/ext/mpeg2dec/meson.build index aa5262ac59..77d3ba057b 100644 --- a/subprojects/gst-plugins-ugly/ext/mpeg2dec/meson.build +++ b/subprojects/gst-plugins-ugly/ext/mpeg2dec/meson.build @@ -1,4 +1,9 @@ -mpeg2_dep = dependency('libmpeg2', version : '>= 0.4.0', required : get_option('mpeg2dec')) +mpeg2dec_opt = get_option('mpeg2dec').require(gpl_allowed, error_message: ''' + Plugin mpeg2dec explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + +mpeg2_dep = dependency('libmpeg2', version : '>= 0.4.0', required : mpeg2dec_opt) if mpeg2_dep.found() mpeg2dec = library('gstmpeg2dec', diff --git a/subprojects/gst-plugins-ugly/ext/sidplay/meson.build b/subprojects/gst-plugins-ugly/ext/sidplay/meson.build index 6310652f36..bc3bc77849 100644 --- a/subprojects/gst-plugins-ugly/ext/sidplay/meson.build +++ b/subprojects/gst-plugins-ugly/ext/sidplay/meson.build @@ -1,7 +1,7 @@ -sidplay_option = get_option('sidplay') -if sidplay_option.disabled() - subdir_done() -endif +sidplay_option = get_option('sidplay').require(gpl_allowed, error_message: ''' + Plugin sidplay explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') if not add_languages('cpp', native: false, required: sidplay_option) subdir_done() diff --git a/subprojects/gst-plugins-ugly/ext/x264/meson.build b/subprojects/gst-plugins-ugly/ext/x264/meson.build index fdbfeebce5..7fe65f88ee 100644 --- a/subprojects/gst-plugins-ugly/ext/x264/meson.build +++ b/subprojects/gst-plugins-ugly/ext/x264/meson.build @@ -1,9 +1,14 @@ +x264_opt = get_option('x264').require(gpl_allowed, error_message: ''' + Plugin x264 explicitly required via options but GPL-licensed plugins disabled via options. + Pass option -Dgpl=enabled to Meson to allow GPL-licensed plugins to be built. + ''') + x264_sources = [ 'gstx264enc.c', 'gstencoderbitrateprofilemanager.c', ] -x264_dep = dependency('x264', required : get_option('x264'), +x264_dep = dependency('x264', required : x264_opt, fallback: ['x264', 'libx264_dep']) if x264_dep.found() diff --git a/subprojects/gst-plugins-ugly/meson.build b/subprojects/gst-plugins-ugly/meson.build index 1392d054a5..ac19511ea4 100644 --- a/subprojects/gst-plugins-ugly/meson.build +++ b/subprojects/gst-plugins-ugly/meson.build @@ -271,7 +271,10 @@ if get_option('default_library') == 'shared' plugins_pkgconfig_install_dir = disabler() endif +gpl_allowed = get_option('gpl').allowed() + python3 = import('python').find_installation() + subdir('gst') subdir('ext') subdir('tests') @@ -312,5 +315,8 @@ if meson.version().version_compare('>= 0.54') plugin_names += [plugin.name()] endif endforeach - summary({'Plugins':plugin_names}, list_sep: ', ') + summary({ + 'Plugins': plugin_names, + '(A)GPL license allowed': gpl_allowed, + }, list_sep: ', ') endif diff --git a/subprojects/gst-plugins-ugly/meson_options.txt b/subprojects/gst-plugins-ugly/meson_options.txt index 0b59d01a61..74c311578a 100644 --- a/subprojects/gst-plugins-ugly/meson_options.txt +++ b/subprojects/gst-plugins-ugly/meson_options.txt @@ -9,14 +9,18 @@ option('realmedia', type : 'feature', value : 'auto') option('xingmux', type : 'feature', value : 'auto') # Feature options for plugins that need external deps -option('a52dec', type : 'feature', value : 'auto', description : 'Dolby Digital (AC-3) audio decoder plugin') +option('a52dec', type : 'feature', value : 'auto', description : 'Dolby Digital (AC-3) audio decoder plugin based on liba52 (GPL - only built if gpl option is also enabled!)') option('amrnb', type : 'feature', value : 'auto', description : 'Adaptive Multi-Rate Narrow-Band audio codec plugin') option('amrwbdec', type : 'feature', value : 'auto', description : 'Adaptive Multi-Rate Wide-Band audio decoder plugin') -option('cdio', type : 'feature', value : 'auto', description : 'CD audio source plugin') -option('dvdread', type : 'feature', value : 'auto', description : 'DVD video source plugin') -option('mpeg2dec', type : 'feature', value : 'auto', description : 'MPEG 2 video decoder plugin') -option('sidplay', type : 'feature', value : 'auto', description : 'Commodore 64 audio decoder plugin') -option('x264', type : 'feature', value : 'auto', description : 'H.264 video encoder plugin') +option('cdio', type : 'feature', value : 'auto', description : 'CD audio source plugin based on libcdio (GPL - only built if gpl option is also enabled!)') +option('dvdread', type : 'feature', value : 'auto', description : 'DVD video source plugin based on libdvdread (GPL - only built if gpl option is also enabled!)') +option('mpeg2dec', type : 'feature', value : 'auto', description : 'MPEG 2 video decoder plugin based on libmpeg2 (GPL - only built if gpl option is also enabled!)') +option('sidplay', type : 'feature', value : 'auto', description : 'Commodore 64 audio decoder plugin based on libsidplay (GPL - only built if gpl option is also enabled!)') +option('x264', type : 'feature', value : 'auto', description : 'H.264 video encoder plugin based on libx264 (GPL - only built if gpl option is also enabled!)') + +# License-related feature options +option('gpl', type: 'feature', value: 'auto', yield: true, # FIXME: disable by default + description: 'Allow build plugins that have GPL-licensed dependencies') # Common feature options option('nls', type : 'feature', value : 'auto', yield: true, @@ -36,4 +40,4 @@ option('package-name', type : 'string', yield : true, option('package-origin', type : 'string', value : 'Unknown package origin', yield: true, description : 'package origin URL to use in plugins') option('doc', type : 'feature', value : 'auto', yield: true, - description: 'Enable documentation.') \ No newline at end of file + description: 'Enable documentation.')