meson: properly wire up dependencies for our docs

A couple of Meson documentation targets use `meson.current_source_dir()`
to resolve inputs. This has the downside that it does not automagically
make Meson track these inputs as a dependency. After all, string
arguments really can be anything, even if they happen to match an actual
filesystem path.

Adapt these build targets to instead use inputs.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-12-27 14:59:30 +01:00
committed by Junio C Hamano
parent d838d821c9
commit 2a8bd34c55

View File

@ -229,7 +229,7 @@ if docs_backend == 'asciidoc'
'@INPUT@', '@INPUT@',
'@OUTPUT@', '@OUTPUT@',
], ],
input: meson.current_source_dir() / 'asciidoc.conf.in', input: 'asciidoc.conf.in',
output: 'asciidoc.conf', output: 'asciidoc.conf',
depends: [git_version_file], depends: [git_version_file],
env: version_gen_environment, env: version_gen_environment,
@ -261,7 +261,7 @@ elif docs_backend == 'asciidoctor'
'@INPUT@', '@INPUT@',
'@OUTPUT@', '@OUTPUT@',
], ],
input: meson.current_source_dir() / 'asciidoctor-extensions.rb.in', input: 'asciidoctor-extensions.rb.in',
output: 'asciidoctor-extensions.rb', output: 'asciidoctor-extensions.rb',
depends: [git_version_file], depends: [git_version_file],
env: version_gen_environment, env: version_gen_environment,
@ -304,10 +304,11 @@ cmd_lists = [
documentation_deps += custom_target( documentation_deps += custom_target(
command: [ command: [
perl, perl,
meson.current_source_dir() / 'cmd-list.perl', '@INPUT@',
meson.project_source_root(), meson.project_source_root(),
meson.current_build_dir(), meson.current_build_dir(),
] + cmd_lists, ] + cmd_lists,
input: 'cmd-list.perl',
output: cmd_lists output: cmd_lists
) )
@ -315,7 +316,7 @@ foreach mode : [ 'diff', 'merge' ]
documentation_deps += custom_target( documentation_deps += custom_target(
command: [ command: [
shell, shell,
meson.current_source_dir() / 'generate-mergetool-list.sh', '@INPUT@',
'..', '..',
'diff', 'diff',
'@OUTPUT@' '@OUTPUT@'
@ -324,6 +325,7 @@ foreach mode : [ 'diff', 'merge' ]
'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools', 'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools',
'TOOL_MODE=' + mode, 'TOOL_MODE=' + mode,
], ],
input: 'generate-mergetool-list.sh',
output: 'mergetools-' + mode + '.txt', output: 'mergetools-' + mode + '.txt',
) )
endforeach endforeach
@ -335,9 +337,10 @@ foreach manpage, category : manpages
'--backend=' + asciidoc_docbook, '--backend=' + asciidoc_docbook,
'--doctype=manpage', '--doctype=manpage',
'--out-file=@OUTPUT@', '--out-file=@OUTPUT@',
meson.current_source_dir() / manpage, '@INPUT@',
], ],
depends: documentation_deps, depends: documentation_deps,
input: manpage,
output: fs.stem(manpage) + '.xml', output: fs.stem(manpage) + '.xml',
) )
@ -345,10 +348,8 @@ foreach manpage, category : manpages
manpage_target = custom_target( manpage_target = custom_target(
command: [ command: [
xmlto, xmlto,
'-m', '-m', '@INPUT0@',
meson.current_source_dir() / 'manpage-normal.xsl', '-m', '@INPUT1@',
'-m',
meson.current_source_dir() / 'manpage-bold-literal.xsl',
'--stringparam', '--stringparam',
'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'), 'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'),
'man', 'man',
@ -356,6 +357,10 @@ foreach manpage, category : manpages
'-o', '-o',
meson.current_build_dir(), meson.current_build_dir(),
] + xmlto_extra, ] + xmlto_extra,
input: [
'manpage-normal.xsl',
'manpage-bold-literal.xsl',
],
output: manpage_path, output: manpage_path,
install: true, install: true,
install_dir: get_option('mandir') / 'man' + category.to_string(), install_dir: get_option('mandir') / 'man' + category.to_string(),
@ -368,9 +373,10 @@ foreach manpage, category : manpages
'--backend=' + asciidoc_html, '--backend=' + asciidoc_html,
'--doctype=manpage', '--doctype=manpage',
'--out-file=@OUTPUT@', '--out-file=@OUTPUT@',
meson.current_source_dir() / manpage, '@INPUT@',
], ],
depends: documentation_deps, depends: documentation_deps,
input: manpage,
output: fs.stem(manpage) + '.html', output: fs.stem(manpage) + '.html',
install: true, install: true,
install_dir: get_option('datadir') / 'doc/git-doc', install_dir: get_option('datadir') / 'doc/git-doc',