Debian Codegraph @

doc/meson.build

raw
1 # Copyright © 2019-2020 Salamandar <[email protected]>
2 # SPDX-License-Identifier: MIT
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
10 #
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 # SOFTWARE.
21
22 # XML files used for Man and html doc
23 xmls_mans_htmls_names = [
24 'dbus-cleanup-sockets.1',
25 'dbus-daemon.1',
26 'dbus-launch.1',
27 'dbus-monitor.1',
28 'dbus-run-session.1',
29 'dbus-send.1',
30 'dbus-test-tool.1',
31 'dbus-update-activation-environment.1',
32 'dbus-uuidgen.1',
33 ]
34 xml_files = []
35 man_html_list = []
36 foreach xml_in : xmls_mans_htmls_names
37 xml_file = configure_file(
38 input : xml_in + '.xml.in',
39 output: xml_in + '.xml',
40 configuration: data_config,
41 )
42 man_html_list += {
43 'xml' : xml_file,
44 'man' : xml_in,
45 'html' : xml_in + '.html',
46 }
47 xml_files += xml_file
48 endforeach
49
50 # XML files used for html doc
51 xmls_names = [
52 'dbus-faq',
53 'dbus-specification',
54 'dbus-test-plan',
55 'dbus-tutorial',
56 ]
57 html_list = []
58 foreach xml_in : xmls_names
59 html_list += {
60 'xml' : xml_in + '.xml',
61 'html' : xml_in + '.html',
62 }
63 endforeach
64
65 # uploaded and distributed, but not installed
66 static_docs = files(
67 'dbus-api-design.duck',
68 'dbus-faq.xml',
69 'dbus-specification.xml',
70 'dbus-test-plan.xml',
71 'dbus-tutorial.xml',
72 'dcop-howto.txt',
73 'introspect.xsl',
74 )
75
76 ###############################################################################
77 # Install man files
78
79 if build_xml_docs
80 foreach man: man_html_list
81 custom_target(man.get('man'),
82 input: man.get('xml'),
83 output: man.get('man'),
84 command: [
85 xsltproc,
86 '--nonet',
87 '--xinclude',
88 '--stringparam', 'man.output.quietly', '1',
89 '-o', '@OUTPUT@',
90 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
91 '@INPUT@',
92 ],
93 install: true,
94 install_dir: get_option('mandir') / 'man1',
95 )
96 endforeach
97 endif
98
99 ###############################################################################
100 # Install html doc files
101
102 html_files = []
103 if build_xml_docs
104 foreach man: man_html_list + html_list
105 html_files += custom_target(man.get('html'),
106 input: man.get('xml'),
107 output: man.get('html'),
108 command: [
109 xsltproc,
110 '--nonet',
111 '--xinclude',
112 '--stringparam', 'generate.consistent.ids', '1',
113 '-o', '@OUTPUT@',
114 'http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl',
115 '@INPUT@',
116 ],
117 install: true,
118 install_dir: docs_dir,
119 )
120 endforeach
121 endif
122
123 docs_files = [
124 'system-activation.txt',
125 'diagram.png',
126 'diagram.svg',
127 ]
128
129 install_data(
130 sources: docs_files,
131 install_dir: docs_dir,
132 )
133
134 configure_file(
135 input: 'index.html.in',
136 output: 'index.html',
137 configuration: data_config,
138 install_dir: docs_dir,
139 )
140
141 ###############################################################################
142 # Install dtd files
143
144
145 xml_dir = get_option('datadir') / 'xml' / 'dbus-1'
146 dtd_files = [
147 'busconfig.dtd',
148 'introspect.dtd',
149 ]
150
151 install_data(
152 sources: dtd_files,
153 install_dir: xml_dir,
154 )
155
156 configure_file(
157 input: 'catalog.xml.in',
158 output: 'catalog.xml',
159 install_dir: xml_dir,
160 configuration: {'DBUS_DTD_DIR': get_option('prefix') / xml_dir},
161 )
162
163 ###############################################################################
164 # Doxygen
165 if doxygen.found()
166 qch_dir = get_option('qch_dir')
167 if qch_dir == ''
168 qch_dir = docs_dir
169 endif
170
171 doxyfile = configure_file(
172 input: '../Doxyfile.in',
173 output: 'Doxyfile',
174 configuration: data_config,
175 )
176
177 dbus_srcs = run_command(
178 python,
179 files('list-doc-source.py'),
180 meson.project_source_root() / 'dbus',
181 check: true
182 ).stdout().strip().split('\n')
183 dbus_srcs += dbus_arch_deps_h
184
185 doxygen_tgt = custom_target('doxygen',
186 input: doxyfile,
187 output: 'api',
188 depend_files: dbus_srcs,
189 command: [doxygen, doxyfile],
190 )
191 alias_target('doxygen', doxygen_tgt)
192
193 meson.add_install_script(
194 'meson_post_install.py',
195 meson.current_build_dir(),
196 docs_dir,
197 meson.current_build_dir() / 'api/qch/dbus-@[email protected]'.format(version),
198 qch_dir,
199 # ignored further arguments, but for dependency
200 doxygen_tgt,
201 )
202
203 if xsltproc.found()
204 custom_target('dbus.devhelp2',
205 input: 'doxygen_to_devhelp.xsl',
206 output: 'dbus.devhelp2',
207 depends: [doxygen_tgt],
208 command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@', meson.current_build_dir() / 'api/xml/index.xml' ],
209 install: true,
210 install_dir: docs_dir,
211 )
212 endif
213 endif
214
215 if ducktype.found() and yelpbuild.found()
216 design_page = custom_target('dbus-api-design.page',
217 input: 'dbus-api-design.duck',
218 output: 'dbus-api-design.page',
219 command: [ ducktype, '-o', '@OUTPUT@', '@INPUT@' ],
220 )
221 html_files += custom_target('dbus-api-design.html',
222 input: design_page,
223 output: [
224 'dbus-api-design.html',
225 'yelp.js',
226 'C.css',
227 'highlight.pack.js',
228 ],
229 command: [
230 yelpbuild, 'html',
231 '-o', meson.current_build_dir(),
232 '@INPUT@',
233 ],
234 install: true,
235 install_dir: docs_dir,
236 )
237 endif
238
239 if can_upload_docs
240 run_target('maintainer-upload-docs',
241 command: [
242 find_program('maintainer-upload-docs.sh'),
243 files(docs_files),
244 files(dtd_files),
245 static_docs,
246 html_files,
247 xml_files,
248 bonus_files,
249 ],
250 depends: doxygen_tgt,
251 )
252 endif