+all_plugins_paths = []
+all_plugins_dirs = []
+plugins_names = []
+foreach plugin: all_plugins
+ plugin_path = plugin.get_variable('full_path')
+ all_plugins_paths += plugin_path
+ all_plugins_dirs += fs.parent(plugin_path)
+ plugins_names += plugin_path
+endforeach
+
+# Work around meson bug: https://github.com/mesonbuild/meson/pull/6770
+pathsep = host_machine.system() == 'windows' ? ';' : ':'
+all_plugins_paths = pathsep.join(all_plugins_paths)
+
+devenv = environment()
+if not building_full
+ devenv.prepend('GST_PLUGIN_PATH', all_plugins_dirs)
+else
+ # Make sure the current build directory is first in PATH so we prefer tools
+ # built here that links on gst-full instead instead of those built in
+ # subprojects.
+ devenv.prepend('PATH', meson.current_build_dir())
+endif
+devenv.set('CURRENT_GST', meson.current_source_dir())
+devenv.set('GST_VERSION', meson.project_version())
+devenv.set('GST_ENV', 'gst-' + meson.project_version())
+devenv.set('GST_REGISTRY', meson.current_build_dir() / 'registry.dat')
+devenv.set('GST_PLUGIN_SYSTEM_PATH', '')
+meson.add_devenv(devenv)
+
+generate_plugins_paths = find_program('scripts/generate_plugins_path.py')
+configure_file(
+ output : 'GstPluginsPath.json',
+ command : [generate_plugins_paths,
+ '@OUTPUT@',
+ all_plugins_paths]
+)
+
+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
+ all_plugin_names = ';'.join(plugins_names)
+
+ static_plugins = get_option('gst-full-plugins')
+ if static_plugins == '*'
+ static_plugins = all_plugin_names
+ endif
+ generate_init_static_plugins = find_program('scripts/generate_init_static_plugins.py')
+ init_static_plugins_c = configure_file(
+ output: 'gstinitstaticplugins.c',
+ command : [generate_init_static_plugins,
+ '-o ' + '@OUTPUT@',
+ '-p ' + static_plugins,
+ '-e ' + get_option('gst-full-elements'),
+ '-t ' + get_option('gst-full-typefind-functions'),
+ '-d ' + get_option('gst-full-device-providers'),
+ '-T ' + get_option('gst-full-dynamic-types'),
+ '--giomodules', ';'.join(giomodules),
+ ]
+ )
+
+ gstfull_link_args = cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions'])
+
+ # 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')
+ all_libs = '*' in wanted_libs
+
+ foreach pkgname_library : all_libraries
+ pkg_name = pkgname_library[0]
+ lib_def = pkgname_library[1]
+
+ 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
+
+ if lib_def.has_key('gir')
+ exposed_girs += lib_def['gir']
+ endif
+ endif
+ endforeach
+
+ # glib and gobject are part of our public API. If we are using glib from the
+ # system then our pkg-config file must require it. If we built it as
+ # subproject then we need to link_whole it.
+ glib_deps = []
+ glib_dep = dependency('glib-2.0')
+ gobject_dep = dependency('gobject-2.0')
+ if gobject_dep.type_name() == 'internal'
+ glib_subproject = subproject('glib')
+ exposed_libs += glib_subproject.get_variable('libglib')
+ exposed_libs += glib_subproject.get_variable('libgobject')
+ incdir_deps += [
+ glib_dep.partial_dependency(includes: true),
+ gobject_dep.partial_dependency(includes: true),
+ ]
+ else
+ glib_deps = [glib_dep, gobject_dep]
+ endif
+
+ link_deps = []
+ if get_option('gst-full-version-script') != ''
+ symbol_map = meson.current_source_dir() / get_option('gst-full-version-script')
+ link_arg = '-Wl,--version-script=' + symbol_map
+ if cc.has_link_argument(link_arg)
+ gstfull_link_args += link_arg
+ link_deps += symbol_map
+ elif cc.get_id() == 'msvc'
+ warning('FIXME: Provide a def file to publish the public symbols')
+ else
+ warning('FIXME: Linker does not support the supplied version script (' + symbol_map + '), please disable the "gst-full-version-script" option')
+ endif
+ endif
+
+ giomodules_deps = []
+ foreach module : giomodules
+ giomodules_deps += dependency(module)
+ endforeach
+
+ # Build both shared and static library
+ gstfull = both_libraries('gstreamer-full-1.0',
+ init_static_plugins_c,
+ link_args: gstfull_link_args,
+ link_whole : exposed_libs,
+ dependencies : [incdir_deps, glib_deps, all_plugins, giomodules_deps],
+ link_depends : link_deps,
+ install : true,
+ )
+
+ gst_full_dep = declare_dependency(link_with: gstfull.get_shared_lib(),
+ dependencies : incdir_deps + glib_deps,
+ include_directories: include_directories('.')
+ )
+
+ gst_full_libs_private = cc.get_supported_link_arguments(['-Wl,--undefined=gst_init_static_plugins'])
+ if gst_full_libs_private == []
+ warning('The compiler does not support `-Wl,--undefined` linker flag. The method `gst_init_static_plugins` might be dropped during the link stage of an application using libgstreamer-full-1.0.a, preventing plugins registration.')
+ endif
+
+ if not get_option('introspection').disabled()
+ built_girs = {}
+ foreach gir: exposed_girs
+ includes = []
+ foreach include: gir.get('includes', [])
+ includes += [built_girs.get(include, include)]
+ endforeach
+
+ gir += {
+ 'includes': includes,
+ 'extra_args': gir.get('extra_args', []) + ['--add-include-path=' + meson.current_build_dir()],
+ 'install': true,
+ }
+ built_girs += {gir.get('namespace') + '-' + gir.get('nsversion'): gnome.generate_gir(gstfull, kwargs: gir)[0]}
+ endforeach
+ endif
+
+ pkgconfig.generate(gstfull,
+ requires: glib_deps,
+ 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')
+ install_tag = data.get('install_tag', 'bin')
+ deps = []
+ foreach d : data.get('deps', [])
+ if d not in exposed_deps
+ deps += d