meson.build 4.17 KB
Newer Older
1
project('GStreamer manuals and tutorials', 'c',
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
2
  version: '1.17.2.1',
3
  meson_version: '>=0.48.0')
4

Thibault Saunier's avatar
Thibault Saunier committed
5
6
7
8
9
10
11
12
13
hotdoc_p = find_program('hotdoc')
if not hotdoc_p.found()
    message('Hotdoc not found, not building the documentation')
    subdir_done()
endif

hotdoc_req = '>= 0.12.2'
hotdoc_version = run_command(hotdoc_p, '--version').stdout()
if not hotdoc_version.version_compare(hotdoc_req)
14
    error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
Thibault Saunier's avatar
Thibault Saunier committed
15
16
endif

17
hotdoc = import('hotdoc')
18
hotdoc_subprojects = []
19
20

apiversion = '1.0'
21
22
23
24
25
26
if host_machine.system() == 'windows'
  pathsep = ';'
else
  pathsep = ':'
endif

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
python3 = import('python').find_installation()

built_subprojects = get_option('built_subprojects')
if built_subprojects != ''
  message('Have subprojects list from options')
else
  read_file_contents = '''
import os
import sys

assert len(sys.argv) >= 2
fname = sys.argv[1]

with open(fname, 'r') as f:
    for l in f:
        print(l)
'''

  # gst-build will generate this file for us to consume so that subproject
  # changes can still work
  fname = join_paths(meson.build_root(), 'GstDocumentedSubprojects')
  cmdres = run_command(
      python3,
      '-c', read_file_contents,
      fname,
    )
  if cmdres.returncode() == 0
    built_subprojects = cmdres.stdout().strip()
    message('Have subprojects from file: @0@'.format(fname))
  endif
endif

59
60
61
62
libs = ''
plugins_doc = ''
deps = []
plugins_sitemap = ''
63
64
if built_subprojects != ''
    foreach project_name: built_subprojects.split(',')
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
        sub = subproject(project_name)
        if sub.get_variable('build_hotdoc')
            message('Building @0@ documentation'.format(project_name))

            foreach lib: sub.get_variable('libs_doc')
              hotdoc_subprojects += [lib]
              libs += lib.full_path() + pathsep
              deps += [lib]
            endforeach

            foreach plugin_doc: sub.get_variable('plugins_doc')
              plugins_doc += plugin_doc.full_path() + pathsep
              hotdoc_subprojects += [plugin_doc]
              deps += [plugin_doc]
            endforeach
        else
            message('@0@ did not build hotdoc documentation, can\'t build API doc'.format(project_name))
        endif
    endforeach
endif
85
deps += [dependency('gstreamer-' + apiversion, fallback: ['gstreamer', 'gst_dep'])]
86
87
88
89
90
91
92
93

if get_option('use_portal_index')
  index = 'markdown/index.md'
else
  index = 'markdown/simple-index.md'
endif
sitemap_gen = find_program('scripts/generate_sitemap.py')
sitemap = configure_file(command: [sitemap_gen, '@INPUT@', '@OUTPUT@',
94
  'gi-index', libs, plugins_doc],
95
96
  input: 'sitemap.txt',
  output: 'sitemap.txt')
97

98
html_theme = 'https://github.com/hotdoc/hotdoc_lumen_theme/releases/download/0.9999999/hotdoc_lumen_theme-0.9999999.tar.xz?sha256=ef3b9dd59550c2ba31a7fbcae1f69e6e77147f5e6e224f37a6cb55c162957437'
99
100
101

gstreamer_doc = hotdoc.generate_doc('GStreamer',
    project_version: apiversion,
102
103
    sitemap: sitemap,
    index: index,
104
    gi_index: index,
105
106
107
108
109
110
    install: true,
    extra_assets: [join_paths(meson.current_source_dir(), 'images')],
    syntax_highlighting_activate: true,
    html_theme: html_theme,
    include_paths: join_paths(meson.current_source_dir(), 'examples'),
    html_extra_theme: join_paths(meson.current_source_dir(), 'theme/extra'),
111
112
    dependencies: deps,
    subprojects: hotdoc_subprojects,
113
    disable_incremental_build: true,
114
115
    gst_list_plugins_page: 'gst-index',
    gst_index: join_paths(meson.current_source_dir(), 'markdown/plugins_doc.md'),
116
    devhelp_activate: true,
117
    devhelp_online: 'https://gstreamer.freedesktop.org/documentation/',
118
119
    build_always_stale: true,
    edit_on_github_repository: 'https://gitlab.freedesktop.org/gstreamer/gst-docs/',
120
    previous_symbol_index: join_paths(meson.current_source_dir(), 'symbols', 'symbol_index.json'),
121
)
122
123
124
125
126
127
128
129
130
131

cdata = configuration_data()
cdata.set('GST_API_VERSION', apiversion)
readme = configure_file(input: 'scripts/RELEASE_README.md',
               output: 'README.md',
               configuration : cdata)

run_target('release',
  command: [find_program('scripts/release.py'),
            gstreamer_doc.full_path(),
132
133
            meson.project_version(),
            meson.current_build_dir()],
134
  depends: [gstreamer_doc]
135
)