1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # This is lame, I know, but meson has no other include mechanism
6 want_man = get_option('man')
7 want_html = get_option('html')
8 xsltproc = find_program('xsltproc',
9 required : want_man.enabled() or want_html.enabled())
10 want_man = want_man.allowed() and xsltproc.found()
11 want_html = want_html.allowed() and xsltproc.found()
17 '--stringparam', 'man.output.quietly', '1',
18 '--stringparam', 'funcsynopsis.style', 'ansi',
19 '--stringparam', 'man.authors.section.enabled', '0',
20 '--stringparam', 'man.copyright.section.enabled', '0',
21 '--stringparam', 'systemd.version', '@0@'.format(meson.project_version()),
23 '@0@:@1@:@2@'.format(meson.current_build_dir(),
24 meson.current_source_dir(),
27 custom_man_xsl = files('custom-man.xsl')
28 custom_html_xsl = files('custom-html.xsl')
29 xslt_cmd = [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags
31 custom_entities_ent = custom_target(
32 'custom-entities.ent',
33 input : 'custom-entities.ent.in',
34 output : 'custom-entities.ent',
35 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'])
37 man_page_depends += custom_entities_ent
43 foreach tuple : manpages
51 man = stem + '.' + section
55 foreach alias : aliases
56 manaliases += alias + '.' + section
57 htmlaliases += alias + '.html'
60 mandirn = get_option('mandir') / ('man' + section)
63 foreach word : condition.split()
64 if conf.get(word) != 1
71 file = files(tuple[0] + '.xml')
72 source_xml_files += file
73 if tuple[0].startswith('org.freedesktop.')
81 output : [man] + manaliases,
82 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
83 depends : man_page_depends,
85 install_dir : mandirn)
89 foreach htmlalias : htmlaliases
93 command : [ln, '-fs', html, '@OUTPUT@'])
95 meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
105 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
106 depends : [man_page_depends, p2],
108 install_dir : docdir / 'html')
112 message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition))
116 ############################################################
118 have_lxml = run_command(xml_helper_py, check: false).returncode() == 0
120 message('python-lxml not available, not making man page indices')
123 systemd_directives_xml = custom_target(
124 'systemd.directives.xml',
125 input : ['directives-template.xml', source_xml_files],
126 output : 'systemd.directives.xml',
127 depends : man_page_depends,
128 command : [make_directive_index_py, '@OUTPUT@', '@INPUT@'])
130 nonindex_xml_files = source_xml_files + [systemd_directives_xml]
131 systemd_index_xml = custom_target(
133 input : nonindex_xml_files,
134 output : 'systemd.index.xml',
135 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
137 foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directives_xml],
138 ['systemd.index', '7', systemd_index_xml]] : []
143 html = stem + '.html'
144 man = stem + '.' + section
146 mandirn = get_option('mandir') / ('man' + section)
152 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
153 install : want_man and have_lxml,
154 install_dir : mandirn)
158 if html == 'systemd.index.html'
159 htmlalias = 'index.html'
160 link = custom_target(
164 command : [ln, '-fs', html, '@OUTPUT@'])
166 meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
176 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
177 depends : [man_page_depends, p2],
178 install : want_html and have_lxml,
179 install_dir : docdir / 'html')
183 # Cannot use run_target because those targets are used in depends
184 # Also see https://github.com/mesonbuild/meson/issues/368.
191 html = custom_target(
194 depends : html_pages,
200 depends : man_pages + html_pages,
201 command : [sync_docs_py,
203 '@0@'.format(meson.project_version()),
204 meson.current_build_dir(),
205 get_option('www-target')])
208 ############################################################
210 buildroot_substs = configuration_data()
211 buildroot_substs.set_quoted('BUILD_ROOT', project_build_root)
216 configuration : buildroot_substs)
221 configuration : buildroot_substs)
223 ############################################################
225 update_dbus_docs = custom_target(
226 'update-dbus-docs-impl',
227 output : 'update-dbus-docs',
228 command : [update_dbus_docs_py, '--build-dir', project_build_root, '@INPUT@'],
231 if conf.get('BUILD_MODE_DEVELOPER') == 1
232 test('dbus-docs-fresh',
235 args : ['--build-dir', project_build_root, '--test', dbus_docs],
236 depends : dbus_programs)
238 test('check-version-history',
239 check_version_history_py,
241 args : source_xml_files)
244 update_man_rules = custom_target(
245 'update-man-rules-impl',
246 output : 'update-man-rules',
247 command : [update_man_rules_py,
248 '@0@/man/*.xml'.format(project_source_root),
249 '@0@/rules/meson.build'.format(meson.current_source_dir())],
250 depends : man_page_depends)
252 ############################################################
254 simple_examples = files(
255 'event-quick-child.c',
257 'id128-app-specific.c',
258 'inotify-watch-tmp.c',
259 'journal-enumerate-fields.c',
260 'journal-iterate-foreach.c',
261 'journal-iterate-poll.c',
262 'journal-iterate-unique.c',
263 'journal-iterate-wait.c',
264 'journal-stream-fd.c',
265 'logcontrol-example.c',
266 'notify-selfcontained-example.c',
268 'print-unit-path-call-method.c',
270 'sd-bus-container-append.c',
271 'sd-bus-container-read.c',
272 'sd_bus_error-example.c',
273 'sd_bus_service_reconnect.c',
274 'send-unit-files-changed.c',
279 foreach example : simple_examples
280 examples += [ { 'file' : example } ]
283 if conf.get('HAVE_GLIB') == 1
286 'file' : files('glib-event-glue.c'),
288 '-I', libglib.get_variable('includedir') / 'glib-2.0',
289 '-I', libglib.get_variable('libdir') / 'glib-2.0/include',
303 '-Wno-unused-parameter',
305 '-I', meson.current_source_dir() / '../src',
309 [ '-std=c90', '-Wno-pedantic', '-Wno-variadic-macros', ],
314 [ '-std=gnu90', '-Wno-pedantic', '-Wno-variadic-macros', ],
322 foreach std : std_args_in
323 if cc.has_argument(std[0])
328 foreach item : examples
329 foreach std : std_args
330 file = item.get('file')
331 test('cc-' + fs.stem(file) + '-' + std[0].split('=')[1],
334 args : default_args + std + item.get('opts', []) + [file])