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