summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-04-11 18:50:13 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2022-05-03 14:00:30 +0200
commite7c9b04f59737a01ec0b0389f598bb9223690a69 (patch)
tree9933c1a76abb8b8a8c26e3ee472f67c11ba577a7
parent1d6a50f76295b3e1a5a8b6d3da5db6de608b2bce (diff)
downloadbubblewrap-e7c9b04f59737a01ec0b0389f598bb9223690a69.tar.gz
build: Auto-detect presence of Docbook XSL stylesheets
This follows the usual feature semantics: they're mandatory if the feature is enabled, aren't checked if the feature is disabled, and are optional if the feature is in the auto state (which is the default for this particular feature). The logic used here is similar to AX_CHECK_DOCBOOK_XSLT in autoconf-archive. Resolves: https://github.com/containers/bubblewrap/issues/500 Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--meson.build17
1 files changed, 16 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 9277ac4..c4ba441 100644
--- a/meson.build
+++ b/meson.build
@@ -124,9 +124,24 @@ bwrap = executable(
dependencies : [selinux_dep, libcap_dep],
)
+manpages_xsl = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
xsltproc = find_program('xsltproc', required : get_option('man'))
+build_man_page = false
if xsltproc.found() and not meson.is_subproject()
+ if run_command([
+ xsltproc, '--nonet', manpages_xsl,
+ ], check : false).returncode() == 0
+ message('Docbook XSL found, man page enabled')
+ build_man_page = true
+ elif get_option('man').enabled()
+ error('Man page requested, but Docbook XSL stylesheets not found')
+ else
+ message('Docbook XSL not found, man page disabled automatically')
+ endif
+endif
+
+if build_man_page
custom_target(
'bwrap.1',
output : 'bwrap.1',
@@ -140,7 +155,7 @@ if xsltproc.found() and not meson.is_subproject()
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
'-o', '@OUTPUT@',
- 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+ manpages_xsl,
'@INPUT@',
],
install : true,