1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
html_xslt_gen_xslt = subsite_xsl
html_xslt_gen_install_dir = docs_html_dir / 'manpages'
html_xslt_gen = []
# docs_man_files
# each entry is a dictionary with following items:
# name - man page name (required)
# section - man page section (required)
# install - whether to build and install the man page (required)
# file - generated RST file (optional, default none)
docs_man_files = [
{ 'name': 'index', 'section': '', 'install': false },
{ 'name': 'virsh', 'section': '1', 'install': true },
{ 'name': 'virt-admin', 'section': '1', 'install': true },
{ 'name': 'virt-host-validate', 'section': '1', 'install': conf.has('WITH_HOST_VALIDATE') },
{ 'name': 'virt-login-shell', 'section': '1', 'install': conf.has('WITH_LOGIN_SHELL') },
{ 'name': 'virt-pki-validate', 'section': '1', 'install': true },
{ 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') },
{ 'name': 'virt-xml-validate', 'section': '1', 'install': true },
{ 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') },
{ 'name': 'virtlockd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'virtlogd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
]
foreach name : keycode_list
rst_file = custom_target(
'virkeycode-@0@.rst'.format(name),
input: keymap_src_file,
output: 'virkeycode-@0@.rst'.format(name),
command: [
meson_python_prog, python3_prog, keymap_gen_prog, 'code-docs',
'--lang', 'rst',
'--title', 'virkeycode-@0@'.format(name),
'--subtitle', 'Key code values for @0@'.format(name),
'@INPUT@', name,
],
capture: true,
build_by_default: true,
)
docs_man_files += {
'name': 'virkeycode-@0@'.format(name), 'section': '7', 'install': true, 'file': rst_file,
}
endforeach
foreach name : keyname_list
rst_file = custom_target(
'virkeyname-@0@.rst'.format(name),
input: keymap_src_file,
output: 'virkeyname-@0@.rst'.format(name),
command: [
meson_python_prog, python3_prog, keymap_gen_prog, 'name-docs',
'--lang', 'rst',
'--title', 'virkeyname-@0@'.format(name),
'--subtitle', 'Key name values for @0@'.format(name),
'@INPUT@', name,
],
capture: true,
build_by_default: true,
)
docs_man_files += {
'name': 'virkeyname-@0@'.format(name), 'section': '7', 'install': true, 'file': rst_file,
}
endforeach
docs_man_conf = configuration_data()
docs_man_conf.set('SYSCONFDIR', sysconfdir)
docs_man_conf.set('RUNSTATEDIR', runstatedir)
foreach data : docs_man_files
rst_in_file = '@0@.rst'.format(data['name'])
html_in_file = '@0@.html.in'.format(data['name'])
html_file = '@0@.html'.format(data['name'])
if data.has_key('file')
rst_file = data['file']
else
rst_file = configure_file(
input: rst_in_file,
output: '@0@.rst'.format(data['name']),
configuration: docs_man_conf,
)
endif
if data['install']
man_file = '@0@.@1@'.format(data['name'], data['section'])
man_page = custom_target(
man_file,
input: rst_file,
output: man_file,
# 'contents' element is the table of contents which is undesired in manpage
command: [ rst2man_prog, '--strip-elements-with-class', 'contents', '--strict', '@INPUT@', '@OUTPUT@' ],
install: true,
install_dir: mandir / 'man@0@'.format(data['section']),
)
endif
html_in = custom_target(
html_in_file,
input: rst_file,
output: html_in_file,
command: [ rst2html_prog, '--stylesheet=', '--strict', '@INPUT@' ],
capture: true,
)
html_xslt_gen += {
'name': data['name'],
'file': html_in,
'source': 'docs/manpages' / rst_in_file,
}
endforeach
# keep the XSLT processing code block in sync with docs/meson.build
# --- begin of XSLT processing ---
foreach data : html_xslt_gen
html_filename = data['name'] + '.html'
html_file = custom_target(
html_filename,
input: data.get('file', data['name'] + '.html.in'),
output: html_filename,
command: [
xsltproc_prog,
'--stringparam', 'pagesrc', data.get('source', ''),
'--stringparam', 'builddir', meson.build_root(),
'--stringparam', 'timestamp', docs_timestamp,
'--nonet',
html_xslt_gen_xslt,
'@INPUT@',
],
depends: data.get('depends', []),
depend_files: [ page_xsl ],
capture: true,
install: true,
install_dir: html_xslt_gen_install_dir,
)
install_web_deps += html_file
install_web_files += html_file.full_path() + ':' + html_xslt_gen_install_dir
endforeach
html_xslt_gen = []
# --- end of XSLT processing ---
|