diff options
-rw-r--r-- | .gitlab-ci.yml | 9 | ||||
-rw-r--r-- | doc/man/mandoc.css (renamed from doc/mandoc.css) | 0 | ||||
-rw-r--r-- | doc/man/meson.build | 71 | ||||
-rw-r--r-- | doc/man/serdi.1 (renamed from doc/serdi.1) | 0 | ||||
-rw-r--r-- | doc/meson.build | 51 | ||||
-rw-r--r-- | meson.build | 5 | ||||
-rw-r--r-- | meson_options.txt | 6 |
7 files changed, 86 insertions, 56 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7ff1d51..da5f5105 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -# Copyright 2018-2022 David Robillard <d@drobilla.net> +# Copyright 2018-2023 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC stages: [build, deploy] @@ -26,9 +26,8 @@ dev: coverage: '/ *lines\.*: \d+\.\d+.*/' artifacts: paths: + - build/doc/man - build/dest/share/doc - - build/doc/mandoc.css - - build/doc/serdi.html - build/meson-logs/coveragereport static: @@ -149,12 +148,10 @@ pages: script: - mkdir public - mkdir public/doc - - mkdir public/man - mv build/meson-logs/coveragereport/ public/coverage - mv build/dest/share/doc/serd-0/html/ public/doc/html/ - mv build/dest/share/doc/serd-0/singlehtml/ public/doc/singlehtml/ - - mv build/doc/serdi.html public/man/serdi.html - - mv build/doc/mandoc.css public/man/mandoc.css + - mv build/doc/man/ public/man/ needs: - dev artifacts: diff --git a/doc/mandoc.css b/doc/man/mandoc.css index 9d255992..9d255992 100644 --- a/doc/mandoc.css +++ b/doc/man/mandoc.css 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 diff --git a/doc/serdi.1 b/doc/man/serdi.1 index f3e42756..f3e42756 100644 --- a/doc/serdi.1 +++ b/doc/man/serdi.1 diff --git a/doc/meson.build b/doc/meson.build index b492483d..7180ec28 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -4,6 +4,12 @@ docdir = get_option('datadir') / 'doc' ############# +# Man pages # +############# + +subdir('man') + +############# # Reference # ############# @@ -65,48 +71,3 @@ if build_docs endif endforeach endif - -############# -# Man Pages # -############# - -mandoc_css = files('mandoc.css') - -if get_option('lint') - stylelint = find_program('stylelint', required: false) - if stylelint.found() - test('stylelint', stylelint, args: [mandoc_css], suite: 'data') - endif -endif - -mandoc = find_program('mandoc', required: false) -if mandoc.found() - configure_file(input: mandoc_css, output: '@PLAINNAME@', copy: true) - - serdi_html = custom_target( - 'serdi.html', - build_by_default: true, - capture: true, - command: [ - mandoc, - '-Kutf-8', - '-Ostyle=mandoc.css,man=%N.html', - '-Thtml', - '-Wwarning,stop', - '@INPUT@', - ], - input: files('serdi.1'), - output: 'serdi.html', - ) -endif - -if not meson.is_subproject() - summary( - { - 'HTML man pages': mandoc.found(), - 'API documentation': build_docs, - }, - bool_yn: true, - section: 'Components', - ) -endif diff --git a/meson.build b/meson.build index 44fc3328..a9fa5643 100644 --- a/meson.build +++ b/meson.build @@ -184,10 +184,6 @@ if not get_option('tools').disabled() ) meson.override_find_program('serdi', serdi) - - if not get_option('docs').disabled() - install_man(files('doc/serdi.1')) - endif endif # Display top-level summary (before subdirectories to appear first) @@ -214,7 +210,6 @@ if not meson.is_subproject() summary( { 'Executables': get_option('prefix') / get_option('bindir'), - 'Man pages': get_option('prefix') / get_option('mandir'), }, section: 'Directories', ) diff --git a/meson_options.txt b/meson_options.txt index 7fe112a4..09fc2334 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,6 +13,12 @@ option('html', type: 'feature', value: 'auto', yield: true, option('lint', type: 'boolean', value: false, yield: true, description: 'Run code quality checks') +option('man', type: 'feature', value: 'enabled', yield: true, + description: 'Install man pages') + +option('man_html', type: 'feature', value: 'auto', yield: true, + description: 'Build HTML man pages') + option('singlehtml', type: 'feature', value: 'auto', yield: true, description: 'Build single-page HTML documentation') |