summaryrefslogtreecommitdiff
path: root/doc/meson.build
blob: 3e5f52a854a0d82496d81d24f052e0d597e19ada (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# XML files used for Man and html doc
xmls_mans_htmls_names = [
    'dbus-cleanup-sockets.1',
    'dbus-daemon.1',
    'dbus-launch.1',
    'dbus-monitor.1',
    'dbus-run-session.1',
    'dbus-send.1',
    'dbus-test-tool.1',
    'dbus-update-activation-environment.1',
    'dbus-uuidgen.1',
]
xml_files = []
man_html_list = []
foreach xml_in : xmls_mans_htmls_names
    xml_file = configure_file(
        input : xml_in + '.xml.in',
        output: xml_in + '.xml',
        configuration: data_config,
    )
    man_html_list += {
        'xml'   : xml_file,
        'man'   : xml_in,
        'html'  : xml_in + '.html',
    }
    xml_files += xml_file
endforeach

# XML files used for html doc
xmls_names = [
    'dbus-faq',
    'dbus-specification',
    'dbus-test-plan',
    'dbus-tutorial',
]
html_list = []
foreach xml_in : xmls_names
    html_list += {
        'xml'   : xml_in + '.xml',
        'html'  : xml_in + '.html',
    }
endforeach

# uploaded and distributed, but not installed
static_docs = files(
    'dbus-api-design.duck',
    'dbus-faq.xml',
    'dbus-specification.xml',
    'dbus-test-plan.xml',
    'dbus-tutorial.xml',
    'dcop-howto.txt',
    'introspect.xsl',
)

###############################################################################
# Install man files

if build_xml_docs
    foreach man: man_html_list
        custom_target(man.get('man'),
            input: man.get('xml'),
            output: man.get('man'),
            command: [
                xsltproc,
                '--nonet',
                '--xinclude',
                '--stringparam', 'man.output.quietly', '1',
                '-o', '@OUTPUT@',
                'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
                '@INPUT@',
            ],
            install: true,
            install_dir: get_option('mandir') / 'man1',
        )
    endforeach
endif

###############################################################################
# Install html doc files

html_files = []
if build_xml_docs
    foreach man: man_html_list + html_list
        html_files += custom_target(man.get('html'),
            input: man.get('xml'),
            output: man.get('html'),
            command: [
                xsltproc,
                '--nonet',
                '--xinclude',
                '--stringparam', 'generate.consistent.ids', '1',
                '-o', '@OUTPUT@',
                'http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl',
                '@INPUT@',
            ],
            install: true,
            install_dir: docs_dir,
        )
    endforeach
endif

docs_files = [
    'system-activation.txt',
    'diagram.png',
    'diagram.svg',
]

install_data(
    sources: docs_files,
    install_dir: docs_dir,
)

configure_file(
    input: 'index.html.in',
    output: 'index.html',
    configuration: data_config,
    install_dir: docs_dir,
)

###############################################################################
# Install dtd files


xml_dir = get_option('datadir') / 'xml' / 'dbus-1'
dtd_files = [
    'busconfig.dtd',
    'introspect.dtd',
]

install_data(
    sources: dtd_files,
    install_dir: xml_dir,
)

configure_file(
    input: 'catalog.xml.in',
    output: 'catalog.xml',
    install_dir: xml_dir,
    configuration: {'DBUS_DTD_DIR': get_option('prefix') / xml_dir},
)

###############################################################################
# Doxygen
if doxygen.found()
    qch_dir = get_option('qch_dir')
    if qch_dir == ''
        qch_dir = docs_dir
    endif

    doxyfile = configure_file(
        input: '../Doxyfile.in',
        output: 'Doxyfile',
        configuration: data_config,
    )

    dbus_srcs = run_command(
        python,
        files('list-doc-source.py'),
        meson.project_source_root() / 'dbus',
        check: true
    ).stdout().strip().split('\n')
    dbus_srcs += dbus_arch_deps_h

    doxygen_tgt = custom_target('doxygen',
        input: doxyfile,
        output: 'api',
        depend_files: dbus_srcs,
        command: [doxygen, doxyfile],
    )
    alias_target('doxygen', doxygen_tgt)

    meson.add_install_script(
        'meson_post_install.py',
        meson.current_build_dir(),
        docs_dir,
        meson.current_build_dir() / 'api/qch/dbus-@0@.qch'.format(version),
        qch_dir,
        # ignored further arguments, but for dependency
        doxygen_tgt,
    )

    if xsltproc.found()
        custom_target('dbus.devhelp2',
            input: 'doxygen_to_devhelp.xsl',
            output: 'dbus.devhelp2',
            depends: [doxygen_tgt],
            command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@', meson.current_build_dir() / 'api/xml/index.xml' ],
            install: true,
            install_dir: docs_dir,
        )
    endif
endif

if ducktype.found() and yelpbuild.found()
    design_page = custom_target('dbus-api-design.page',
        input: 'dbus-api-design.duck',
        output: 'dbus-api-design.page',
        command: [ ducktype, '-o', '@OUTPUT@', '@INPUT@' ],
    )
    html_files += custom_target('dbus-api-design.html',
        input: design_page,
        output: [
            'dbus-api-design.html',
            'yelp.js',
            'C.css',
            'highlight.pack.js',
        ],
        command: [
            yelpbuild, 'html',
            '-o', meson.current_build_dir(),
            '@INPUT@',
        ],
        install: true,
        install_dir: docs_dir,
    )
endif

if can_upload_docs
  run_target('maintainer-upload-docs',
      command: [
          find_program('maintainer-upload-docs.sh'),
          files(docs_files),
          files(dtd_files),
          static_docs,
          html_files,
          xml_files,
          bonus_files,
      ],
      depends: doxygen_tgt,
  )
endif