]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/meson.build
meson: use efi-includedir to look for header
[thirdparty/systemd.git] / man / meson.build
CommitLineData
5c23128d
ZJS
1# -*- mode: meson -*-
2
3# This is lame, I know, but meson has no other include mechanism
4subdir('rules')
5
6# TODO: add regeneration rule:
7# python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build
8
527d43d7
ZJS
9want_man = get_option('man')
10want_html = get_option('html')
11xsltproc = find_program('xsltproc',
4390be30
ZJS
12 required : want_man == 'true' or want_html == 'true')
13want_man = want_man != 'false' and xsltproc.found()
14want_html = want_html != 'false' and xsltproc.found()
527d43d7 15
5c23128d
ZJS
16xsltproc_flags = [
17 '--nonet',
18 '--xinclude',
19 '--stringparam', 'man.output.quietly', '1',
20 '--stringparam', 'funcsynopsis.style', 'ansi',
21 '--stringparam', 'man.authors.section.enabled', '0',
22 '--stringparam', 'man.copyright.section.enabled', '0',
23 '--stringparam', 'systemd.version', '@0@'.format(meson.project_version()),
24 '--path',
25 '@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())]
26
27custom_man_xsl = files('custom-man.xsl')
527d43d7 28custom_html_xsl = files('custom-html.xsl')
04e3eb46
ZJS
29
30custom_entities_ent = configure_file(
31 input : 'custom-entities.ent.in',
32 output : 'custom-entities.ent',
33 configuration : conf)
5c23128d 34
527d43d7
ZJS
35man_pages = []
36html_pages = []
37source_xml_files = []
5c23128d
ZJS
38foreach tuple : manpages
39 stem = tuple[0]
40 section = tuple[1]
41 aliases = tuple[2]
42 condition = tuple[3]
43
44 xml = stem + '.xml'
45 html = stem + '.html'
46 man = stem + '.' + section
47
48 manaliases = []
49 htmlaliases = []
50 foreach alias : aliases
51 manaliases += [alias + '.' + section]
52 htmlaliases += [alias + '.html']
53 endforeach
54
e17e5ba9 55 mandirn = join_paths(get_option('mandir'), 'man' + section)
5c23128d 56
527d43d7
ZJS
57 have = condition == '' or conf.get(condition, 0) == 1
58
59 if have
60 p1 = custom_target(
61 man,
62 input : xml,
63 output : [man] + manaliases,
64 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
65 depend_files : custom_entities_ent,
66 install : want_man,
67 install_dir : mandirn)
68 man_pages += [p1]
69
70 p2 = custom_target(
71 html,
72 input : xml,
73 output : [html] + htmlaliases,
74 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'],
75 depend_files : custom_entities_ent,
76 install : want_html,
e17e5ba9 77 install_dir : join_paths(docdir, 'html'))
527d43d7
ZJS
78 html_pages += [p2]
79
80 source_xml_files += files(tuple[0] + '.xml')
81 else
82 message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, have))
5c23128d
ZJS
83 endif
84endforeach
85
86############################################################
87
b184e8fe
ZJS
88have_lxml = run_command(xml_helper_py).returncode() == 0
89if not have_lxml
90 message('python-lxml not available, not making man page indices')
91endif
92
5c23128d
ZJS
93systemd_directives_xml = custom_target(
94 'systemd.directives.xml',
95 input : source_xml_files,
96 output : 'systemd.directives.xml',
97 command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files)
98
99nonindex_xml_files = source_xml_files + [systemd_directives_xml]
100systemd_index_xml = custom_target(
101 'systemd.index.xml',
102 input : nonindex_xml_files,
103 output : 'systemd.index.xml',
104 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
105
106foreach tuple : [['systemd.directives', '7', systemd_directives_xml],
107 ['systemd.index', '7', systemd_index_xml]]
108 stem = tuple[0]
109 section = tuple[1]
110 xml = tuple[2]
111
112 html = stem + '.html'
113 man = stem + '.' + section
114
e17e5ba9 115 mandirn = join_paths(get_option('mandir'), 'man' + section)
5c23128d 116
527d43d7 117 p1 = custom_target(
5c23128d
ZJS
118 man,
119 input : xml,
120 output : man,
121 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
b184e8fe 122 install : want_man and have_lxml,
5c23128d 123 install_dir : mandirn)
527d43d7 124 man_pages += [p1]
5c23128d 125
527d43d7 126 p2 = custom_target(
5c23128d
ZJS
127 html,
128 input : xml,
129 output : html,
527d43d7 130 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'],
b184e8fe 131 install : want_html and have_lxml,
e17e5ba9 132 install_dir : join_paths(docdir, 'html'))
527d43d7 133 html_pages += [p2]
5c23128d 134endforeach
527d43d7 135
f75d75eb
ZJS
136man = custom_target('man',
137 depends : man_pages,
138 output : 'man',
139 command : ['echo'])
140
141html = custom_target('html',
142 depends : html_pages,
143 output : 'html',
144 command : ['echo'])
145
146custom_target('doc-sync',
147 depends : [man, html],
148 output : ['doc-sync'],
149 command : ['rsync', '-rlv',
150 '--delete-excluded',
151 '--include=man',
152 '--include=*.html',
153 '--exclude=*',
154 '--omit-dir-times',
155 meson.current_build_dir(),
156 get_option('www-target')])