| 1 |
build_hotdoc = false |
| 2 |
|
| 3 |
if meson.is_cross_build() |
| 4 |
if get_option('doc').enabled() |
| 5 |
error('Documentation enabled but building the doc while cross building is not supported yet.') |
| 6 |
endif |
| 7 |
|
| 8 |
message('Documentation not built as building it while cross building is not supported yet.') |
| 9 |
subdir_done() |
| 10 |
endif |
| 11 |
|
| 12 |
if static_build |
| 13 |
if get_option('doc').enabled() |
| 14 |
error('Documentation enabled but not supported when building statically.') |
| 15 |
endif |
| 16 |
|
| 17 |
message('Building statically, can\'t build the documentation') |
| 18 |
subdir_done() |
| 19 |
endif |
| 20 |
|
| 21 |
plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json') |
| 22 |
if gst_dep.type_name() == 'internal' |
| 23 |
gst_proj = subproject('gstreamer') |
| 24 |
plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator') |
| 25 |
else |
| 26 |
plugins_cache_generator = find_program('gst-plugins-doc-cache-generator', |
| 27 |
dirs: [join_paths(gst_dep.get_variable('libexecdir', default_value: ''), 'gstreamer-' + api_version)], |
| 28 |
required: false) |
| 29 |
endif |
| 30 |
|
| 31 |
if plugins.length() == 0 |
| 32 |
message('All ugly plugins have been disabled') |
| 33 |
elif plugins_cache_generator.found() |
| 34 |
gst_plugins_doc_dep = custom_target('ugly-plugins-doc-cache', |
| 35 |
command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'], |
| 36 |
input: plugins, |
| 37 |
output: 'gst_plugins_cache.json', |
| 38 |
build_always_stale: true, |
| 39 |
) |
| 40 |
else |
| 41 |
warning('GStreamer plugin inspector for documentation not found, can\'t update the cache') |
| 42 |
endif |
| 43 |
|
| 44 |
if get_option('doc').disabled() |
| 45 |
subdir_done() |
| 46 |
endif |
| 47 |
|
| 48 |
build_hotdoc = true |
| 49 |
docconf = configuration_data() |
| 50 |
docconf.set('GST_API_VERSION', api_version) |
| 51 |
|
| 52 |
configure_file(input : 'gst_api_version.in', |
| 53 |
output : 'gst_api_version.md', |
| 54 |
configuration : docconf) |
| 55 |
|
| 56 |
root_rel = '..' |
| 57 |
excludes = [] |
| 58 |
foreach f: [] |
| 59 |
excludes += [join_paths(meson.current_source_dir(), root_rel, '..', f)] |
| 60 |
endforeach |
| 61 |
|
| 62 |
doc_source_file = configure_file(output: 'doc_sources.json', configuration: plugin_sources, output_format: 'json') |
| 63 |
|
| 64 |
plugin_libraries = {} |
| 65 |
|
| 66 |
foreach plugin: plugins |
| 67 |
if plugin.name().startswith('gst') |
| 68 |
plugin_name = plugin.name().substring(3) |
| 69 |
else |
| 70 |
plugin_name = plugin.name() |
| 71 |
endif |
| 72 |
|
| 73 |
plugin_libraries += { |
| 74 |
plugin_name: plugin.full_path() |
| 75 |
} |
| 76 |
endforeach |
| 77 |
|
| 78 |
doc_plugin_libs_file = configure_file(output: 'doc_plugin_libs.json', configuration: plugin_libraries, output_format: 'json') |
| 79 |
|
| 80 |
cdir = meson.current_source_dir() |
| 81 |
plugin_hotdoc_configs = custom_target( |
| 82 |
'build-hotdoc-configs', |
| 83 |
command: [ |
| 84 |
plugins_cache_generator, |
| 85 |
'hotdoc-config', |
| 86 |
'--builddir', meson.current_build_dir(), |
| 87 |
'--project_version', api_version, |
| 88 |
'--sitemap', cdir / 'sitemap.txt', |
| 89 |
'--index', cdir / 'index.md', |
| 90 |
'--gst_index', cdir / 'index.md', |
| 91 |
'--gst_c_source_filters', excludes, |
| 92 |
'--gst_cache_file', '@INPUT@', |
| 93 |
'--output', '@OUTPUT@', |
| 94 |
'--gst_c_source_file', doc_source_file, |
| 95 |
'--gst_plugin_libraries_file', doc_plugin_libs_file, |
| 96 |
], |
| 97 |
input: plugins_cache, |
| 98 |
output: 'hotdoc-configs.json', |
| 99 |
) |