1 # This is lame, I know, but meson has no other include mechanism
4 # TODO: add regeneration rule:
5 # python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build
7 want_man = get_option('man')
8 want_html = get_option('html')
9 xsltproc = find_program('xsltproc',
10 required : want_man == 'true' or want_html == 'true')
11 want_man = want_man != 'false' and xsltproc.found()
12 want_html = want_html != 'false' 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@'.format(meson.current_build_dir(), meson.current_source_dir())]
25 custom_man_xsl = files('custom-man.xsl')
26 custom_html_xsl = files('custom-html.xsl')
27 xslt_cmd = [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags
29 custom_entities_ent = configure_file(
30 input : 'custom-entities.ent.in',
31 output : 'custom-entities.ent',
37 foreach tuple : manpages
45 man = stem + '.' + section
49 foreach alias : aliases
50 manaliases += [alias + '.' + section]
51 htmlaliases += [alias + '.html']
54 mandirn = join_paths(get_option('mandir'), 'man' + section)
56 if condition == '' or conf.get(condition, 0) == 1
60 output : [man] + manaliases,
61 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
62 depend_files : custom_entities_ent,
64 install_dir : mandirn)
70 output : [html] + htmlaliases,
71 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
72 depend_files : custom_entities_ent,
74 install_dir : join_paths(docdir, 'html'))
77 source_xml_files += files(tuple[0] + '.xml')
79 message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition))
83 ############################################################
85 have_lxml = run_command(xml_helper_py).returncode() == 0
87 message('python-lxml not available, not making man page indices')
90 systemd_directives_xml = custom_target(
91 'systemd.directives.xml',
92 input : source_xml_files,
93 output : 'systemd.directives.xml',
94 command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files)
96 nonindex_xml_files = source_xml_files + [systemd_directives_xml]
97 systemd_index_xml = custom_target(
99 input : nonindex_xml_files,
100 output : 'systemd.index.xml',
101 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
103 foreach tuple : [['systemd.directives', '7', systemd_directives_xml],
104 ['systemd.index', '7', systemd_index_xml]]
109 html = stem + '.html'
110 man = stem + '.' + section
112 mandirn = join_paths(get_option('mandir'), 'man' + section)
118 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
119 install : want_man and have_lxml,
120 install_dir : mandirn)
127 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
128 install : want_html and have_lxml,
129 install_dir : join_paths(docdir, 'html'))
133 man = custom_target('man',
138 html = custom_target('html',
139 depends : html_pages,
143 custom_target('doc-sync',
144 depends : [man, html],
145 output : ['doc-sync'],
146 command : ['rsync', '-rlv',
152 meson.current_build_dir(),
153 get_option('www-target')])