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.
This commit is contained in:
Yaakov Selkowitz 2024-11-04 22:55:18 -05:00
parent df46458bee
commit 37b416c152
2 changed files with 31 additions and 29 deletions

View File

@ -56,35 +56,37 @@ custom_target(
) )
fop = custom_target( if prog_fop.found()
input: xml, fop = custom_target(
output: name + '.fop', input: xml,
command: [ output: name + '.fop',
prog_xsltproc, command: [
'-o', '@OUTPUT@', prog_xsltproc,
'--nonet', '-o', '@OUTPUT@',
'--xinclude', '--nonet',
'--stringparam', 'generate.toc', 'book toc', '--xinclude',
'--stringparam', 'section.autolabel', '1', '--stringparam', 'generate.toc', 'book toc',
'--stringparam', 'section.label.includes.component.label', '1', '--stringparam', 'section.autolabel', '1',
'--stringparam', 'toc.max.depth', toc_max_depth, '--stringparam', 'section.label.includes.component.label', '1',
pdf_stylesheet, '--stringparam', 'toc.max.depth', toc_max_depth,
'@INPUT@', pdf_stylesheet,
], '@INPUT@',
) ],
)
custom_target( custom_target(
input: fop, input: fop,
output: name + '.pdf', output: name + '.pdf',
command: [ command: [
prog_fop, prog_fop,
'@INPUT@', '@INPUT@',
'@OUTPUT@', '@OUTPUT@',
], ],
install: true, install: true,
install_dir: pdfdir, install_dir: pdfdir,
install_tag: 'doc', install_tag: 'doc',
) )
endif
subdir('html') subdir('html')

View File

@ -502,7 +502,7 @@ if enable_docs
endif endif
prog_fop = find_program( prog_fop = find_program(
'fop', 'fop',
required: feature_docs, required: false,
disabler: true, disabler: true,
) )