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
|
xsltproc = find_program('xsltproc', required: get_option('docs'))
xmlto = find_program('xmlto', required: get_option('docs'))
if xmlto.found() and xsltproc.found()
# TODO: is the docbook DTD/XSL catalog check needed or does xsltproc take care of that?
configured_xml = configure_file(
configuration: {
'VERSION': meson.project_version(),
# FIXME: that's not a good way of this it…
'srcdir': meson.current_source_dir(),
},
input: 'flatpak-builder-docs.xml.in',
# depend_files:
output: 'flatpak-builder-docs.xml',
)
man_pages = [
['flatpak-builder', '1'],
['flatpak-manifest', '5'],
]
foreach man_page : man_pages
man_page_name = '@0@.@1@'.format(man_page[0], man_page[1])
custom_target(man_page[0] + '-man',
command: [
xsltproc,
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
'--output', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@'
],
input: man_page[0] + '.xml',
output: man_page_name,
install: true,
install_dir: get_option('mandir') / 'man' + man_page[1],
)
endforeach
doc_dir = get_option('datadir') / 'doc' / meson.project_name()
html = custom_target('docbook',
command: [
xmlto,
'--skip-validation',
'xhtml-nochunks',
'-o', meson.current_build_dir(),
'-m', files('xmlto-config.xsl'),
'@INPUT@',
],
input: configured_xml,
output: 'flatpak-builder-docs.html',
install: true,
install_dir: doc_dir,
)
install_data(
files('docbook.css'),
install_dir: doc_dir,
)
endif
|