summaryrefslogtreecommitdiff
path: root/man/meson.build
blob: 508a53109e118e392d6c3e1fb152ccccf8061dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# SPDX-License-Identifier: GPL-2

man_pages = [
	{
		'section': '1',
		'name': 'minecctl',
	}, {
		'section': '5',
		'name': 'minecproxy.conf',
	}
]

xsltproc = find_program('xsltproc')

xsl = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
xsl_test = run_command(xsltproc, '--nonet', xsl)
if xsl_test.returncode() != 0
	error('The DocBook XSL stylesheet for "@0@" was not found.'.format(xsl))
endif

xsltproc_flags = [
        '--nonet',
        '--stringparam', 'man.output.quietly', '1',
        '--stringparam', 'funcsynopsis.style', 'ansi',
        '--stringparam', 'man.authors.section.enabled', '0',
        '--stringparam', 'man.copyright.section.enabled', '0',
]

xslt_cmd = [xsltproc, xsltproc_flags, '-o', '@OUTPUT0@', xsl, '@INPUT@']

foreach man_page: man_pages
	section = man_page['section']
	name = man_page['name']
	xml_input = name + '.xml'
	man_output = name + '.' + section

	page = custom_target(
		man_output,
		input: xml_input,
		output: man_output,
		command: xslt_cmd,
		build_by_default: true,
		install: true,
		install_dir: join_paths(get_option('mandir'), 'man' + section),
	)
endforeach