summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-09-27 10:30:58 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-09-27 10:30:58 +0200
commit0a9ee763b22c146727d14a50da0c5bbc82e70435 (patch)
tree74a3b6274d0eb791f5c2c563408595b248802ca0
parent12d6c14dd31ab68de774c881e7393dfafdd8ce8c (diff)
downloadsigc++-0a9ee763b22c146727d14a50da0c5bbc82e70435.tar.gz
docs/manual, Meson config: Check if xmllint can be used
-rw-r--r--Makefile.am1
-rw-r--r--docs/manual/can_use_xmllint.xml15
-rw-r--r--docs/manual/meson.build18
-rw-r--r--meson.build2
-rwxr-xr-xtools/tutorial-custom-cmd.py12
5 files changed, 46 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 9a6f4a8..0d9e4e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,6 +45,7 @@ EXTRA_DIST = \
meson_options.txt \
sigc++config.h.meson \
MSVC_NMake/meson.build \
+ docs/manual/can_use_xmllint.xml \
docs/manual/meson.build \
docs/reference/meson.build \
examples/meson.build \
diff --git a/docs/manual/can_use_xmllint.xml b/docs/manual/can_use_xmllint.xml
new file mode 100644
index 0000000..8ff1b0d
--- /dev/null
+++ b/docs/manual/can_use_xmllint.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<book xmlns="http://docbook.org/ns/docbook"
+ version="5.0" xml:id="index" xml:lang="en">
+
+<title>xmllint test</title>
+
+<chapter xml:id="chapter-introduction">
+<title>Introduction</title>
+ <para>
+ This is a short DocBook V5.0 document. It can be used for testing if the installed
+ version of xmllint or a similar program can validate a DocBook V5.0 document.
+ </para>
+</chapter>
+
+</book>
diff --git a/docs/manual/meson.build b/docs/manual/meson.build
index bc98af9..d2f97b9 100644
--- a/docs/manual/meson.build
+++ b/docs/manual/meson.build
@@ -24,6 +24,24 @@ if not build_documentation
subdir_done()
endif
+# Check if xmllint can be used.
+if xmllint.found()
+ can_parse_and_validate = run_command(
+ python3, tutorial_custom_cmd, 'xmllint',
+ validate,
+ meson.current_source_dir() / 'can_use_xmllint.xml',
+ meson.current_build_dir() / 'can_use_xmllint.stamp',
+ ).returncode() == 0
+ if not can_parse_and_validate
+ # The DocBook V5.0 package is called docbook5-xml in Ubuntu,
+ # docbook5-schemas in Fedora. It may have other names in other distros.
+ warning('Can\'t validate XML file.\n' +
+ 'xmllint does not support Relax NG schemas and DocBook V5.0.\n' +
+ 'DocBook V5.0 support may require docbook5-xml, docbook5-schemas or a similar package.'
+ )
+ endif
+endif
+
install_data('..' / 'index.html', install_dir: install_docdir)
install_data('..' / 'images' / 'libsigc_logo.gif',
'..' / 'images' / 'top.gif',
diff --git a/meson.build b/meson.build
index bc8d264..2c8b829 100644
--- a/meson.build
+++ b/meson.build
@@ -291,7 +291,7 @@ endif
validate = get_option('validation') and can_parse_and_validate
explain_val = ''
if get_option('validation') and not validate
- explain_val = ' (requires xmllint)'
+ explain_val = ' (requires xmllint with Relax NG and DocBook V5.0 support)'
endif
build_pdf = build_pdf_by_default and can_build_pdf
diff --git a/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py
index 50b6a5b..c102968 100755
--- a/tools/tutorial-custom-cmd.py
+++ b/tools/tutorial-custom-cmd.py
@@ -65,6 +65,13 @@ def xmllint():
stamp_file_path = sys.argv[4]
relax_ng_schema = 'http://docbook.org/xml/5.0/rng/docbook.rng'
+ # schematron_schema = 'http://docbook.org/xml/5.0/sch/docbook.sch'
+
+ # Validation against the Schematron schema does not work on Ubuntu 21.04:
+ # file:///usr/share/xml/docbook/schema/schematron/5.0/docbook.sch:6: element rule:
+ # Schemas parser error : Failed to compile context expression db:firstterm[@linkend]
+ # .....
+ # Schematron schema http://docbook.org/xml/5.0/sch/docbook.sch failed to compile
cmd = [
'xmllint',
@@ -73,7 +80,10 @@ def xmllint():
'--xinclude',
]
if validate == 'true':
- cmd += ['--relaxng', relax_ng_schema]
+ cmd += [
+ '--relaxng', relax_ng_schema,
+ #'--schematron', schematron_schema,
+ ]
cmd += [input_xml_file]
result = subprocess.run(cmd)
if result.returncode: