summaryrefslogtreecommitdiff
path: root/devel-docs/meson.build
blob: 0e91f9da8bec0d9ee3255eea1b01077704a69810 (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
gdbus_codegen = find_program('gdbus-codegen',
                             native: true,
                             required: get_option('docs'))

sphinx_build = find_program('sphinx-build',
                            native: true,
                            required: get_option('docs'))

interfaces_rst_sources = []
interfaces_xml = []

foreach i: introspection_sources
  # /foo/bar/baz.xml -> doc-baz.rst
  doc_name = 'doc-' + fs.replace_suffix(fs.name(i), '.rst')
  interfaces_rst_sources += doc_name

  interfaces_xml += join_paths(meson.project_source_root(), 'xml', i)
endforeach

interfaces_rst = custom_target(
  'interfaces_rst',
  input: interfaces_xml,
  output: interfaces_rst_sources,
  command: [ gdbus_codegen, '--generate-rst', 'devel-docs/doc', '@INPUT@']
)

docs_sources = [
  'atk-deprecations.rst',
  'conf.py',
  'de-controller.rst',
  'gitlab-ci.rst',
  'index.rst',
  'roadmap.rst',
  'toolkits.rst',
  'xml-changes.rst',
  'xml-interfaces.rst',
]

# sphinx-build(1) does not seem to easily support generated files in the build directory.
# So, we'll copy all the source files from the source directory to the build directory,
# and just do the build from there.
copied_docs_sources = []
foreach i: docs_sources
  copied_docs_sources += fs.copyfile(i)
endforeach

custom_target(
  'devel_docs',
  input: copied_docs_sources + interfaces_rst,
  output: 'html',
  command: [ sphinx_build, meson.current_build_dir(), '@OUTPUT@' ],
)