3 # input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4 # build_documentation, install_docdir, can_add_dist_script, xsltproc
5 # output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
8 xmllint = find_program('xmllint', required: false)
9 can_parse_and_validate = xmllint.found()
11 validate = get_option('validation') ? 'true' : 'false'
13 dblatex = find_program('dblatex', required: false)
14 can_build_pdf = dblatex.found() or (xsltproc.found() and \
15 find_program('fop', required: false).found())
16 build_pdf_by_default = get_option('build-pdf')
18 # Installation directories are relative to {prefix}.
19 install_tutorialdir = install_docdir / 'tutorial'
21 if not build_documentation
22 # Documentation shall not be built or installed.
23 # Return to the calling meson.build file.
27 # Check if xmllint can be used.
29 can_parse_and_validate = run_command(
30 python3, tutorial_custom_cmd, 'xmllint',
32 meson.current_source_dir() / 'can_use_xmllint.xml',
33 meson.current_build_dir() / 'can_use_xmllint.stamp',
36 if not can_parse_and_validate
37 # The DocBook V5.0 package is called docbook5-xml in Ubuntu,
38 # docbook5-schemas in Fedora. It may have other names in other distros.
39 warning('Can\'t validate XML file.\n' +
40 'xmllint does not support Relax NG schemas and DocBook V5.0.\n' +
41 'DocBook V5.0 support may require docbook5-xml, docbook5-schemas or a similar package.'
46 install_data('..' / 'index.html', install_dir: install_docdir)
47 install_data('..' / 'images' / 'libsigc_logo.gif',
48 '..' / 'images' / 'top.gif',
49 install_dir: install_docdir / 'images')
51 doc_dist_dir = 'untracked' / 'docs' / 'manual' # Relative to MESON_DIST_ROOT
53 sigc_manual_xml = 'libsigc_manual.xml'
54 sigc_manual_pdf = 'libsigc_manual.pdf'
56 # Create an html version of the DocBook.
57 custom_target('manual_html',
58 input: sigc_manual_xml,
61 python3, tutorial_custom_cmd, 'html',
65 build_by_default: true,
67 install_dir: install_tutorialdir
70 if can_parse_and_validate
71 # Parse and possibly validate the DocBook.
72 custom_target('manual_xmllint',
73 input: sigc_manual_xml,
74 output: 'manual_xmllint.stamp',
76 python3, tutorial_custom_cmd, 'xmllint',
81 build_by_default: true,
86 # Create a PDF file of the DocBook.
87 # Prefer dblatex, if both dblatex and fop are available.
88 custom_target('manual_pdf',
89 input: sigc_manual_xml,
90 output: sigc_manual_pdf,
92 python3, tutorial_custom_cmd,
93 dblatex.found() ? 'dblatex' : 'fop',
97 build_by_default: build_pdf_by_default,
101 if can_add_dist_script
102 # Distribute built files.
103 meson.add_dist_script(
104 python3, tutorial_custom_cmd, 'dist_doc',
106 meson.current_build_dir(),
107 meson.current_source_dir() / sigc_manual_xml,
108 meson.current_build_dir() / sigc_manual_pdf,