Merging gst-plugins-ugly
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-ugly / docs / meson.build
1 build_hotdoc = false
2
3 required_hotdoc_extensions = ['gst-extension']
4 plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json')
5 if gst_dep.type_name() == 'internal'
6     gst_proj = subproject('gstreamer')
7     plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator')
8 else
9     plugins_cache_generator = find_program(join_paths(gst_dep.get_pkgconfig_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'),
10         required: false)
11 endif
12
13 if plugins.length() == 0
14     message('All ugly plugins have been disabled')
15 elif plugins_cache_generator.found()
16     plugins_doc_dep = custom_target('ugly-plugins-doc-cache',
17         command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
18         input: plugins,
19         output: 'gst_plugins_cache.json',
20         build_always_stale: true,
21     )
22 else
23     warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
24 endif
25
26 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
27 if not hotdoc_p.found()
28     message('Hotdoc not found, not building the documentation')
29     subdir_done()
30 endif
31
32 hotdoc_req = '>= 0.11.0'
33 hotdoc_version = run_command(hotdoc_p, '--version').stdout()
34 if not hotdoc_version.version_compare(hotdoc_req)
35     if get_option('doc').enabled()
36         error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
37     else
38         message('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
39         subdir_done()
40     endif
41 endif
42
43 hotdoc = import('hotdoc')
44 foreach extension: required_hotdoc_extensions
45     if not hotdoc.has_extensions(extension)
46         if get_option('doc').enabled()
47             error('Documentation enabled but @0@ missing'.format(extension))
48         endif
49
50         message('@0@ extension not found, not building documentation'.format(extension))
51         subdir_done()
52     endif
53 endforeach
54
55 build_hotdoc = true
56 docconf = configuration_data()
57 docconf.set('GST_API_VERSION', api_version)
58
59 configure_file(input : 'gst_api_version.in',
60                output : 'gst_api_version.md',
61                configuration : docconf)
62
63 root_rel = '..'
64 excludes = []
65 foreach f: []
66     excludes += [join_paths(meson.current_source_dir(), root_rel, '..', f)]
67 endforeach
68
69 libs_doc = []
70 plugins_doc = []
71 list_plugin_res = run_command(python3, '-c',
72 '''
73 import sys
74 import json
75
76 with open("@0@") as f:
77         print(':'.join(json.load(f).keys()), end='')
78 '''.format(plugins_cache))
79
80 assert(list_plugin_res.returncode() == 0,
81   'Could not list plugins from @0@'.format(plugins_cache))
82
83 foreach plugin_name: list_plugin_res.stdout().split(':')
84     plugins_doc += [hotdoc.generate_doc(plugin_name,
85         project_version: api_version,
86         sitemap: 'sitemap.txt',
87         index: 'index.md',
88         gst_index: 'index.md',
89         gst_smart_index: true,
90         gst_c_sources: [
91             join_paths(root_rel, 'sys/*/*.[ch]'),
92             join_paths(root_rel, 'ext/*/*.[ch]'),
93             join_paths(root_rel, 'gst/*/*.[ch]'),
94         ],
95         gst_c_source_filters: excludes,
96         dependencies: [gst_dep, plugins],
97         gst_order_generated_subpages: true,
98         disable_incremental_build: true,
99         gst_cache_file: plugins_cache,
100         gst_plugin_name: plugin_name,
101     )]
102 endforeach