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)
62 if condition == '' or conf.get(condition) == 1
63 file = files(tuple[0] + '.xml')
64 source_xml_files += file
65 if tuple[0].startswith('org.freedesktop.')
73 output : [man] + manaliases,
74 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
75 depends : man_page_depends,
77 install_dir : mandirn)
81 foreach htmlalias : htmlaliases
85 command : [ln, '-fs', html, '@OUTPUT@'])
87 meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
97 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
98 depends : [man_page_depends, p2],
100 install_dir : docdir / 'html')
104 message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition))
108 ############################################################
110 have_lxml = run_command(xml_helper_py, check: false).returncode() == 0
112 message('python-lxml not available, not making man page indices')
115 systemd_directives_xml = custom_target(
116 'systemd.directives.xml',
117 input : ['directives-template.xml', source_xml_files],
118 output : 'systemd.directives.xml',
119 depends : man_page_depends,
120 command : [make_directive_index_py, '@OUTPUT@', '@INPUT@'])
122 nonindex_xml_files = source_xml_files + [systemd_directives_xml]
123 systemd_index_xml = custom_target(
125 input : nonindex_xml_files,
126 output : 'systemd.index.xml',
127 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
129 foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directives_xml],
130 ['systemd.index', '7', systemd_index_xml]] : []
135 html = stem + '.html'
136 man = stem + '.' + section
138 mandirn = get_option('mandir') / ('man' + section)
144 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
145 install : want_man and have_lxml,
146 install_dir : mandirn)
150 if html == 'systemd.index.html'
151 htmlalias = 'index.html'
152 link = custom_target(
156 command : [ln, '-fs', html, '@OUTPUT@'])
158 meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
168 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
169 depends : [man_page_depends, p2],
170 install : want_html and have_lxml,
171 install_dir : docdir / 'html')
175 # Cannot use run_target because those targets are used in depends
176 # Also see https://github.com/mesonbuild/meson/issues/368.
183 html = custom_target(
186 depends : html_pages,
192 depends : man_pages + html_pages,
193 command : [sync_docs_py,
195 '@0@'.format(meson.project_version()),
196 meson.current_build_dir(),
197 get_option('www-target')])
200 ############################################################
202 buildroot_substs = configuration_data()
203 buildroot_substs.set_quoted('BUILD_ROOT', project_build_root)
208 configuration : buildroot_substs)
213 configuration : buildroot_substs)
215 ############################################################
217 update_dbus_docs = custom_target(
218 'update-dbus-docs-impl',
219 output : 'update-dbus-docs',
220 command : [update_dbus_docs_py, '--build-dir', project_build_root, '@INPUT@'],
223 if conf.get('BUILD_MODE_DEVELOPER') == 1
224 test('dbus-docs-fresh',
227 args : ['--build-dir', project_build_root, '--test', dbus_docs],
228 depends : dbus_programs)
230 test('check-version-history',
231 check_version_history_py,
233 args : source_xml_files)
236 update_man_rules = custom_target(
237 'update-man-rules-impl',
238 output : 'update-man-rules',
239 command : [update_man_rules_py,
240 '@0@/man/*.xml'.format(project_source_root),
241 '@0@/rules/meson.build'.format(meson.current_source_dir())],
242 depends : man_page_depends)