summaryrefslogtreecommitdiff
path: root/doc/man/meson.build
blob: 4c92eab2b02a87125bea949fa2a0b92033167f6e (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
xsltproc = find_program('xsltproc', required: false)

if xsltproc.found()
    stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'

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

    xsltproc_args = [
        xsltproc,
        xlstproc_flags,
        '-o', '@OUTPUT@',
        stylesheet,
        '@INPUT@',
    ]

    man_input_files = [
        'rygel.xml',
        'rygel.conf.xml'
    ]

    man_output_files = [
        'rygel.1',
        'rygel.conf.5'
    ]

    r = run_command(
        [
            xsltproc,
            xlstproc_flags,
            '-o', '/dev/null',
            stylesheet,
            'rygel.xml'
        ]
    )

    if (r.returncode() == 0)
        custom_target(
            'man 1 pages',
            input: 'rygel.xml',
            output: 'rygel.1',
            command: xsltproc_args,
            install: true,
            install_dir: join_paths(get_option('mandir'), 'man1')
        )

        custom_target(
            'man 5 pages',
            input: 'rygel.conf.xml',
            output: 'rygel.conf.5',
            command: xsltproc_args,
            install: true,
            install_dir: join_paths(get_option('mandir'), 'man5')
        )
    else
        error('Cannot bulid man pages, failed to run xsltproc')
    endif
endif