1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# docs/manual
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
# build_documentation, install_docdir, can_add_dist_script, xsltproc
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
# install_tutorialdir
xmllint = find_program('xmllint', required: false)
can_parse_and_validate = xmllint.found()
validate = get_option('validation') ? 'true' : 'false'
dblatex = find_program('dblatex', required: false)
can_build_pdf = dblatex.found() or (xsltproc.found() and \
find_program('fop', required: false).found())
build_pdf_by_default = get_option('build-pdf')
# Installation directories are relative to {prefix}.
install_tutorialdir = install_docdir / 'tutorial'
if not build_documentation
# Documentation shall not be built or installed.
# Return to the calling meson.build file.
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',
install_dir: install_docdir / 'images')
doc_dist_dir = 'untracked' / 'docs' / 'manual' # Relative to MESON_DIST_ROOT
sigc_manual_xml = 'libsigc_manual.xml'
sigc_manual_pdf = 'libsigc_manual.pdf'
# Create an html version of the DocBook.
custom_target('manual_html',
input: sigc_manual_xml,
output: 'html',
command: [
python3, tutorial_custom_cmd, 'html',
'@INPUT@',
'@OUTPUT@',
],
build_by_default: true,
install: true,
install_dir: install_tutorialdir
)
if can_parse_and_validate
# Parse and possibly validate the DocBook.
custom_target('manual_xmllint',
input: sigc_manual_xml,
output: 'manual_xmllint.stamp',
command: [
python3, tutorial_custom_cmd, 'xmllint',
validate,
'@INPUT@',
'@OUTPUT@'
],
build_by_default: true,
)
endif
if can_build_pdf
# Create a PDF file of the DocBook.
# Prefer dblatex, if both dblatex and fop are available.
custom_target('manual_pdf',
input: sigc_manual_xml,
output: sigc_manual_pdf,
command: [
python3, tutorial_custom_cmd,
dblatex.found() ? 'dblatex' : 'fop',
'@INPUT@',
'@OUTPUT@'
],
build_by_default: build_pdf_by_default,
)
endif
if can_add_dist_script
# Distribute built files.
meson.add_dist_script(
python3.path(), tutorial_custom_cmd, 'dist_doc',
doc_dist_dir,
meson.current_build_dir(),
meson.current_source_dir() / sigc_manual_xml,
meson.current_build_dir() / sigc_manual_pdf,
)
endif
|