diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-05-09 20:50:45 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-05-09 21:33:32 -0400 |
commit | 6f78db93bfe0d0b7df30abb76f77cb4575db1aa4 (patch) | |
tree | 2a4ca9925750ee00b10d86058d5004e504f56746 | |
parent | 740d926eee9f7cf15fb9fb94a38b367ba3f6595c (diff) | |
download | meson-6f78db93bfe0d0b7df30abb76f77cb4575db1aa4.tar.gz |
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.
-rw-r--r-- | docs/meson.build | 71 | ||||
-rw-r--r-- | docs/meson_options.txt | 2 |
2 files changed, 40 insertions, 33 deletions
diff --git a/docs/meson.build b/docs/meson.build index 812a9ae7a..b5ff25c0a 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -2,19 +2,6 @@ project('Meson documentation', version: '1.0') cur_bdir = meson.current_build_dir() -# Only the script knows which files are being generated -docs_gen = custom_target( - 'gen_docs', - input: files('markdown/index.md'), - output: 'gen_docs.stamp', - command: [ - files('../tools/regenerate_docs.py'), - '--output-dir', cur_bdir, - '--dummy-output-file', '@OUTPUT@', - ], - build_by_default: true, - install: false) - sitemap = files('sitemap.txt') yaml_loader = get_option('unsafe_yaml') ? 'fastyaml' : 'yaml' @@ -34,24 +21,6 @@ refman_binary = custom_target( ] ) -refman_md = custom_target( - 'gen_refman_md', - input: refman_binary, - output: ['configured_sitemap.txt', 'refman_links.json'], - command: [ - genrefman, - '-l', 'pickle', - '-g', 'md', - '-s', sitemap, - '-i', '@INPUT@', - '-o', '@OUTPUT0@', - '--link-defs', '@OUTPUT1@', - '--force-color', - '--no-modules', - ], -) -sitemap = refman_md[0] - refman_json = custom_target( 'gen_refman_json', build_by_default: true, @@ -66,6 +35,7 @@ refman_json = custom_target( '--force-color', ], ) +test('validate_docs', find_program('./jsonvalidator.py'), args: [refman_json]) refman_man = custom_target( 'gen_refman_man', @@ -83,6 +53,43 @@ refman_man = custom_target( ], ) +# Everything past here is HTML resources. +if not get_option('html') + subdir_done() +endif + +# Only the script knows which files are being generated +docs_gen = custom_target( + 'gen_docs', + input: files('markdown/index.md'), + output: 'gen_docs.stamp', + command: [ + files('../tools/regenerate_docs.py'), + '--output-dir', cur_bdir, + '--dummy-output-file', '@OUTPUT@', + ], + build_by_default: true, + install: false, +) + +refman_md = custom_target( + 'gen_refman_md', + input: refman_binary, + output: ['configured_sitemap.txt', 'refman_links.json'], + command: [ + genrefman, + '-l', 'pickle', + '-g', 'md', + '-s', sitemap, + '-i', '@INPUT@', + '-o', '@OUTPUT0@', + '--link-defs', '@OUTPUT1@', + '--force-color', + '--no-modules', + ], +) +sitemap = refman_md[0] + genrelnotes = custom_target( output: ['sitemap-genrelnotes.txt'], build_always_stale: true, @@ -95,8 +102,6 @@ genrelnotes = custom_target( ) sitemap = genrelnotes[0] -test('validate_docs', find_program('./jsonvalidator.py'), args: [refman_json]) - hotdoc_prog = find_program('hotdoc', version: '>=0.13.7') hotdoc = import('hotdoc') diff --git a/docs/meson_options.txt b/docs/meson_options.txt index f548da98d..bc0ec5508 100644 --- a/docs/meson_options.txt +++ b/docs/meson_options.txt @@ -1,2 +1,4 @@ option('unsafe_yaml', type: 'boolean', value: false, description: 'disable safety checks and use a faster, but less correct YAML loader') +option('html', type: 'boolean', value: true, + description: 'build the hotdoc-based HTML documentation') |