1 # This is lame, I know, but meson has no other include mechanism
4 want_man = get_option('man')
5 want_html = get_option('html')
6 xsltproc = find_program('xsltproc',
7 required : want_man == 'true' or want_html == 'true')
8 want_man = want_man != 'false' and xsltproc.found()
9 want_html = want_html != 'false' and xsltproc.found()
14 '--stringparam', 'man.output.quietly', '1',
15 '--stringparam', 'funcsynopsis.style', 'ansi',
16 '--stringparam', 'man.authors.section.enabled', '0',
17 '--stringparam', 'man.copyright.section.enabled', '0',
18 '--stringparam', 'elogind.version', '@0@'.format(meson.project_version()),
20 '@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())]
22 custom_man_xsl = files('custom-man.xsl')
23 custom_html_xsl = files('custom-html.xsl')
24 xslt_cmd = [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags
26 #if 0 /// UNNEEDED by elogind
27 # custom_entities_ent = configure_file(
28 # input : 'custom-entities.ent.in',
29 # output : 'custom-entities.ent',
30 # configuration : conf)
36 foreach tuple : manpages
44 man = stem + '.' + section
48 foreach alias : aliases
49 manaliases += [alias + '.' + section]
50 htmlaliases += [alias + '.html']
53 mandirn = join_paths(get_option('mandir'), 'man' + section)
55 if condition == '' or conf.get(condition, false)
59 output : [man] + manaliases,
60 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
61 #if 0 /// UNNEEDED by elogind
62 # depend_files : custom_entities_ent,
65 install_dir : mandirn)
69 foreach htmlalias : htmlaliases
74 command : ['ln', '-fs', html, '@OUTPUT@'])
76 dst = join_paths(docdir, 'html', htmlalias)
77 cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
78 meson.add_install_script('sh', '-c', cmd)
88 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
89 #if 0 /// UNNEEDED by elogind
90 # depend_files : custom_entities_ent,
94 install_dir : join_paths(docdir, 'html'))
97 source_xml_files += files(tuple[0] + '.xml')
99 message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition))
103 ############################################################
105 have_lxml = run_command(xml_helper_py).returncode() == 0
107 message('python-lxml not available, not making man page indices')
110 elogind_directives_xml = custom_target(
111 'elogind.directives.xml',
112 input : source_xml_files,
113 output : 'elogind.directives.xml',
114 command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files)
116 nonindex_xml_files = source_xml_files + [elogind_directives_xml]
117 elogind_index_xml = custom_target(
119 input : nonindex_xml_files,
120 output : 'elogind.index.xml',
121 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
123 foreach tuple : [['elogind.directives', '7', elogind_directives_xml],
124 ['elogind.index', '7', elogind_index_xml]]
129 html = stem + '.html'
130 man = stem + '.' + section
132 mandirn = join_paths(get_option('mandir'), 'man' + section)
138 command : xslt_cmd + [custom_man_xsl, '@INPUT@'],
139 install : want_man and have_lxml,
140 install_dir : mandirn)
144 if html == 'elogind.index.html'
145 htmlalias = 'index.html'
146 link = custom_target(
150 command : ['ln', '-fs', html, '@OUTPUT@'])
152 dst = join_paths(docdir, 'html', htmlalias)
153 cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
154 meson.add_install_script('sh', '-c', cmd)
164 command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
165 #if 0 /// UNNEEDED by elogind
166 # depend_files : custom_entities_ent,
169 install : want_html and have_lxml,
170 install_dir : join_paths(docdir, 'html'))
174 # cannot use run_target until https://github.com/mesonbuild/meson/issues/1644 is resolved
181 html = custom_target(
184 depends : html_pages,
187 #if 0 /// UNNEEDED in elogind
190 # depends : man_pages + html_pages,
191 # command : ['rsync', '-rlv',
192 # '--delete-excluded',
194 # '--include=*.html',
196 # '--omit-dir-times',
197 # meson.current_build_dir(),
198 # get_option('www-target')])
201 ############################################################
206 output : 'update-man-rules',
207 # slightly strange syntax because of
208 # https://github.com/mesonbuild/meson/issues/1643
209 # and https://github.com/mesonbuild/meson/issues/1512
210 command : ['sh', '-c',
211 'cd @0@ && '.format(meson.build_root()) +
212 'python3 @0@/tools/make-man-rules.py `git ls-files ":/man/*.xml"` >t && '.format(meson.source_root()) +
213 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
214 #if 0 /// UNNEEDED by elogind
215 # depend_files : custom_entities_ent)