diff options
Diffstat (limited to 'doc/man/meson.build')
-rw-r--r-- | doc/man/meson.build | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/doc/man/meson.build b/doc/man/meson.build new file mode 100644 index 00000000..323a8c4d --- /dev/null +++ b/doc/man/meson.build @@ -0,0 +1,71 @@ +# Copyright 2020-2023 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +mandoc_css = files('mandoc.css') + +if get_option('lint') + stylelint = find_program('stylelint', required: get_option('tests')) + if stylelint.found() + test('stylelint', stylelint, args: [mandoc_css], suite: 'data') + endif +endif + +if not get_option('tools').disabled() + # Install tool man pages + if not get_option('man').disabled() + if not meson.is_subproject() + summary( + 'Man pages', + get_option('prefix') / get_option('mandir'), + section: 'Directories', + ) + endif + + install_man(files('serdi.1')) + endif + + # Build/install HTML man pages if mandoc is present + mandoc = find_program('mandoc', required: get_option('man_html')) + if mandoc.found() + configure_file( + copy: true, + input: mandoc_css, + output: 'mandoc.css', + install_dir: docdir / versioned_name / 'man', + ) + + mandoc_html_command = [ + mandoc, + '-Kutf-8', + '-Ostyle=mandoc.css,man=%N.html', + '-Thtml', + '-Wwarning,stop', + '@INPUT@', + ] + + page_names = [ + 'serdi', + ] + + html_mandir = docdir / versioned_name / 'man' + foreach name : page_names + custom_target( + name + '.html', + capture: true, + command: mandoc_html_command, + input: files(name + '.1'), + install: true, + install_dir: html_mandir, + output: name + '.html', + ) + endforeach + + if not meson.is_subproject() + summary( + 'HTML man pages', + get_option('prefix') / html_mandir, + section: 'Directories', + ) + endif + endif +endif |