1entities = configuration_data()
2entities.set('VERSION', meson.project_version())
3version_xml = configure_file(input: 'version.xml.in',
4               output: 'version.xml', configuration:
5               entities)
6
7if get_option('gtk_doc')
8    gnome.gtkdoc('gupnp',
9             content_files : files(
10                'client-tutorial.xml',
11                'fdl-1.1.xml',
12                'glossary.xml',
13                'gupnp-binding-tool.xml',
14                'gupnp-docs.xml',
15                'overview.xml',
16                'server-tutorial.xml'
17             ),
18             main_xml : 'gupnp-docs.xml',
19             src_dir : ['libgupnp'],
20             dependencies : libgupnp,
21             scan_args : ['--ignore-decorators', 'G_DEPRECATED|G_GNUC_DEPRECATED,G_DEPRECATED_FOR'],
22             ignore_headers : [
23                 'gena-protocol.h',
24                 'xml-util.h',
25                 'gvalue-util.h',
26                 'http-headers.h',
27                 'gupnp-context-private.h',
28                 'gupnp-linux-context-manager.h',
29                 'gupnp-network-manager.h',
30                 'gupnp-unix-context-manager.h',
31                 'gupnp-device-info-private.h',
32                 'gupnp-error-private.h',
33                 'gupnp-resource-factory-private.h',
34                 'gupnp-service-introspection-private.h',
35                 'gupnp-service-proxy-action-private.h',
36                 'gupnp-types-private.h'
37             ],
38             install : true)
39endif
40
41xsltproc = find_program('xsltproc', required: false)
42if xsltproc.found()
43    stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
44
45    xlstproc_flags = [
46        '--nonet',
47        '--xinclude',
48        '--path', '@0@:@1@'.format(meson.current_source_dir(), meson.current_build_dir()),
49        '--stringparam', 'man.output.quietly', '1',
50        '--stringparam', 'funcsynopsis.style', 'ansi',
51        '--stringparam', 'man.th.extra1.suppress', '1',
52        '--stringparam', 'man.authors.section.enabled', '1',
53        '--stringparam', 'man.copyright.section.enabled', '1',
54    ]
55
56    xsltproc_args = [
57        xsltproc,
58        xlstproc_flags,
59        '-o', '@OUTPUT@',
60        stylesheet,
61        '@INPUT@'
62    ]
63
64    stylesheet_check = run_command(
65        [
66            xsltproc,
67            xlstproc_flags,
68            '--noout',
69            stylesheet,
70            'gupnp-binding-tool.xml'
71        ]
72    )
73    if (stylesheet_check.returncode() == 0)
74        message('Stylesheet ' + stylesheet + ' available')
75        custom_target(
76            'man 1 pages',
77            input: 'gupnp-binding-tool.xml',
78            output: 'gupnp-binding-tool-1.2.1',
79            command: xsltproc_args,
80            depend_files : version_xml,
81            install: true,
82            install_dir: join_paths(get_option('mandir'), 'man1')
83        )
84    else
85        message('Stylesheet ' + stylesheet + ' not found, not building man page')
86    endif
87endif
88