Back to development
[platform/upstream/gstreamer.git] / meson.build
1 project('GStreamer manuals and tutorials', 'c',
2   version: '1.19.1.1',
3   meson_version : '>= 0.54')
4
5 hotdoc_p = find_program('hotdoc')
6 if not hotdoc_p.found()
7     message('Hotdoc not found, not building the documentation')
8     subdir_done()
9 endif
10
11 hotdoc_req = '>= 0.12.2'
12 hotdoc_version = run_command(hotdoc_p, '--version').stdout()
13 if not hotdoc_version.version_compare(hotdoc_req)
14     error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
15 endif
16
17 hotdoc = import('hotdoc')
18 hotdoc_subprojects = []
19
20 apiversion = '1.0'
21 if host_machine.system() == 'windows'
22   pathsep = ';'
23 else
24   pathsep = ':'
25 endif
26
27 python3 = import('python').find_installation()
28
29 built_subprojects = get_option('built_subprojects')
30 if built_subprojects != ''
31   message('Have subprojects list from options')
32 else
33   read_file_contents = '''
34 import os
35 import sys
36
37 assert len(sys.argv) >= 2
38 fname = sys.argv[1]
39
40 with open(fname, 'r') as f:
41     for l in f:
42         print(l)
43 '''
44
45   # gst-build will generate this file for us to consume so that subproject
46   # changes can still work
47   fname = join_paths(meson.build_root(), 'GstDocumentedSubprojects')
48   cmdres = run_command(
49       python3,
50       '-c', read_file_contents,
51       fname,
52     )
53   if cmdres.returncode() == 0
54     built_subprojects = cmdres.stdout().strip()
55     message('Have subprojects from file: @0@'.format(fname))
56   endif
57 endif
58
59 libs = ''
60 plugins_doc = ''
61 deps = []
62 plugins_sitemap = ''
63 if built_subprojects != ''
64     foreach project_name: built_subprojects.split(',')
65         sub = subproject(project_name)
66         if sub.get_variable('build_hotdoc')
67             message('Building @0@ documentation'.format(project_name))
68
69             foreach lib: sub.get_variable('libs_doc')
70               hotdoc_subprojects += [lib]
71               libs += lib.full_path() + pathsep
72               deps += [lib]
73             endforeach
74
75             foreach plugin_doc: sub.get_variable('plugins_doc')
76               plugins_doc += plugin_doc.full_path() + pathsep
77               hotdoc_subprojects += [plugin_doc]
78               deps += [plugin_doc]
79             endforeach
80         else
81             message('@0@ did not build hotdoc documentation, can\'t build API doc'.format(project_name))
82         endif
83     endforeach
84 endif
85 deps += [dependency('gstreamer-' + apiversion, fallback: ['gstreamer', 'gst_dep'])]
86
87 if get_option('use_portal_index')
88   index = 'markdown/index.md'
89 else
90   index = 'markdown/simple-index.md'
91 endif
92 sitemap_gen = find_program('scripts/generate_sitemap.py')
93 sitemap = configure_file(command: [sitemap_gen, '@INPUT@', '@OUTPUT@',
94   'gi-index', libs, plugins_doc],
95   input: 'sitemap.txt',
96   output: 'sitemap.txt')
97
98 html_theme = 'https://github.com/hotdoc/hotdoc_lumen_theme/releases/download/0.13.2/hotdoc_lumen_theme-0.13.2.tar.xz?sha256=5721189b7e985f27381ee20137f4a9003049a70a75ab1221a69fd04d27e752bc'
99
100 gstreamer_doc = hotdoc.generate_doc('GStreamer',
101     project_version: apiversion,
102     sitemap: sitemap,
103     index: index,
104     gi_index: index,
105     install: true,
106     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
107     syntax_highlighting_activate: true,
108     html_theme: html_theme,
109     include_paths: [
110       meson.current_source_dir() / 'examples',
111       meson.current_source_dir() / 'markdown' / 'tutorials' / 'basic',
112       meson.current_source_dir() / 'markdown' / 'templates',
113       meson.current_source_dir() / 'markdown' / 'tutorials' / 'playback',
114     ],
115     html_extra_theme: join_paths(meson.current_source_dir(), 'theme/extra'),
116     dependencies: deps,
117     subprojects: hotdoc_subprojects,
118     disable_incremental_build: true,
119     gst_list_plugins_page: 'gst-index',
120     gst_index: join_paths(meson.current_source_dir(), 'markdown/plugins_doc.md'),
121     devhelp_activate: true,
122     devhelp_online: 'https://gstreamer.freedesktop.org/documentation/',
123     build_always_stale: true,
124     edit_on_github_repository: 'https://gitlab.freedesktop.org/gstreamer/gst-docs/',
125     previous_symbol_index: join_paths(meson.current_source_dir(), 'symbols', 'symbol_index.json'),
126 )
127
128 cdata = configuration_data()
129 cdata.set('GST_API_VERSION', apiversion)
130 readme = configure_file(input: 'scripts/RELEASE_README.md',
131                output: 'README.md',
132                configuration : cdata)
133
134 run_target('release',
135   command: [find_program('scripts/release.py'),
136             gstreamer_doc.full_path(),
137             meson.project_version(),
138             meson.current_build_dir()],
139   depends: [gstreamer_doc]
140 )