summaryrefslogtreecommitdiff
path: root/man/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-27 20:11:41 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-27 20:34:40 +0200
commitf12c5d36a9a162f833987b03fbf0b65248581cbb (patch)
tree392b132aeb58d7dae10b00c97f3c0085dc93ab88 /man/meson.build
parent6839ce3318dc200c42d43ea06ecd94cb118b3c00 (diff)
downloadsystemd-f12c5d36a9a162f833987b03fbf0b65248581cbb.tar.gz
meson: use alias_target for doc update commands
This undoes part of 4c890ad3cc7b3445683d7b52bc00e4a58bef5e94: the implementations of update-dbus-docs and update-man-rules are moved back to man/meson.build, and alias_target() is used to keep the visible target names unchanged. The rules for man pages are reworked so that it's possible to invoke the targets even if xstlproc is not available. After all, xsltproc is only needed for the final formatted output, and not other processing.
Diffstat (limited to 'man/meson.build')
-rw-r--r--man/meson.build98
1 files changed, 61 insertions, 37 deletions
diff --git a/man/meson.build b/man/meson.build
index bb00b6e3dd..4132f826a8 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -37,7 +37,7 @@ man_pages = []
html_pages = []
source_xml_files = []
dbus_docs = []
-foreach tuple : xsltproc.found() ? manpages : []
+foreach tuple : manpages
stem = tuple[0]
section = tuple[1]
aliases = tuple[2]
@@ -57,46 +57,47 @@ foreach tuple : xsltproc.found() ? manpages : []
mandirn = get_option('mandir') / ('man' + section)
if condition == '' or conf.get(condition) == 1
- p1 = custom_target(
- man,
- input : xml,
- output : [man] + manaliases,
- command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
- depends : custom_entities_ent,
- install : want_man,
- install_dir : mandirn)
- man_pages += p1
-
- p2 = []
- foreach htmlalias : htmlaliases
- link = custom_target(
- htmlalias,
- output : htmlalias,
- command : [ln, '-fs', html, '@OUTPUT@'])
- if want_html
- dst = docdir / 'html' / htmlalias
- cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
- meson.add_install_script('sh', '-c', cmd)
- p2 += link
- endif
- html_pages += link
- endforeach
-
- p3 = custom_target(
- html,
- input : xml,
- output : html,
- command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
- depends : [custom_entities_ent, p2],
- install : want_html,
- install_dir : docdir / 'html')
- html_pages += p3
-
file = files(tuple[0] + '.xml')
- source_xml_files += file
if tuple[0].startswith('org.freedesktop.')
dbus_docs += file
endif
+
+ if xsltproc.found()
+ p1 = custom_target(
+ man,
+ input : xml,
+ output : [man] + manaliases,
+ command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
+ depends : custom_entities_ent,
+ install : want_man,
+ install_dir : mandirn)
+ man_pages += p1
+
+ p2 = []
+ foreach htmlalias : htmlaliases
+ link = custom_target(
+ htmlalias,
+ output : htmlalias,
+ command : [ln, '-fs', html, '@OUTPUT@'])
+ if want_html
+ dst = docdir / 'html' / htmlalias
+ cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
+ meson.add_install_script('sh', '-c', cmd)
+ p2 += link
+ endif
+ html_pages += link
+ endforeach
+
+ p3 = custom_target(
+ html,
+ input : xml,
+ output : html,
+ command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
+ depends : [custom_entities_ent, p2],
+ install : want_html,
+ install_dir : docdir / 'html')
+ html_pages += p3
+ endif
else
message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition))
endif
@@ -213,3 +214,26 @@ configure_file(
input : 'html.in',
output : 'html',
configuration : buildroot_substs)
+
+############################################################
+
+update_dbus_docs = custom_target(
+ 'update-dbus-docs',
+ output : 'update-dbus-docs',
+ command : [update_dbus_docs_py, '--build-dir', project_build_root, '@INPUT@'],
+ input : dbus_docs)
+
+if conf.get('BUILD_MODE_DEVELOPER') == 1
+ test('dbus-docs-fresh',
+ update_dbus_docs_py,
+ args : ['--build-dir', project_build_root, '--test', dbus_docs])
+endif
+
+update_man_rules = custom_target(
+ 'update-man-rules',
+ output : 'update-man-rules',
+ command : [sh, '-c',
+ 'cd @0@ && '.format(project_build_root) +
+ 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
+ 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
+ depends : custom_entities_ent)