base:subparse: fix invalid mem access issue
[platform/upstream/gstreamer.git] / subprojects / gstreamer / docs / meson.build
1 build_hotdoc = false
2 if meson.is_cross_build()
3     if get_option('doc').enabled()
4         error('Documentation enabled but building the doc while cross building is not supported yet.')
5     endif
6
7     message('Documentation not built as building it while cross building is not supported yet.')
8     subdir_done()
9 endif
10
11 if static_build
12     if get_option('doc').enabled()
13         error('Documentation enabled but not supported when building statically.')
14     endif
15
16     message('Building statically, can\'t build the documentation')
17     subdir_done()
18 endif
19
20 hotdoc_plugin_scanner = executable('gst-hotdoc-plugins-scanner',
21   'gst-hotdoc-plugins-scanner.c',
22   pie : true,
23   c_args : gst_c_args,
24   include_directories : [configinc],
25   dependencies : [gst_dep, gmodule_dep, gio_dep],
26   install_dir : helpers_install_dir,
27   link_with: [printf_lib],
28   install: true,
29 )
30
31 configure_file(
32     input: 'gst-plugins-doc-cache-generator.py',
33     output: 'gst-plugins-doc-cache-generator',
34     install_dir: helpers_install_dir,
35     copy: true
36 )
37
38 plugins_cache_generator = find_program(join_paths(meson.current_build_dir(), 'gst-plugins-doc-cache-generator'))
39 plugins_cache = join_paths(meson.current_source_dir(), 'plugins', 'gst_plugins_cache.json')
40 gst_plugins_doc_dep = custom_target('build-doc-cache',
41     command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
42     input: plugins,
43     output: 'gst_plugins_cache.json',
44     depends: [hotdoc_plugin_scanner],
45     build_always_stale: true,
46 )
47
48 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
49 if not hotdoc_p.found()
50     message('Hotdoc not found, not building the documentation')
51     subdir_done()
52 endif
53
54 hotdoc_req = '>= 0.11.0'
55 hotdoc_version = run_command(hotdoc_p, '--version', check: false).stdout()
56 if not hotdoc_version.version_compare(hotdoc_req)
57     if get_option('doc').enabled()
58         error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
59     else
60         message('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
61         subdir_done()
62     endif
63 endif
64
65 hotdoc = import('hotdoc')
66 required_hotdoc_extensions = ['gi-extension', 'gst-extension']
67 foreach extension: required_hotdoc_extensions
68     if not hotdoc.has_extensions(extension)
69         if get_option('doc').enabled()
70             error('Documentation enabled but @0@ missing'.format(extension))
71         endif
72
73         message('@0@ extension not found, not building documentation'.format(extension))
74         subdir_done()
75     endif
76 endforeach
77
78 if static_build
79     if get_option('doc').enabled()
80         error('Documentation enabled but not supported when building statically.')
81     endif
82
83     message('Building statically, can\'t build the documentation')
84     subdir_done()
85 endif
86
87 if not build_gir
88     if get_option('doc').enabled()
89         error('Documentation enabled but introspection not built.')
90     endif
91
92     message('Introspection not built, can\'t build the documentation')
93     subdir_done()
94 endif
95
96 all_plugins_paths = []
97 foreach l: plugins
98     all_plugins_paths += l.full_path()
99 endforeach
100
101 build_hotdoc = true
102 docconf = configuration_data()
103 docconf.set('GST_API_VERSION', apiversion)
104
105 version_entities = configure_file(input : 'version.in',
106     output : 'gst_api_version.md',
107     configuration : docconf)
108
109 gst_excludes = []
110 foreach h: ['gettext.h', 'glib-compat-private.h', 'glib-compat.h',
111             'gst_private.h',
112             'gstelementdetails.h', 'gstmacros.h', 'gstmarshal.h',
113             'math-compat.h', 'parse/grammar.tab.h',
114             '../libs/gst/base/gstindex.h',
115             '../libs/gst/base/gstindex.c',
116             '../libs/gst/check/internal-check.h',
117             'parser/grammar.tab.pre.h', 'parse/parse_lex.h', 'types.h',
118             'gst-printf.h', 'printf-args.h', 'printf-extension.h',
119             'printf-parse.h', 'vasnprintf.h', 'gstregistrybinary.c',
120             'gstregistrybinary.h', 'gstpluginloader.h', 'gstpluginloader.c']
121     gst_excludes += [join_paths(meson.current_source_dir(), '..', 'gst', h)]
122 endforeach
123
124 libs_doc = [hotdoc.generate_doc('gstreamer',
125     project_version: apiversion,
126     gi_c_sources: '../gst/*.[hc]',
127     gi_sources: [gst_gir[0].full_path()],
128     gi_c_source_filters: gst_excludes,
129     sitemap: 'gst/sitemap.txt',
130     index: 'gst/index.md',
131     gi_index: 'gst/gi-index.md',
132     gi_smart_index: true,
133     gi_c_source_roots: [join_paths(meson.current_source_dir(), '../gst/'), ],
134     dependencies: [gst_dep, gmodule_dep],
135     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
136     depends: gst_gir[0],
137 )]
138
139 libs = [
140   ['base', gst_base_gir, gst_base_dep],
141   ['controller', gst_controller_gir, gst_controller_dep,],
142   ['net', gst_net_gir, gst_net_dep],
143   ['check', gst_check_gir, gst_check_dep],
144 ]
145
146 foreach lib: libs
147   name = lib[0]
148   gir = lib[1]
149   deps = [lib[2], gir]
150   libs_doc += [hotdoc.generate_doc(name,
151       project_version: apiversion,
152       gi_c_sources: ['../libs/gst/' + name + '/*.[hc]'],
153       gi_c_source_filters: gst_excludes,
154       gi_sources: gir[0].full_path(),
155       gi_c_source_roots: [join_paths(meson.current_source_dir(), '../libs/gst/' + name), ],
156       sitemap: join_paths('libs', name, 'sitemap.txt'),
157       index: join_paths('libs/', name, 'index.md'),
158       gi_index: join_paths('libs/', name, 'index.md'),
159       gi_smart_index: true,
160       gi_order_generated_subpages: true,
161       dependencies: deps,
162       install: false,
163       depends: gir[0],
164   )]
165 endforeach
166
167 plugins_doc = [
168     hotdoc.generate_doc('coreelements',
169         project_version: apiversion,
170         sitemap: 'plugins/sitemap.txt',
171         index: 'plugins/index.md',
172         gst_index: 'plugins/index.md',
173         gst_smart_index: true,
174         gst_c_sources: ['../plugins/elements/*.c', '../plugins/elements/*.h'],
175         dependencies: [gst_plugins_doc_dep],
176         gst_cache_file: plugins_cache,
177         gst_plugin_name: 'coreelements',
178     ),
179     hotdoc.generate_doc('coretracers',
180         project_version: apiversion,
181         sitemap: 'plugins/coretracers/sitemap.txt',
182         index: 'plugins/coretracers/index.md',
183         gst_index: 'plugins/coretracers/index.md',
184         gst_smart_index: true,
185         gst_c_sources: ['../plugins/tracers/*.c', '../plugins/tracers/*.h'],
186         dependencies: [gst_plugins_doc_dep],
187         gst_cache_file: plugins_cache,
188         gst_plugin_name: 'coretracers',
189     )
190
191 ]