Merge branch 'ps/meson-build-docs'

The build procedure based on meson learned a target to only build
documentation, similar to "make doc".

* ps/meson-build-docs:
  ci: don't compile whole project when testing docs with Meson
  meson: print docs backend as part of the summary
  meson: introduce a "docs" alias to compile documentation only
This commit is contained in:
Junio C Hamano
2025-10-02 12:26:12 -07:00
7 changed files with 24 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ howto_index = custom_target(
output: 'howto-index.adoc', output: 'howto-index.adoc',
) )
custom_target( doc_targets += custom_target(
command: asciidoc_html_options, command: asciidoc_html_options,
input: howto_index, input: howto_index,
output: 'howto-index.html', output: 'howto-index.html',
@@ -51,7 +51,7 @@ foreach howto : howto_sources
capture: true, capture: true,
) )
custom_target( doc_targets += custom_target(
command: asciidoc_html_options, command: asciidoc_html_options,
input: howto_stripped, input: howto_stripped,
output: fs.stem(howto_stripped.full_path()) + '.html', output: fs.stem(howto_stripped.full_path()) + '.html',

View File

@@ -377,7 +377,7 @@ foreach manpage, category : manpages
output: fs.stem(manpage) + '.xml', output: fs.stem(manpage) + '.xml',
) )
custom_target( doc_targets += custom_target(
command: [ command: [
xmlto, xmlto,
'-m', '@INPUT0@', '-m', '@INPUT0@',
@@ -400,7 +400,7 @@ foreach manpage, category : manpages
endif endif
if get_option('docs').contains('html') if get_option('docs').contains('html')
custom_target( doc_targets += custom_target(
command: asciidoc_common_options + [ command: asciidoc_common_options + [
'--backend=' + asciidoc_html, '--backend=' + asciidoc_html,
'--doctype=manpage', '--doctype=manpage',
@@ -452,7 +452,7 @@ if get_option('docs').contains('html')
depends: documentation_deps, depends: documentation_deps,
) )
custom_target( doc_targets += custom_target(
command: [ command: [
xsltproc, xsltproc,
'--xinclude', '--xinclude',
@@ -481,7 +481,7 @@ if get_option('docs').contains('html')
] ]
foreach article : articles foreach article : articles
custom_target( doc_targets += custom_target(
command: asciidoc_common_options + [ command: asciidoc_common_options + [
'--backend=' + asciidoc_html, '--backend=' + asciidoc_html,
'--out-file=@OUTPUT@', '--out-file=@OUTPUT@',

View File

@@ -46,7 +46,7 @@ api_index = custom_target(
output: 'api-index.adoc', output: 'api-index.adoc',
) )
custom_target( doc_targets += custom_target(
command: asciidoc_html_options, command: asciidoc_html_options,
input: api_index, input: api_index,
output: 'api-index.html', output: 'api-index.html',
@@ -56,7 +56,7 @@ custom_target(
) )
foreach article : api_docs + articles foreach article : api_docs + articles
custom_target( doc_targets += custom_target(
command: asciidoc_html_options, command: asciidoc_html_options,
input: article, input: article,
output: fs.stem(article) + '.html', output: fs.stem(article) + '.html',

View File

@@ -48,13 +48,13 @@ check_unignored_build_artifacts
# Build docs with Meson and AsciiDoc # Build docs with Meson and AsciiDoc
meson setup build-asciidoc -Ddocs=html,man -Ddocs_backend=asciidoc meson setup build-asciidoc -Ddocs=html,man -Ddocs_backend=asciidoc
meson compile -C build-asciidoc meson compile -C build-asciidoc docs
check_docs build-asciidoc AsciiDoc check_docs build-asciidoc AsciiDoc
rm -rf build-asciidoc rm -rf build-asciidoc
# Build docs with Meson and AsciiDoctor # Build docs with Meson and AsciiDoctor
meson setup build-asciidoctor -Ddocs=html,man -Ddocs_backend=asciidoctor meson setup build-asciidoctor -Ddocs=html,man -Ddocs_backend=asciidoctor
meson compile -C build-asciidoctor meson compile -C build-asciidoctor docs
check_docs build-asciidoctor Asciidoctor check_docs build-asciidoctor Asciidoctor
rm -rf build-asciidoctor rm -rf build-asciidoctor

View File

@@ -20,7 +20,7 @@ if get_option('docs').contains('man')
output: 'git-contacts.xml', output: 'git-contacts.xml',
) )
custom_target( doc_targets += custom_target(
command: [ command: [
xmlto, xmlto,
'-m', '@INPUT@', '-m', '@INPUT@',
@@ -39,7 +39,7 @@ if get_option('docs').contains('man')
endif endif
if get_option('docs').contains('html') if get_option('docs').contains('html')
custom_target( doc_targets += custom_target(
command: asciidoc_common_options + [ command: asciidoc_common_options + [
'--backend=' + asciidoc_html, '--backend=' + asciidoc_html,
'--doctype=manpage', '--doctype=manpage',

View File

@@ -38,7 +38,7 @@ if get_option('docs').contains('man')
output: 'git-subtree.xml', output: 'git-subtree.xml',
) )
custom_target( doc_targets += custom_target(
command: [ command: [
xmlto, xmlto,
'-m', '@INPUT@', '-m', '@INPUT@',
@@ -57,7 +57,7 @@ if get_option('docs').contains('man')
endif endif
if get_option('docs').contains('html') if get_option('docs').contains('html')
custom_target( doc_targets += custom_target(
command: asciidoc_common_options + [ command: asciidoc_common_options + [
'--backend=' + asciidoc_html, '--backend=' + asciidoc_html,
'--doctype=manpage', '--doctype=manpage',

View File

@@ -2101,11 +2101,20 @@ endif
subdir('bin-wrappers') subdir('bin-wrappers')
if get_option('docs') != [] if get_option('docs') != []
doc_targets = []
subdir('Documentation') subdir('Documentation')
else
docs_backend = 'none'
endif endif
subdir('contrib') subdir('contrib')
# Note that the target is intentionally configured after including the
# 'contrib' directory, as some tool there also have their own manpages.
if get_option('docs') != []
alias_target('docs', doc_targets)
endif
exclude_from_check_headers = [ exclude_from_check_headers = [
'compat/', 'compat/',
'unicode-width.h', 'unicode-width.h',
@@ -2244,6 +2253,7 @@ summary({
summary({ summary({
'csprng': csprng_backend, 'csprng': csprng_backend,
'docs': docs_backend,
'https': https_backend, 'https': https_backend,
'sha1': sha1_backend, 'sha1': sha1_backend,
'sha1_unsafe': sha1_unsafe_backend, 'sha1_unsafe': sha1_unsafe_backend,