1# XXX: gi-docgen needs a deps file
2expand_content_md_files = [
3  'overview.md',
4  'broadway.md',
5  'osx.md',
6  'wayland.md',
7  'windows.md',
8  'x11.md',
9  'getting_started.md',
10  'initialization.md',
11  'resources.md',
12  'building.md',
13  'compiling.md',
14  'running.md',
15  'migrating-2to4.md',
16  'migrating-3to4.md',
17  'actions.md',
18  'input-handling.md',
19  'drawing-model.md',
20  'css-overview.md',
21  'css-properties.md',
22  'section-accessibility.md',
23  'section-text-widget.md',
24  'section-tree-widget.md',
25  'section-list-widget.md',
26  'question_index.md',
27  'visual_index.md'
28]
29
30if get_option('gtk_doc')
31  gtk4_toml = configure_file(
32    input: 'gtk4.toml.in',
33    output: 'gtk4.toml',
34    configuration: toml_conf,
35    install: true,
36    install_dir: docs_dir / 'gtk4',
37  )
38
39  custom_target('gtk4-doc',
40    input: [ gtk4_toml, gtk_gir[0] ],
41    output: 'gtk4',
42    command: [
43      gidocgen,
44      'generate',
45      '--quiet',
46      '--fatal-warnings',
47      '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
48      '--config=@INPUT0@',
49      '--output-dir=@OUTPUT@',
50      '--no-namespace-dir',
51      '--content-dir=@0@'.format(meson.current_source_dir()),
52      '@INPUT1@',
53    ],
54    depends: [ gdk_gir[0], gsk_gir[0] ],
55    depend_files: [ expand_content_md_files ],
56    build_by_default: true,
57    install: true,
58    install_dir: docs_dir,
59  )
60endif
61
62xsltproc = find_program('xsltproc', required: false)
63if get_option('man-pages') and not xsltproc.found()
64  error('No xsltproc found, but man pages were explicitly enabled')
65endif
66
67if get_option('man-pages') and xsltproc.found()
68  xlstproc_flags = [
69    '--nonet',
70    '--stringparam', 'man.output.quietly', '1',
71    '--stringparam', 'funcsynopsis.style', 'ansi',
72    '--stringparam', 'man.th.extra1.suppress', '1',
73    '--stringparam', 'man.authors.section.enabled', '0',
74    '--stringparam', 'man.copyright.section.enabled', '0',
75  ]
76
77  man_files = [
78    [ 'gtk4-broadwayd', '1', ],
79    [ 'gtk4-builder-tool', '1', ],
80    [ 'gtk4-encode-symbolic-svg', '1', ],
81    [ 'gtk4-launch', '1', ],
82    [ 'gtk4-query-settings', '1', ],
83    [ 'gtk4-update-icon-cache', '1', ],
84  ]
85
86  if get_option('demos')
87    man_files += [
88      [ 'gtk4-demo', '1', ],
89      [ 'gtk4-demo-application', '1', ],
90      [ 'gtk4-widget-factory', '1', ],
91      [ 'gtk4-icon-browser', '1', ],
92    ]
93  endif
94
95  foreach man: man_files
96    man_name = man.get(0)
97    man_section = man.get(1, '1')
98    custom_target('@0@.@1@'.format(man_name, man_section),
99      input: '@0@.xml'.format(man_name),
100      output: '@0@.@1@'.format(man_name, man_section),
101      command: [
102        xsltproc,
103        xlstproc_flags,
104        '-o', '@OUTPUT@',
105        'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
106        '@INPUT@',
107      ],
108      install: true,
109      install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
110    )
111  endforeach
112endif
113