Debian Codegraph @

man/meson.build

raw
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 mans = [
4 ['NetworkManager', '8'],
5 ['NetworkManager-dispatcher', '8'],
6 ['NetworkManager-wait-online.service', '8'],
7 ['NetworkManager.conf', '5'],
8 ['nm-online', '1'],
9 ['nmcli-examples', '7'],
10 ['nmcli', '1'],
11 ['nmtui', '1'],
12 ['nm-initrd-generator', '8'],
13 ]
14
15 if enable_ovs
16 mans += [['nm-openvswitch', '7']]
17 endif
18
19 if enable_nm_cloud_setup
20 mans += [['nm-cloud-setup', '8']]
21 endif
22
23 introspection_mans = [
24 ['nm-settings-keyfile', '5'],
25 ['nm-settings-dbus', '5'],
26 ['nm-settings-nmcli', '5'],
27 ]
28
29 if enable_ifcfg_rh
30 introspection_mans += [['nm-settings-ifcfg-rh', '5']]
31 endif
32
33 built_mans = []
34 foreach man: mans + introspection_mans
35 name = man[0] + '.' + man[1]
36 if not fs.exists(name)
37 built_mans = []
38 break
39 endif
40
41 built_mans += name
42 endforeach
43
44 if enable_introspection or enable_docs
45 common_ent_file = configure_file(
46 input: 'common.ent.in',
47 output: '@BASENAME@',
48 configuration: data_conf,
49 )
50 endif
51
52 if enable_introspection and (enable_man or enable_docs)
53 xsltproc_options = [
54 find_program('xsltproc'),
55 '--output', '@OUTPUT@',
56 '--path', meson.current_build_dir(),
57 '--xinclude',
58 '--nonet',
59 '--stringparam', 'man.output.quietly', '1',
60 '--stringparam', 'funcsynopsis.style', 'ansi',
61 '--stringparam', 'man.th.extra1.suppress', '1',
62 '--stringparam', 'man.authors.section.enabled', '0',
63 '--stringparam', 'man.copyright.section.enabled', '0',
64 '--stringparam', 'man.th.title.max.length', '30',
65 ]
66
67 docbook_xls = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
68
69 mans_xmls = []
70
71 foreach man: mans
72 input = man[0] + '.xml'
73 content_files += join_paths(meson.current_source_dir(), input)
74
75 output = '@0@.@1@'.format(man[0], man[1])
76
77 # not needed if only html requested
78 if enable_man
79 custom_target(
80 output,
81 input: input,
82 output: output,
83 command: xsltproc_options + [docbook_xls, '@INPUT@'],
84 depend_files: common_ent_file,
85 install: true,
86 install_dir: join_paths(nm_mandir, 'man' + man[1]),
87 )
88 endif
89 endforeach
90
91 merge_cmd = files(source_root / 'tools' / 'generate-docs-nm-settings-docs-merge.py')
92
93 name = 'dbus'
94 nm_settings_docs_xml_dbus = custom_target(
95 'nm-settings-docs-' + name + '.xml',
96 input: [merge_cmd, nm_property_infos_xml[name], nm_settings_docs_xml_gir[name]],
97 output: 'nm-settings-docs-' + name + '.xml',
98 command: [
99 python_path,
100 merge_cmd,
101 '@OUTPUT@',
102 nm_property_infos_xml[name],
103 nm_settings_docs_xml_gir[name]
104 ],
105 )
106
107 name = 'nmcli'
108 nm_settings_docs_xml_nmcli = custom_target(
109 'nm-settings-docs-' + name + '.xml',
110 input: [merge_cmd, nm_property_infos_xml[name], gen_metadata_nm_settings_nmcli_xml, nm_settings_docs_xml_gir[name]],
111 output: 'nm-settings-docs-' + name + '.xml',
112 command: [
113 python_path,
114 merge_cmd,
115 '@OUTPUT@',
116 '--only-properties-from',
117 gen_metadata_nm_settings_nmcli_xml,
118 nm_property_infos_xml[name],
119 gen_metadata_nm_settings_nmcli_xml,
120 nm_settings_docs_xml_gir[name]
121 ],
122 )
123
124 nm_settings_docs_xml = {
125 'dbus': nm_settings_docs_xml_dbus,
126 'nmcli': nm_settings_docs_xml_nmcli,
127 }
128
129 mans = [
130 ['nm-settings-keyfile', '5', nm_property_infos_xml['keyfile']],
131 ['nm-settings-dbus', '5', nm_settings_docs_xml['dbus']],
132 ['nm-settings-nmcli', '5', nm_settings_docs_xml['nmcli']],
133 ]
134
135 if enable_ifcfg_rh
136 mans += [['nm-settings-ifcfg-rh', '5', nm_property_infos_xml['ifcfg-rh']]]
137 endif
138
139 foreach man: mans
140 output = man[0] + '.xml'
141 template = join_paths(meson.current_source_dir(), man[0] + '.xsl')
142
143 input = custom_target(
144 output,
145 input: [template, man[2]],
146 output: output,
147 command: xsltproc_options + ['@INPUT@'],
148 )
149 content_files += input
150
151 output = '@0@.@1@'.format(man[0], man[1])
152
153 # not needed if only html requested
154 if enable_man
155 custom_target(
156 output,
157 input: input,
158 output: output,
159 command: xsltproc_options + [docbook_xls, '@INPUT@'],
160 install: true,
161 install_dir: join_paths(nm_mandir, 'man' + man[1]),
162 )
163 endif
164 endforeach
165 # not needed if only html requested
166 elif enable_man
167 if built_mans.length() > 0
168 install_man(built_mans)
169 else
170 error('Building manpages requires xsltproc and -Dintrospection=true, and no prebuilt manpages were found. Try building from a release tarball or using -Dman=false.')
171 endif
172 endif