| 1 |
manpages = [] |
| 2 |
|
| 3 |
if rst2man.found() |
| 4 |
manpage_conf = configuration_data() |
| 5 |
manpage_conf.set('DATADIR', datadir) |
| 6 |
manpage_conf.set('SYSCONFDIR', sysconfdir) |
| 7 |
|
| 8 |
rst2man_flags = [ |
| 9 |
'--syntax-highlight=none', |
| 10 |
] |
| 11 |
|
| 12 |
man_pages = [ |
| 13 |
{ 'input': 'portals.conf.rst.in', 'output': 'portals.conf', 'section': '5' }, |
| 14 |
] |
| 15 |
|
| 16 |
foreach man_page: man_pages |
| 17 |
man_input = configure_file( |
| 18 |
input: man_page.get('input'), |
| 19 |
output: man_page.get('input').split('.in').get(0), |
| 20 |
configuration: manpage_conf, |
| 21 |
) |
| 22 |
man_output = man_page.get('output', man_input) |
| 23 |
man_section = man_page.get('section', '1') |
| 24 |
man_full = '@0@.@1@'.format(man_output, man_section) |
| 25 |
|
| 26 |
manpages += custom_target('man-' + man_output, |
| 27 |
input: man_input, |
| 28 |
output: man_full, |
| 29 |
command: [ rst2man, rst2man_flags, '@INPUT@' ], |
| 30 |
capture: true, |
| 31 |
install: true, |
| 32 |
install_dir: get_option('mandir') / 'man@0@'.format(man_section), |
| 33 |
) |
| 34 |
endforeach |
| 35 |
endif |
| 36 |
|
| 37 |
if build_documentation |
| 38 |
# Gather the XML files under data |
| 39 |
all_interfaces_xml = [] |
| 40 |
foreach i: portal_sources |
| 41 |
all_interfaces_xml += i |
| 42 |
endforeach |
| 43 |
foreach i: portal_host_sources |
| 44 |
all_interfaces_xml += i |
| 45 |
endforeach |
| 46 |
foreach i: portal_impl_sources |
| 47 |
all_interfaces_xml += i |
| 48 |
endforeach |
| 49 |
foreach i: background_monitor_sources |
| 50 |
all_interfaces_xml += i |
| 51 |
endforeach |
| 52 |
|
| 53 |
# Replace the extension for gdbus-codegen |
| 54 |
all_interfaces_rst = [] |
| 55 |
foreach i: all_interfaces_xml |
| 56 |
f = fs.name(i) |
| 57 |
all_interfaces_rst += fs.replace_suffix(f, '.rst') |
| 58 |
endforeach |
| 59 |
|
| 60 |
interfaces_rst = custom_target('interfaces_rst', |
| 61 |
input: all_interfaces_xml, |
| 62 |
output: all_interfaces_rst, |
| 63 |
command: [ gdbus_codegen, '--generate-rst', 'doc/doc', '@INPUT@' ], |
| 64 |
) |
| 65 |
|
| 66 |
fix_rst_dbus = find_program('fix-rst-dbus.py') |
| 67 |
fixed_rst_files = custom_target('fix_rst_dbus', |
| 68 |
input: interfaces_rst, |
| 69 |
output: 'rst-dbus.fixed', |
| 70 |
build_always_stale: true, |
| 71 |
build_by_default: true, |
| 72 |
command: [ fix_rst_dbus, meson.current_build_dir(), 'doc', '@INPUT@' ], |
| 73 |
depends: interfaces_rst, |
| 74 |
depend_files: all_interfaces_xml, |
| 75 |
) |
| 76 |
|
| 77 |
docs_sources = [ |
| 78 |
'conf.py', |
| 79 |
'favicon.ico', |
| 80 |
|
| 81 |
'api-reference.rst', |
| 82 |
'architecture.rst', |
| 83 |
'building-and-running.rst', |
| 84 |
'common-conventions.rst', |
| 85 |
'configuration-file.rst', |
| 86 |
'convenience-libraries.rst', |
| 87 |
'documents-and-fuse.rst', |
| 88 |
'for-app-developers.rst', |
| 89 |
'for-contributors.rst', |
| 90 |
'for-desktop-developers.rst', |
| 91 |
'icons.rst', |
| 92 |
'impl-dbus-interfaces.rst', |
| 93 |
'index.rst', |
| 94 |
'merge-requirements.rst', |
| 95 |
'pull-requests.rst', |
| 96 |
'reasons-to-use-portals.rst', |
| 97 |
'requests.rst', |
| 98 |
'sessions.rst', |
| 99 |
'system-integration.rst', |
| 100 |
'terminology.rst', |
| 101 |
'window-identifiers.rst', |
| 102 |
'writing-a-new-backend.rst', |
| 103 |
] |
| 104 |
|
| 105 |
copied_docs_sources = [] |
| 106 |
foreach d: docs_sources |
| 107 |
copied_docs_sources += configure_file(input: d, output: d, copy: true) |
| 108 |
endforeach |
| 109 |
|
| 110 |
docs_inputs = copied_docs_sources + interfaces_rst |
| 111 |
if rst2man.found() |
| 112 |
docs_inputs += manpages |
| 113 |
endif |
| 114 |
|
| 115 |
# Copy static files to the appropriate output subdir |
| 116 |
copy = find_program('copy-subdir.py') |
| 117 |
copytree = find_program('copy-subtree.py') |
| 118 |
|
| 119 |
static_files = [ |
| 120 |
'bullet.svg', |
| 121 |
'card.png', |
| 122 |
'inter.woff2', |
| 123 |
'toc_bullet.svg', |
| 124 |
'xdg.css', |
| 125 |
'xdg-portal-dark.png', |
| 126 |
'xdg-portal-light.png', |
| 127 |
] |
| 128 |
|
| 129 |
foreach f: static_files |
| 130 |
run_command(copy, '_static' / f, '_static' / f) |
| 131 |
endforeach |
| 132 |
|
| 133 |
run_command(copytree, 'img', '_static' / 'img') |
| 134 |
|
| 135 |
sphinx_command = [ sphinx_build ] |
| 136 |
|
| 137 |
if get_option('werror') |
| 138 |
sphinx_command += [ '-W', '--keep-going' ] |
| 139 |
endif |
| 140 |
|
| 141 |
custom_target('docs', |
| 142 |
input: docs_inputs, |
| 143 |
output: 'html', |
| 144 |
command: sphinx_command + [ meson.current_build_dir(), '@OUTPUT@' ], |
| 145 |
build_by_default: true, |
| 146 |
depends: fixed_rst_files, |
| 147 |
depend_files: all_interfaces_xml, |
| 148 |
) |
| 149 |
endif |