From 5a54c5bb1c9609b7bffe6b3e05f934030e4e990e Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Sat, 26 Dec 2020 18:40:51 +0100 Subject: build: Add man_pages build options Check if xsltproc runs succesfully and fail otherwise Fixes #192 --- doc/man/meson.build | 98 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 39 deletions(-) (limited to 'doc/man') diff --git a/doc/man/meson.build b/doc/man/meson.build index ef3fcfbf..4c92eab2 100644 --- a/doc/man/meson.build +++ b/doc/man/meson.build @@ -1,43 +1,63 @@ xsltproc = find_program('xsltproc', required: false) if xsltproc.found() - xlstproc_flags = [ - '--nonet', - '--stringparam', 'man.output.quietly', '1', - '--stringparam', 'funcsynopsis.style', 'ansi', - '--stringparam', 'man.authors.section.enabled', '1', - '--stringparam', 'man.copyright.section.enabled', '1', - ] - - xsltproc_args = [ - xsltproc, - xlstproc_flags, - '-o', '@OUTPUT@', - 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl', - '@INPUT@', - ] - - man_input_files = [ - 'rygel.xml', - 'rygel.conf.xml' - ] - - man_output_files = [ - 'rygel.1', - 'rygel.conf.5' - ] - - custom_target('man 1 pages', - input: 'rygel.xml', - output: 'rygel.1', - command: xsltproc_args, - install: true, - install_dir: join_paths(get_option('mandir'), 'man1')) - - custom_target('man 5 pages', - input: 'rygel.conf.xml', - output: 'rygel.conf.5', - command: xsltproc_args, - install: true, - install_dir: join_paths(get_option('mandir'), 'man5')) + stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' + + xlstproc_flags = [ + '--nonet', + '--stringparam', 'man.output.quietly', '1', + '--stringparam', 'funcsynopsis.style', 'ansi', + '--stringparam', 'man.authors.section.enabled', '1', + '--stringparam', 'man.copyright.section.enabled', '1', + ] + + xsltproc_args = [ + xsltproc, + xlstproc_flags, + '-o', '@OUTPUT@', + stylesheet, + '@INPUT@', + ] + + man_input_files = [ + 'rygel.xml', + 'rygel.conf.xml' + ] + + man_output_files = [ + 'rygel.1', + 'rygel.conf.5' + ] + + r = run_command( + [ + xsltproc, + xlstproc_flags, + '-o', '/dev/null', + stylesheet, + 'rygel.xml' + ] + ) + + if (r.returncode() == 0) + custom_target( + 'man 1 pages', + input: 'rygel.xml', + output: 'rygel.1', + command: xsltproc_args, + install: true, + install_dir: join_paths(get_option('mandir'), 'man1') + ) + + custom_target( + 'man 5 pages', + input: 'rygel.conf.xml', + output: 'rygel.conf.5', + command: xsltproc_args, + install: true, + install_dir: join_paths(get_option('mandir'), 'man5') + ) + else + error('Cannot bulid man pages, failed to run xsltproc') + endif endif -- cgit v1.2.1