meson: Rename plugins list and make them "dependency" objects
authorThibault Saunier <tsaunier@igalia.com>
Wed, 31 Aug 2022 22:44:14 +0000 (18:44 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 1 Sep 2022 21:17:35 +0000 (21:17 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>

meson.build
subprojects/gst-devtools/meson.build
subprojects/gst-editing-services/meson.build
subprojects/gst-libav/meson.build
subprojects/gst-plugins-bad/meson.build
subprojects/gst-plugins-base/meson.build
subprojects/gst-plugins-good/meson.build
subprojects/gst-plugins-ugly/meson.build
subprojects/gst-rtsp-server/meson.build
subprojects/gstreamer-vaapi/meson.build
subprojects/gstreamer/meson.build

index e338a11..7cb37f9 100644 (file)
@@ -173,8 +173,17 @@ foreach sp : subprojects
   endif
 
   if subproj.found()
-    plugins = subproj.get_variable('plugins', [])
+    plugins = subproj.get_variable('gst_plugins', [])
     all_plugins += plugins
+    if subproj.get_variable('gst_plugins', []).length() != subproj.get_variable('plugins', plugins).length()
+      warning(f'DEPRECATED use of the `plugins` variable in @project_name@.')
+      warning('The variable should now be called `gst_plugins` and use:')
+      warning('`declare_dependency( link_with: <plugin_target>, variable: {\'full_path\': <plugin_target>.full_path()})` instead')
+      foreach plugin: subproj.get_variable('plugins', [])
+        all_plugins += [declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})]
+      endforeach
+    endif
+
     all_libraries += subproj.get_variable('libraries', [])
     if not get_option('tools').disabled()
       all_tools += subproj.get_variable('gst_tools', {})
@@ -185,9 +194,7 @@ foreach sp : subprojects
     subprojects_names += [project_name]
 
     if not meson.is_cross_build() and build_infos.get('build-hotdoc', false)
-      if plugins.length() > 0
-        plugins_doc_caches += [subproj.get_variable('plugins_doc_dep', [])]
-      endif
+      plugins_doc_caches += [subproj.get_variable('plugins_doc_dep', [])]
       if documented_projects != ''
         documented_projects += ','
       endif
@@ -252,10 +259,14 @@ endif
 
 all_plugins_paths = []
 all_plugins_dirs = []
+plugins_names = []
 foreach plugin: all_plugins
-  all_plugins_paths += plugin.full_path()
-  all_plugins_dirs += fs.parent(plugin.full_path())
+  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)
@@ -295,10 +306,6 @@ if building_full
   gst_c_args = ['-DHAVE_CONFIG_H']
 
   # Generate a .c file which declare and register all built plugins
-  plugins_names = []
-  foreach plugin: all_plugins
-    plugins_names += plugin.full_path()
-  endforeach
   all_plugin_names = ';'.join(plugins_names)
 
   static_plugins = get_option('gst-full-plugins')
@@ -380,10 +387,9 @@ if building_full
   # Build both shared and static library
   gstfull = both_libraries('gstreamer-full-1.0',
     init_static_plugins_c,
-    link_with : all_plugins,
     link_args: gstfull_link_args,
     link_whole : exposed_libs,
-    dependencies : incdir_deps + glib_deps,
+    dependencies : [incdir_deps, glib_deps, all_plugins],
     link_depends : link_deps,
     install : true,
   )
index d789d25..341c78a 100644 (file)
@@ -167,3 +167,20 @@ if not get_option('debug_viewer').disabled()
   subdir('debug-viewer')
 endif
 subdir('docs')
+
+plugin_names = []
+gst_plugins = []
+foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
+  if plugin.name().startswith('gst')
+    plugin_names += [plugin.name().substring(3)]
+  else
+    plugin_names += [plugin.name()]
+  endif
+endforeach
+
+summary({
+    'Plugins': plugin_names,
+}, list_sep: ', ')
index 996bcf0..94c0d63 100644 (file)
@@ -337,7 +337,11 @@ endif
 configure_file(output: 'config.h', configuration: cdata)
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else
index c4b400f..e2a3fa5 100644 (file)
@@ -229,3 +229,11 @@ if gst_version_nano == 0
 endif
 
 configure_file(output: 'config.h', configuration: cdata)
+
+gst_plugins = []
+foreach plugin: plugins
+  pkgconfig.generate(plugin, install_dir: plugins_pkgconfig_install_dir)
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
+endforeach
index 681bfe9..132c0d4 100644 (file)
@@ -595,7 +595,11 @@ configure_file(output : 'config.h', configuration : cdata)
 subdir('docs')
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else
index 267bb3c..6cd7360 100644 (file)
@@ -545,7 +545,11 @@ endif
 configure_file(output : 'config.h', configuration : core_conf)
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else
index ac658b2..8490cfc 100644 (file)
@@ -510,7 +510,11 @@ endif
 configure_file(output : 'config.h', configuration : cdata)
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else
index 6ca84bb..0e8e4b5 100644 (file)
@@ -321,7 +321,11 @@ endif
 configure_file(output : 'config.h', configuration : cdata)
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else
index 7eee693..afbf5d3 100644 (file)
@@ -212,3 +212,20 @@ if gst_version_nano == 0
 endif
 
 configure_file(output: 'config.h', configuration: cdata)
+
+plugin_names = []
+gst_plugins = []
+foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
+  if plugin.name().startswith('gst')
+    plugin_names += [plugin.name().substring(3)]
+  else
+    plugin_names += [plugin.name()]
+  endif
+endforeach
+
+summary({
+    'Plugins': plugin_names,
+}, list_sep: ', ')
index 1d445cc..101d4ce 100644 (file)
@@ -236,3 +236,23 @@ if gmodule_dep.version().version_compare('< 2.67.4')
 endif
 
 configure_file(output: 'config.h', configuration: cdata)
+
+pkgconfig = import('pkgconfig')
+plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
+
+plugin_names = []
+gst_plugins = []
+foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
+  if plugin.name().startswith('gst')
+    plugin_names += [plugin.name().substring(3)]
+  else
+    plugin_names += [plugin.name()]
+  endif
+endforeach
+
+summary({
+    'Plugins': plugin_names,
+}, list_sep: ', ')
index 06e9846..416fbdd 100644 (file)
@@ -653,7 +653,11 @@ configure_file(output : 'config.h', configuration : cdata)
 install_data('gst-element-check-1.0.m4', install_dir : join_paths(get_option('datadir'), 'aclocal'))
 
 plugin_names = []
+gst_plugins = []
 foreach plugin: plugins
+  dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
+  meson.override_dependency(plugin.name(), dep)
+  gst_plugins += [dep]
   if plugin.name().startswith('gst')
     plugin_names += [plugin.name().substring(3)]
   else