From 37b416c152ed833dcc55c84068c77eb713748d24 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 4 Nov 2024 22:55:18 -0500 Subject: [PATCH] doc: make PDF documentation optional While building any documentation requires xsltproc, only the PDF documentation requires fop, which is dependency-heavy, and not always available (e.g. it is not included in RHEL). This allows the HTML documentation to be built while skipping the PDFs. --- doc/guide-meson.build | 58 ++++++++++++++++++++++--------------------- meson.build | 2 +- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/doc/guide-meson.build b/doc/guide-meson.build index e29d16e26..f2de960e3 100644 --- a/doc/guide-meson.build +++ b/doc/guide-meson.build @@ -56,35 +56,37 @@ custom_target( ) -fop = custom_target( - input: xml, - output: name + '.fop', - command: [ - prog_xsltproc, - '-o', '@OUTPUT@', - '--nonet', - '--xinclude', - '--stringparam', 'generate.toc', 'book toc', - '--stringparam', 'section.autolabel', '1', - '--stringparam', 'section.label.includes.component.label', '1', - '--stringparam', 'toc.max.depth', toc_max_depth, - pdf_stylesheet, - '@INPUT@', - ], -) +if prog_fop.found() + fop = custom_target( + input: xml, + output: name + '.fop', + command: [ + prog_xsltproc, + '-o', '@OUTPUT@', + '--nonet', + '--xinclude', + '--stringparam', 'generate.toc', 'book toc', + '--stringparam', 'section.autolabel', '1', + '--stringparam', 'section.label.includes.component.label', '1', + '--stringparam', 'toc.max.depth', toc_max_depth, + pdf_stylesheet, + '@INPUT@', + ], + ) -custom_target( - input: fop, - output: name + '.pdf', - command: [ - prog_fop, - '@INPUT@', - '@OUTPUT@', - ], - install: true, - install_dir: pdfdir, - install_tag: 'doc', -) + custom_target( + input: fop, + output: name + '.pdf', + command: [ + prog_fop, + '@INPUT@', + '@OUTPUT@', + ], + install: true, + install_dir: pdfdir, + install_tag: 'doc', + ) +endif subdir('html') diff --git a/meson.build b/meson.build index e3d8cc2a7..664bd1262 100644 --- a/meson.build +++ b/meson.build @@ -502,7 +502,7 @@ if enable_docs endif prog_fop = find_program( 'fop', - required: feature_docs, + required: false, disabler: true, )