Skip to content

Commit 6f78db9

Browse files
committed
docs: add option to skip building HTML docs
Reorder meson targets to handle those all at the end, and exit early if HTML documentation is disabled. This makes it possible to build just the manpage, without hotdoc installed.
1 parent 740d926 commit 6f78db9

File tree

2 files changed

+40
-33
lines changed

2 files changed

+40
-33
lines changed

docs/meson.build

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@ project('Meson documentation', version: '1.0')
22

33
cur_bdir = meson.current_build_dir()
44

5-
# Only the script knows which files are being generated
6-
docs_gen = custom_target(
7-
'gen_docs',
8-
input: files('markdown/index.md'),
9-
output: 'gen_docs.stamp',
10-
command: [
11-
files('../tools/regenerate_docs.py'),
12-
'--output-dir', cur_bdir,
13-
'--dummy-output-file', '@OUTPUT@',
14-
],
15-
build_by_default: true,
16-
install: false)
17-
185
sitemap = files('sitemap.txt')
196

207
yaml_loader = get_option('unsafe_yaml') ? 'fastyaml' : 'yaml'
@@ -34,24 +21,6 @@ refman_binary = custom_target(
3421
]
3522
)
3623

37-
refman_md = custom_target(
38-
'gen_refman_md',
39-
input: refman_binary,
40-
output: ['configured_sitemap.txt', 'refman_links.json'],
41-
command: [
42-
genrefman,
43-
'-l', 'pickle',
44-
'-g', 'md',
45-
'-s', sitemap,
46-
'-i', '@INPUT@',
47-
'-o', '@OUTPUT0@',
48-
'--link-defs', '@OUTPUT1@',
49-
'--force-color',
50-
'--no-modules',
51-
],
52-
)
53-
sitemap = refman_md[0]
54-
5524
refman_json = custom_target(
5625
'gen_refman_json',
5726
build_by_default: true,
@@ -66,6 +35,7 @@ refman_json = custom_target(
6635
'--force-color',
6736
],
6837
)
38+
test('validate_docs', find_program('./jsonvalidator.py'), args: [refman_json])
6939

7040
refman_man = custom_target(
7141
'gen_refman_man',
@@ -83,6 +53,43 @@ refman_man = custom_target(
8353
],
8454
)
8555

56+
# Everything past here is HTML resources.
57+
if not get_option('html')
58+
subdir_done()
59+
endif
60+
61+
# Only the script knows which files are being generated
62+
docs_gen = custom_target(
63+
'gen_docs',
64+
input: files('markdown/index.md'),
65+
output: 'gen_docs.stamp',
66+
command: [
67+
files('../tools/regenerate_docs.py'),
68+
'--output-dir', cur_bdir,
69+
'--dummy-output-file', '@OUTPUT@',
70+
],
71+
build_by_default: true,
72+
install: false,
73+
)
74+
75+
refman_md = custom_target(
76+
'gen_refman_md',
77+
input: refman_binary,
78+
output: ['configured_sitemap.txt', 'refman_links.json'],
79+
command: [
80+
genrefman,
81+
'-l', 'pickle',
82+
'-g', 'md',
83+
'-s', sitemap,
84+
'-i', '@INPUT@',
85+
'-o', '@OUTPUT0@',
86+
'--link-defs', '@OUTPUT1@',
87+
'--force-color',
88+
'--no-modules',
89+
],
90+
)
91+
sitemap = refman_md[0]
92+
8693
genrelnotes = custom_target(
8794
output: ['sitemap-genrelnotes.txt'],
8895
build_always_stale: true,
@@ -95,8 +102,6 @@ genrelnotes = custom_target(
95102
)
96103
sitemap = genrelnotes[0]
97104

98-
test('validate_docs', find_program('./jsonvalidator.py'), args: [refman_json])
99-
100105
hotdoc_prog = find_program('hotdoc', version: '>=0.13.7')
101106

102107
hotdoc = import('hotdoc')

docs/meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
option('unsafe_yaml', type: 'boolean', value: false,
22
description: 'disable safety checks and use a faster, but less correct YAML loader')
3+
option('html', type: 'boolean', value: true,
4+
description: 'build the hotdoc-based HTML documentation')

0 commit comments

Comments
 (0)