tools: Add support for building gstreamer tools against gst-full

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1581>
This commit is contained in:
Thibault Saunier 2021-09-11 12:17:56 -03:00 committed by GStreamer Marge Bot
parent 2a30f1038a
commit 2952a73f40
12 changed files with 229 additions and 131 deletions

View file

@ -7,6 +7,7 @@ project('gstreamer-full', 'c',
# when it's no longer necessary.
'cpp_std=c++14'])
apiversion = '1.0'
gst_version = '>= @0@'.format(meson.project_version())
build_system = build_machine.system()
@ -76,9 +77,16 @@ if not meson.is_subproject() and cc.get_id() == 'msvc'
language: ['c', 'cpp'])
endif
building_full = get_option('default_library') == 'static'
tools_option = 'tools=auto'
if building_full and not get_option('tools').disabled()
# Do not build subprojects tools when we build them against gst-full
tools_option = 'tools=disabled'
endif
# Ordered list of subprojects (dict has no ordering guarantees)
subprojects = [
['gstreamer', {'build-hotdoc': true}],
['gstreamer', {'build-hotdoc': true, 'subproject_options': [tools_option]}],
['gst-plugins-base', {'option': get_option('base'), 'build-hotdoc': true}],
['gst-plugins-good', {'option': get_option('good'), 'build-hotdoc': true}],
['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}],
@ -86,9 +94,9 @@ subprojects = [
['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true}],
['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true}],
['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true}],
['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true }],
['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true, 'subproject_options': [tools_option]}],
['gst-integration-testsuites', { 'option': get_option('devtools') }],
['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true}],
['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'subproject_options': [tools_option]}],
['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true}],
['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true}],
['gstreamer-sharp', { 'option': get_option('sharp') }],
@ -126,6 +134,7 @@ subprojects_names = []
plugins_doc_caches = []
orc_update_targets = []
all_plugins = []
all_tools = {}
# Using a list and not a dict to keep the ordering to build the chain of `gir`
# dependencies
all_libraries = []
@ -136,22 +145,24 @@ foreach sp : subprojects
sysdep = build_infos.get('sysdep', '')
sysdep_version = build_infos.get('sysdep_version', '')
match_gst_version = build_infos.get('match_gst_version', true)
default_options = build_infos.get('subproject_options', [])
if match_gst_version
subproj = subproject(project_name, version: gst_version, required: is_required)
subproj = subproject(project_name, version: gst_version, required: is_required, default_options: default_options)
elif sysdep != ''
sysdep_dep = dependency(sysdep, version: sysdep_version, required: false)
sysdep_dep = dependency(sysdep, version: sysdep_version, required: false, default_options: default_options)
if not sysdep_dep.found()
subproj = subproject(project_name, required: is_required)
subproj = subproject(project_name, required: is_required, default_options: default_options)
endif
else
subproj = subproject(project_name, required: is_required)
subproj = subproject(project_name, required: is_required, default_options: default_options)
endif
if subproj.found()
plugins = subproj.get_variable('plugins', [])
all_plugins += plugins
all_libraries += subproj.get_variable('libraries', [])
all_tools += subproj.get_variable('gst_tools', {})
orc_update_targets += subproj.get_variable('orc_update_targets', [])
@ -250,7 +261,16 @@ configure_file(
all_plugins_paths]
)
if get_option('default_library') == 'static'
if building_full
cdata = configuration_data()
cdata.set_quoted('GST_API_VERSION', apiversion)
cdata.set_quoted('GETTEXT_PACKAGE', 'gstreamer-full-1.0')
cdata.set_quoted('PACKAGE_VERSION', gst_version)
cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
configure_file(output : 'config.h', configuration : cdata)
configinc = include_directories('.')
gst_c_args = ['-DHAVE_CONFIG_H']
# Generate a .c file which declare and register all built plugins
plugins_names = []
foreach plugin: all_plugins
@ -279,6 +299,7 @@ if get_option('default_library') == 'static'
# Get a list of libraries that needs to be exposed in the ABI.
exposed_libs = []
exposed_deps = []
exposed_girs = []
incdir_deps = []
wanted_libs = ['gstreamer-1.0'] + get_option('gst-full-libraries')
@ -290,6 +311,7 @@ if get_option('default_library') == 'static'
if pkg_name in wanted_libs or all_libs
if lib_def.has_key('lib')
exposed_deps += dependency(pkg_name)
incdir_deps += dependency(pkg_name).partial_dependency(includes: true, sources: true)
exposed_libs += [lib_def['lib']]
endif
@ -375,6 +397,33 @@ if get_option('default_library') == 'static'
libraries_private: gst_full_libs_private,
subdirs : 'gstreamer-1.0')
meson.override_dependency('gstreamer-full-1.0', gst_full_dep)
if not get_option('tools').disabled()
foreach tool, data: all_tools
exe_name = '@0@-@1@'.format(tool, apiversion)
extra_args = data.get('extra_c_args', [])
sources = data.get('files')
deps = []
foreach d : data.get('deps', [])
if d not in exposed_deps
deps += d
endif
endforeach
executable(exe_name,
sources,
install: true,
include_directories : [configinc],
dependencies : [gst_full_dep] + deps,
c_args: extra_args + gst_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)],
)
if data.has_key('man_page')
install_man(data.get('man_page'))
endif
endforeach
endif
endif
message('Building subprojects: ' + ', '.join(subprojects_names))
@ -402,5 +451,5 @@ if orc_subproject.found() and orc_update_targets.length() > 0
endif
summary({
'gstreamer-full': get_option('default_library') == 'static',
'gstreamer-full': building_full,
}, section: 'Build options', bool_yn: true, list_sep: ' ')

View file

@ -16,6 +16,7 @@ option('rs', type : 'feature', value : 'disabled')
option('gst-examples', type : 'feature', value : 'auto', description : 'Build gst-examples')
option('tls', type : 'feature', value : 'auto', description : 'TLS support using glib-networking')
option('qt5', type : 'feature', value : 'auto', description : 'Qt5 Support')
option('tools', type : 'feature', value : 'auto', yield : true, description : 'Build command line tools')
# Other options
option('custom_subprojects', type : 'string', value : '', description : 'Comma-separated project names')
@ -46,3 +47,6 @@ option('nls', type : 'feature', value : 'auto', description : 'Enable native lan
option('orc', type : 'feature', value : 'auto', description : 'Enable Optimized Inner Loop Runtime Compiler')
option('doc', type : 'feature', value : 'auto', description : 'Generate API documentation with hotdoc')
option('gtk_doc', type : 'feature', value : 'disabled', description : 'Generate API documentation with gtk-doc')
option('package-origin', type : 'string', value : 'Unknown package origin', yield : true,
description : 'package origin URL to use in plugins')

View file

@ -13,3 +13,4 @@ option('nls', type : 'feature', value : 'auto', yield: true,
description : 'Enable native language support (translations)')
option('doc', type : 'feature', value : 'auto', yield: true,
description: 'Enable documentation.')
option('tools', type : 'feature', value : 'auto', yield : true)

View file

@ -1,57 +1,68 @@
executable('gst-validate-' + apiversion,
'gst-validate.c',
install: true,
include_directories : inc_dirs,
dependencies : validate_dep,
c_args : [gst_c_args] + ['-DG_LOG_DOMAIN="gst-validate-@0@"'.format(apiversion)],
)
gst_tools = {
'gst-validate': {
'files': files('gst-validate.c'),
'deps': [validate_dep, gio_dep],
},
'gst-validate-media-check': {
'files': files('gst-validate-media-check.c'),
'deps': [validate_dep, gio_dep],
},
}
gst_transcoder_dep = dependency('gstreamer-transcoder-' + apiversion, version : gst_req,
fallback : ['gst-plugins-bad', 'gst_transcoder_dep'], required: false)
if gst_transcoder_dep.found()
executable('gst-validate-transcoding-' + apiversion,
'gst-validate-transcoding.c',
install: true,
include_directories : inc_dirs,
dependencies : [validate_dep, gst_transcoder_dep],
c_args : [gst_c_args] + ['-DG_LOG_DOMAIN="gst-validate-transcoding-@0@"'.format(apiversion)],
)
if validate_video_dep.found()
gst_tools += {
'gst-validate-images-check': {
'files': files('gst-validate-images-check.c'),
'deps': [validate_dep, validate_video_dep, gio_dep],
},
}
else
warning('Can not build gst-validate-transcoding-' + apiversion)
message('Can not build gst-validate-images-check' + apiversion)
endif
executable('gst-validate-media-check-' + apiversion,
'gst-validate-media-check.c',
install: true,
include_directories : inc_dirs,
dependencies : validate_dep,
c_args : [gst_c_args] + ['-DG_LOG_DOMAIN="gst-validate-media-check-@0@"'.format(apiversion)],
)
rtsp_server_dep = dependency('gstreamer-rtsp-server-' + apiversion,
fallback: ['gst-rtsp-server', 'gst_rtsp_server_dep'],
version : gst_req,
required: false)
if rtsp_server_dep.found()
executable('gst-validate-rtsp-server-' + apiversion,
'gst-validate-rtsp-server.c',
install: true,
include_directories: inc_dirs,
dependencies : [rtsp_server_dep, validate_dep],
c_args: [gst_c_args] + ['-DG_LOG_DOMAIN="gst-validate-rtsp-server-@0@"'.format(apiversion)],
)
gst_tools += {'gst-validate-rtsp-server': {
'files': files('gst-validate-rtsp-server.c'),
'deps': [validate_dep, rtsp_server_dep, gio_dep],
}
}
else
message('Can not build gst-validate-rtsp-server-' + apiversion)
endif
if validate_video_dep.found()
executable('gst-validate-images-check-' + apiversion,
'gst-validate-images-check.c',
install: true,
include_directories : inc_dirs,
dependencies : [validate_dep, validate_video_dep],
c_args : [gst_c_args] + ['-DG_LOG_DOMAIN="gst-validate-images-check-@0@"'.format(apiversion)]
)
gst_transcoder_dep = dependency('gstreamer-transcoder-' + apiversion, version : gst_req,
fallback : ['gst-plugins-bad', 'gst_transcoder_dep'], required: false)
if gst_transcoder_dep.found()
gst_tools += {'gst-validate-transcoding': {
'files': files('gst-validate-transcoding.c'),
'deps': [validate_dep, gst_transcoder_dep, gio_dep],
}
}
else
message('Can not build gst-validate-transcoding-' + apiversion)
endif
if not get_option('tools').disabled()
foreach tool, data: gst_tools
if data.has_key('config_data')
else
exe_name = '@0@-@1@'.format(tool, apiversion)
executable(
exe_name,
data.get('files'),
install: true,
include_directories : inc_dirs,
dependencies : data.get('deps'),
c_args : [gst_c_args] + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)],
)
endif
endforeach
endif
tmpconf = configuration_data()

View file

@ -271,9 +271,8 @@ libraries = []
subdir('ges')
subdir('plugins')
if not get_option('tools').disabled()
subdir('tools')
endif
subdir('tools')
subdir('tests')
if not get_option('examples').disabled()
subdir('examples')

View file

@ -6,48 +6,62 @@ if gstvalidate_dep.found()
ges_tool_args += ['-DGST_USE_UNSTABLE_API']
endif
ges_launch = executable('ges-launch-@0@'.format(apiversion),
'ges-validate.c', 'ges-launch.c', 'ges-launcher.c', 'utils.c', 'ges-launcher-kb.c',
c_args : [ges_tool_args] + ['-DG_LOG_DOMAIN="ges-launch-@0@"'.format(apiversion)],
dependencies : deps,
install: true
)
install_man('ges-launch-1.0.1')
ges_launch_files = files('ges-validate.c', 'ges-launch.c', 'ges-launcher.c', 'utils.c', 'ges-launcher-kb.c')
man_page = files('ges-launch-1.0.1')
gst_tools = {'ges-launch':
{
'files': ges_launch_files,
'deps': deps,
'extra_c_args': ges_tool_args,
'man_page': man_page,
}
}
# bash completion
bashcomp_option = get_option('bash-completion')
bashcomp_dep = dependency('bash-completion', version : '>= 2.0', required : bashcomp_option)
bash_completions_dir = ''
bash_helpers_dir = ''
if not get_option('tools').disabled()
ges_launch = executable('ges-launch-@0@'.format(apiversion),
ges_launch_files,
c_args : [ges_tool_args] + ['-DG_LOG_DOMAIN="ges-launch-@0@"'.format(apiversion)],
dependencies : deps,
install: true
)
bashcomp_found = false
if bashcomp_dep.found()
bashcomp_found = true
bashcomp_dir_override = bashcomp_dep.version().version_compare('>= 2.10') ? ['datadir', datadir] : ['prefix', prefix]
bash_completions_dir = bashcomp_dep.get_variable('completionsdir', pkgconfig_define: bashcomp_dir_override)
if bash_completions_dir == ''
msg = 'Found bash-completion but the .pc file did not set \'completionsdir\'.'
if bashcomp_option.enabled()
error(msg)
else
message(msg)
install_man(man_page)
# bash completion
bashcomp_option = get_option('bash-completion')
bashcomp_dep = dependency('bash-completion', version : '>= 2.0', required : bashcomp_option)
bash_completions_dir = ''
bash_helpers_dir = ''
bashcomp_found = false
if bashcomp_dep.found()
bashcomp_found = true
bashcomp_dir_override = bashcomp_dep.version().version_compare('>= 2.10') ? ['datadir', datadir] : ['prefix', prefix]
bash_completions_dir = bashcomp_dep.get_variable('completionsdir', pkgconfig_define: bashcomp_dir_override)
if bash_completions_dir == ''
msg = 'Found bash-completion but the .pc file did not set \'completionsdir\'.'
if bashcomp_option.enabled()
error(msg)
else
message(msg)
endif
bashcomp_found = false
endif
bashcomp_found = false
endif
bash_helpers_dir = bashcomp_dep.get_variable('helpersdir', pkgconfig_define: bashcomp_dir_override)
if bash_helpers_dir == ''
msg = 'Found bash-completion, but the .pc file did not set \'helpersdir\'.'
if bashcomp_option.enabled()
error(msg)
else
message(msg)
bash_helpers_dir = bashcomp_dep.get_variable('helpersdir', pkgconfig_define: bashcomp_dir_override)
if bash_helpers_dir == ''
msg = 'Found bash-completion, but the .pc file did not set \'helpersdir\'.'
if bashcomp_option.enabled()
error(msg)
else
message(msg)
endif
bashcomp_found = false
endif
bashcomp_found = false
endif
if bashcomp_found
install_data('../data/completions/ges-launch-1.0', install_dir : bash_completions_dir)
if bashcomp_found
install_data('../data/completions/ges-launch-1.0', install_dir : bash_completions_dir)
endif
endif
endif

View file

@ -477,9 +477,7 @@ subdir('gst-libs')
subdir('gst')
subdir('ext')
subdir('sys')
if not get_option('tools').disabled()
subdir('tools')
endif
subdir('tools')
subdir('tests')
# xgettext is optional (on Windows for instance)

View file

@ -25,29 +25,38 @@ if host_system == 'windows'
endif
endif
executable('gst-device-monitor-@0@'.format(api_version),
'gst-device-monitor.c',
install: true,
c_args : gst_plugins_base_args + ['-DG_LOG_DOMAIN="gst-device-monitor-@0@"'.format(api_version)],
include_directories: [configinc],
dependencies : tool_deps,
)
install_man('gst-device-monitor-@0@.1'.format(api_version))
gst_tools = {
'gst-device-monitor': {
'files': files('gst-device-monitor.c'),
'deps': tool_deps,
'man_page': files('gst-device-monitor-@0@.1'.format(api_version))
},
'gst-discoverer': {
'files': files('gst-discoverer.c'),
'deps': tool_deps,
'man_page': files('gst-discoverer-@0@.1'.format(api_version))
},
'gst-play': {
'files': files('gst-play.c', 'gst-play-kb.c'),
'deps': tool_deps,
'man_page': files('gst-play-@0@.1'.format(api_version))
},
}
executable('gst-discoverer-@0@'.format(api_version),
'gst-discoverer.c',
install: true,
c_args : gst_plugins_base_args + ['-DG_LOG_DOMAIN="gst-discoverer-@0@"'.format(api_version)],
include_directories: [configinc],
dependencies : tool_deps,
)
install_man('gst-discoverer-@0@.1'.format(api_version))
if not get_option('tools').disabled()
foreach tool, data: gst_tools
exe_name = '@0@-@1@'.format(tool, api_version)
executable(exe_name,
data.get('files'),
install: true,
include_directories : [configinc],
dependencies : data.get('deps'),
c_args: data.get('extra_c_args', []) + gst_plugins_base_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)],
)
executable('gst-play-@0@'.format(api_version),
'gst-play.c', 'gst-play-kb.c',
install: true,
c_args : gst_plugins_base_args + ['-DG_LOG_DOMAIN="gst-play-@0@"'.format(api_version)] + extra_args,
include_directories: [configinc],
dependencies : tool_deps + [libm] + extra_deps,
)
install_man('gst-play-@0@.1'.format(api_version))
if data.has_key('man_page')
install_man(data.get('man_page'))
endif
endforeach
endif

View file

@ -2013,6 +2013,6 @@
"package": "gstreamer-vaapi",
"source": "gstreamer-vaapi",
"tracers": {},
"url": "https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues"
"url": "Unknown package origin"
}
}

View file

@ -11,5 +11,5 @@ option('tests', type : 'feature', value : 'auto', yield : true)
option('doc', type : 'feature', value : 'auto', yield: true,
description: 'Enable documentation.')
option('package-origin', type : 'string',
value : 'https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues',
value : 'Unknown package origin',
yield : true, description : 'package origin URL to use in plugins')

View file

@ -610,9 +610,7 @@ libraries = []
subdir('gst')
subdir('libs')
subdir('plugins')
if not get_option('tools').disabled()
subdir('tools')
endif
subdir('tools')
subdir('tests')
subdir('data')
subdir('docs')

View file

@ -1,3 +1,7 @@
# If tools are disabled, we still allow building them against gst-full
# later, so populate the gst_tools dictionary in any case.
gst_tools = {}
tools = ['gst-inspect', 'gst-stats', 'gst-typefind']
extra_launch_dep = []
@ -26,14 +30,25 @@ foreach tool : tools
extra_c_args += extra_launch_arg
endif
executable(exe_name,
src_file,
install: true,
include_directories : [configinc],
dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep] + extra_deps,
c_args: gst_c_args + extra_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)],
)
man_page = files('@0@-1.0.1'.format(tool))
if not get_option('tools').disabled()
executable(exe_name,
src_file,
install: true,
include_directories : [configinc],
dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep] + extra_deps,
c_args: gst_c_args + extra_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(exe_name)],
)
man_page = '@0@-1.0.1'.format(tool)
install_man(man_page)
install_man(man_page)
endif
gst_tools += {tool:
{
'files': files(src_file),
'deps': [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep] + extra_deps,
'extra_c_args': extra_c_args,
'man_page': man_page,
}
}
endforeach