Skip to content

Commit

Permalink
meson: Add feature options for all plugins
Browse files Browse the repository at this point in the history
GL dependency detection is still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
  • Loading branch information
nirbheek committed Jul 27, 2018
1 parent c2a7c93 commit eadedc6
Show file tree
Hide file tree
Showing 21 changed files with 120 additions and 88 deletions.
2 changes: 1 addition & 1 deletion docs/libs/meson.build
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion ext/alsa/meson.build
Expand Up @@ -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',
Expand Down
7 changes: 4 additions & 3 deletions ext/cdparanoia/meson.build
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ext/libvisual/meson.build
Expand Up @@ -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'))
Expand Down
5 changes: 3 additions & 2 deletions 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')
Expand Down
2 changes: 1 addition & 1 deletion ext/ogg/meson.build
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion ext/opus/meson.build
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion ext/pango/meson.build
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions ext/theora/meson.build
Expand Up @@ -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 = []

Expand Down
6 changes: 3 additions & 3 deletions ext/vorbis/meson.build
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions gst-libs/gst/meson.build
Expand Up @@ -9,4 +9,5 @@ subdir('pbutils')
subdir('riff')
subdir('app')
subdir('allocators')
# FIXME: gl deps are automagic
subdir('gl')
8 changes: 6 additions & 2 deletions gst-libs/gst/rtsp/meson.build
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions gst-libs/gst/tag/meson.build
Expand Up @@ -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,
Expand Down
28 changes: 8 additions & 20 deletions 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
70 changes: 35 additions & 35 deletions 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' ])

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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'])

# 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)
giounix_dep = dependency('gio-unix-2.0', version : glib_req, required : host_system != 'windows',
fallback: ['glib', 'libgiounix_dep'])

# 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',
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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') + \
Expand All @@ -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')
Expand Down
50 changes: 42 additions & 8 deletions meson_options.txt
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion 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')
Expand Down
2 changes: 1 addition & 1 deletion sys/xvimage/meson.build
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion 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',
Expand Down

0 comments on commit eadedc6

Please sign in to comment.