2020-06-18 00:20:37 +00:00
|
|
|
docs_html_dir = docdir / 'html'
|
|
|
|
|
2020-06-18 00:28:33 +00:00
|
|
|
# xsltproc requires that the -o path ends with '/'
|
2021-10-25 17:48:59 +00:00
|
|
|
# Not using '/' operator due to bug in meson 0.60.0
|
|
|
|
# https://github.com/mesonbuild/meson/issues/9450
|
|
|
|
docs_builddir = join_paths(meson.current_build_dir(), '')
|
2020-06-18 00:28:33 +00:00
|
|
|
|
2020-06-18 00:20:37 +00:00
|
|
|
docs_assets = [
|
|
|
|
'android-chrome-192x192.png',
|
|
|
|
'android-chrome-256x256.png',
|
|
|
|
'apple-touch-icon.png',
|
|
|
|
'browserconfig.xml',
|
|
|
|
'favicon.ico',
|
|
|
|
'favicon-16x16.png',
|
|
|
|
'favicon-32x32.png',
|
|
|
|
'manifest.json',
|
|
|
|
'mstile-150x150.png',
|
|
|
|
]
|
|
|
|
|
2020-06-18 00:24:51 +00:00
|
|
|
docs_html_in_files = [
|
|
|
|
'index',
|
|
|
|
]
|
|
|
|
|
2020-06-18 00:25:19 +00:00
|
|
|
docs_rst_files = [
|
2021-03-12 10:12:47 +00:00
|
|
|
'aclpolkit',
|
2020-06-18 00:25:19 +00:00
|
|
|
'advanced-tests',
|
2021-03-12 10:53:13 +00:00
|
|
|
'api',
|
2022-03-07 15:38:05 +00:00
|
|
|
'api_extension',
|
2021-03-12 11:14:57 +00:00
|
|
|
'apps',
|
2021-03-12 11:04:40 +00:00
|
|
|
'auditlog',
|
2021-03-04 16:48:12 +00:00
|
|
|
'auth',
|
2020-06-18 00:25:19 +00:00
|
|
|
'best-practices',
|
2022-03-07 15:38:05 +00:00
|
|
|
'bindings',
|
2022-03-07 13:39:24 +00:00
|
|
|
'bugs',
|
2022-03-10 16:57:53 +00:00
|
|
|
'cgroups',
|
2020-06-18 00:25:19 +00:00
|
|
|
'ci',
|
2022-07-12 11:15:07 +00:00
|
|
|
'ci-dashboard',
|
2022-03-21 14:11:35 +00:00
|
|
|
'ci-runners',
|
2020-06-18 00:25:19 +00:00
|
|
|
'coding-style',
|
|
|
|
'committer-guidelines',
|
2021-03-12 07:34:15 +00:00
|
|
|
'compiling',
|
2022-03-10 15:09:32 +00:00
|
|
|
'contact',
|
2022-03-07 13:29:40 +00:00
|
|
|
'contribute',
|
2022-04-04 12:49:54 +00:00
|
|
|
'csharp',
|
2020-06-18 00:25:19 +00:00
|
|
|
'daemons',
|
2021-03-23 23:10:39 +00:00
|
|
|
'dbus',
|
2022-04-04 14:14:31 +00:00
|
|
|
'docs',
|
2022-03-10 14:32:04 +00:00
|
|
|
'downloads',
|
2022-03-07 15:09:03 +00:00
|
|
|
'drivers',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvbhyve',
|
2021-05-12 17:01:31 +00:00
|
|
|
'drvch',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvesx',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvhyperv',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvlxc',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvnodedev',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvopenvz',
|
2022-03-07 15:38:05 +00:00
|
|
|
'drvqemu',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvsecret',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvtest',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvvbox',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvvirtuozzo',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvvmware',
|
2022-03-10 16:57:53 +00:00
|
|
|
'drvxen',
|
2022-03-07 13:46:22 +00:00
|
|
|
'errors',
|
2022-03-10 16:57:53 +00:00
|
|
|
'firewall',
|
2022-03-10 16:57:53 +00:00
|
|
|
'format',
|
2020-06-18 00:25:19 +00:00
|
|
|
'formatbackup',
|
2022-04-08 08:25:27 +00:00
|
|
|
'formatcaps',
|
2020-06-18 00:25:19 +00:00
|
|
|
'formatcheckpoint',
|
2020-07-10 15:09:35 +00:00
|
|
|
'formatdomain',
|
2022-03-10 16:57:53 +00:00
|
|
|
'formatdomaincaps',
|
2022-04-08 08:25:27 +00:00
|
|
|
'formatnetwork',
|
2022-04-13 12:26:17 +00:00
|
|
|
'formatnetworkport',
|
2022-04-08 08:25:27 +00:00
|
|
|
'formatnode',
|
2021-03-25 15:02:59 +00:00
|
|
|
'formatnwfilter',
|
2022-03-07 15:16:58 +00:00
|
|
|
'formatsecret',
|
2022-03-04 14:55:40 +00:00
|
|
|
'formatsnapshot',
|
2021-12-14 14:35:41 +00:00
|
|
|
'formatstorage',
|
2022-03-10 16:57:54 +00:00
|
|
|
'formatstoragecaps',
|
2022-04-13 12:26:17 +00:00
|
|
|
'formatstorageencryption',
|
2020-09-24 12:22:17 +00:00
|
|
|
'glib-adoption',
|
2022-03-04 16:08:31 +00:00
|
|
|
'goals',
|
2022-03-07 15:02:55 +00:00
|
|
|
'governance',
|
2020-06-18 00:25:19 +00:00
|
|
|
'hacking',
|
2022-03-10 16:57:54 +00:00
|
|
|
'hooks',
|
2022-05-26 08:51:33 +00:00
|
|
|
'issue-handling',
|
2022-03-10 16:57:54 +00:00
|
|
|
'java',
|
2020-06-18 00:25:19 +00:00
|
|
|
'libvirt-go',
|
|
|
|
'libvirt-go-xml',
|
2022-03-10 16:57:54 +00:00
|
|
|
'logging',
|
2018-11-20 00:12:17 +00:00
|
|
|
'macos',
|
2021-12-01 15:30:34 +00:00
|
|
|
'migration',
|
2020-06-18 00:25:19 +00:00
|
|
|
'newreposetup',
|
2022-03-10 15:25:15 +00:00
|
|
|
'nss',
|
2020-06-18 00:25:19 +00:00
|
|
|
'pci-addresses',
|
2022-03-10 15:28:52 +00:00
|
|
|
'pci-hotplug',
|
2022-03-10 16:57:54 +00:00
|
|
|
'php',
|
2020-06-18 00:25:19 +00:00
|
|
|
'platforms',
|
|
|
|
'programming-languages',
|
2021-03-25 15:58:44 +00:00
|
|
|
'python',
|
2022-04-08 08:25:27 +00:00
|
|
|
'remote',
|
2022-03-07 13:56:53 +00:00
|
|
|
'securityprocess',
|
2021-03-29 20:24:40 +00:00
|
|
|
'storage',
|
2022-03-04 16:11:45 +00:00
|
|
|
'strategy',
|
2020-06-18 00:25:19 +00:00
|
|
|
'styleguide',
|
|
|
|
'submitting-patches',
|
2022-03-07 13:54:23 +00:00
|
|
|
'support',
|
2022-03-10 15:23:24 +00:00
|
|
|
'testapi',
|
2022-07-12 11:32:58 +00:00
|
|
|
'testing',
|
2022-03-10 15:34:51 +00:00
|
|
|
'testtck',
|
2022-04-14 12:30:30 +00:00
|
|
|
'uri',
|
2021-03-25 17:08:51 +00:00
|
|
|
'windows',
|
2020-06-18 00:25:19 +00:00
|
|
|
]
|
|
|
|
|
2020-07-23 16:40:12 +00:00
|
|
|
# list of web targets to build for docs/web rule
|
|
|
|
install_web_deps = []
|
|
|
|
install_web_files = []
|
|
|
|
|
2020-06-18 00:20:37 +00:00
|
|
|
install_data(docs_assets, install_dir: docs_html_dir)
|
2020-06-25 12:31:59 +00:00
|
|
|
|
2020-07-23 16:16:14 +00:00
|
|
|
aclperms_gen = custom_target(
|
|
|
|
'aclperms.htmlinc',
|
|
|
|
input: access_perm_h,
|
|
|
|
output: 'aclperms.htmlinc',
|
|
|
|
command: [
|
2020-11-09 13:52:10 +00:00
|
|
|
meson_python_prog, python3_prog, genaclperms_prog, '@INPUT@',
|
2020-07-23 16:16:14 +00:00
|
|
|
],
|
|
|
|
capture: true,
|
|
|
|
)
|
|
|
|
|
2020-06-29 20:14:13 +00:00
|
|
|
docs_timestamp = run_command(
|
2022-10-07 07:43:33 +00:00
|
|
|
python3_prog, meson_timestamp_prog.full_path(), env: runutf8, check: true,
|
2020-06-29 20:14:13 +00:00
|
|
|
).stdout().strip()
|
|
|
|
|
2020-06-18 00:24:03 +00:00
|
|
|
site_xsl = files('site.xsl')
|
|
|
|
page_xsl = files('page.xsl')
|
|
|
|
newapi_xsl = files('newapi.xsl')
|
|
|
|
|
2020-06-25 12:31:59 +00:00
|
|
|
docs_api_generated = custom_target(
|
|
|
|
'generate-api',
|
|
|
|
output: [
|
|
|
|
'libvirt-api.xml',
|
|
|
|
'libvirt-lxc-api.xml',
|
|
|
|
'libvirt-qemu-api.xml',
|
|
|
|
'libvirt-admin-api.xml',
|
|
|
|
],
|
|
|
|
command: [
|
2020-11-09 13:52:10 +00:00
|
|
|
meson_python_prog, python3_prog, apibuild_prog,
|
2020-06-25 12:31:59 +00:00
|
|
|
meson.current_source_dir(),
|
|
|
|
meson.current_build_dir(),
|
|
|
|
],
|
|
|
|
install: true,
|
|
|
|
install_dir: pkgdatadir / 'api',
|
|
|
|
depend_files: [
|
|
|
|
libvirt_common_h_in,
|
|
|
|
libvirt_include,
|
|
|
|
driver_sources,
|
|
|
|
libvirt_qemu_sources,
|
|
|
|
libvirt_lxc_sources,
|
|
|
|
admin_sources,
|
|
|
|
util_public_sources,
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
docs_api_xml = docs_api_generated[0]
|
|
|
|
docs_lxc_api_xml = docs_api_generated[1]
|
|
|
|
docs_qemu_api_xml = docs_api_generated[2]
|
|
|
|
docs_admin_api_xml = docs_api_generated[3]
|
2020-06-18 00:23:00 +00:00
|
|
|
|
2022-01-13 08:40:56 +00:00
|
|
|
docs_programs_groups = [
|
|
|
|
{ 'name': 'rst2html5', 'prog': [ 'rst2html5', 'rst2html5.py', 'rst2html5-3' ] },
|
|
|
|
{ 'name': 'rst2man', 'prog': [ 'rst2man', 'rst2man.py', 'rst2man-3' ] },
|
|
|
|
]
|
|
|
|
|
|
|
|
foreach item : docs_programs_groups
|
|
|
|
prog = find_program(item.get('prog'), dirs: libvirt_sbin_path)
|
|
|
|
varname = item.get('name').underscorify()
|
2022-10-07 07:43:33 +00:00
|
|
|
conf.set_quoted(varname.to_upper(), prog.full_path())
|
2022-01-13 08:40:56 +00:00
|
|
|
set_variable('@0@_prog'.format(varname), prog)
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
# There are two versions of rst2html5 in the wild: one is the version
|
|
|
|
# coming from the docutils package, and the other is the one coming
|
|
|
|
# from the rst2html5 package. These versions are subtly different,
|
|
|
|
# and the libvirt documentation can only be successfully generated
|
|
|
|
# using the docutils version. Every now and then, users will report
|
|
|
|
# build failures that can be traced back to having the wrong version
|
|
|
|
# installed.
|
|
|
|
#
|
|
|
|
# The only reliable way to tell the two binaries apart seems to be
|
|
|
|
# looking look at their version information: the docutils version
|
|
|
|
# will report
|
|
|
|
#
|
|
|
|
# rst2html5 (Docutils ..., Python ..., on ...)
|
|
|
|
#
|
|
|
|
# whereas the rst2html5 version will report
|
|
|
|
#
|
|
|
|
# rst2html5 ... (Docutils ..., Python ..., on ...)
|
|
|
|
#
|
|
|
|
# with the additional bit of information being the version number for
|
|
|
|
# the rst2html5 package itself.
|
|
|
|
#
|
|
|
|
# Use this knowledge to detect the version that we know doesn't work
|
|
|
|
# for building libvirt and reject it
|
2022-01-22 19:30:11 +00:00
|
|
|
rst2html5_version = run_command(rst2html5_prog, '--version', check: true)
|
2022-01-13 08:40:56 +00:00
|
|
|
rst2html5_version = rst2html5_version.stdout().split(' ')
|
|
|
|
if rst2html5_version[1] != '(Docutils'
|
|
|
|
error('Please uninstall the rst2html5 package and install the docutils package')
|
|
|
|
endif
|
|
|
|
|
2021-08-09 14:48:58 +00:00
|
|
|
docs_rst2html5_gen = generator(
|
|
|
|
rst2html5_prog,
|
2020-06-18 00:23:00 +00:00
|
|
|
output: '@BASENAME@.html.in',
|
2020-08-03 05:32:29 +00:00
|
|
|
arguments: [ '--stylesheet=', '--strict', '@INPUT@' ],
|
2020-06-18 00:23:00 +00:00
|
|
|
capture: true,
|
|
|
|
)
|
2020-06-18 00:24:51 +00:00
|
|
|
|
2020-06-18 00:25:19 +00:00
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
# html_xslt_gen config
|
|
|
|
|
|
|
|
html_xslt_gen_install_dir = docs_html_dir
|
|
|
|
|
|
|
|
html_xslt_gen = []
|
|
|
|
# html_xslt_gen:
|
2020-06-18 00:25:19 +00:00
|
|
|
# each entry is a dictionary with following items:
|
2020-10-13 15:14:53 +00:00
|
|
|
# name - base file name (required), output file will become 'name.html'
|
|
|
|
# file - input file (optional, 'name.html.in' assumed if missing)
|
2020-08-03 14:38:31 +00:00
|
|
|
# source - source filename relative to repository root (optional, if there is no source)
|
2020-10-13 09:32:59 +00:00
|
|
|
# depends - explicit dependency on other input (optional)
|
2020-06-18 00:25:19 +00:00
|
|
|
|
2020-07-22 18:20:43 +00:00
|
|
|
foreach name : docs_html_in_files
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen += {
|
2020-07-22 18:20:43 +00:00
|
|
|
'name': name,
|
2020-10-13 15:14:53 +00:00
|
|
|
'source': 'docs' / name + '.html.in',
|
2020-07-22 18:20:43 +00:00
|
|
|
}
|
|
|
|
endforeach
|
|
|
|
|
2020-06-18 00:25:19 +00:00
|
|
|
foreach name : docs_rst_files
|
|
|
|
rst_file = '@0@.rst'.format(name)
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen += {
|
2020-06-18 00:25:19 +00:00
|
|
|
'name': name,
|
2021-08-09 14:48:58 +00:00
|
|
|
'file': docs_rst2html5_gen.process(rst_file),
|
2020-08-03 14:38:31 +00:00
|
|
|
'source': 'docs' / rst_file,
|
2020-06-18 00:25:19 +00:00
|
|
|
}
|
|
|
|
endforeach
|
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen += {
|
|
|
|
'name': 'acl',
|
2020-10-13 09:32:59 +00:00
|
|
|
'source': 'docs' / 'acl.html.in',
|
|
|
|
'depends': aclperms_gen,
|
|
|
|
}
|
|
|
|
|
2022-04-05 14:52:57 +00:00
|
|
|
html_xslt_gen += {
|
|
|
|
'name': '404',
|
|
|
|
'source': 'docs' / '404.html.in',
|
|
|
|
'href_base': '/',
|
|
|
|
}
|
|
|
|
|
2020-06-25 12:32:40 +00:00
|
|
|
hvsupport_html_in = custom_target(
|
|
|
|
'hvsupport.html.in',
|
|
|
|
output: 'hvsupport.html.in',
|
|
|
|
command: [
|
|
|
|
meson_python_prog,
|
2020-11-09 13:52:10 +00:00
|
|
|
python3_prog,
|
|
|
|
hvsupport_prog,
|
2022-10-07 07:37:43 +00:00
|
|
|
meson.project_source_root(),
|
2022-10-07 07:31:32 +00:00
|
|
|
meson.project_build_root(),
|
2020-06-25 12:32:40 +00:00
|
|
|
],
|
|
|
|
capture: true,
|
|
|
|
depend_files: [
|
|
|
|
public_sym_file,
|
|
|
|
libvirt_qemu_syms,
|
|
|
|
libvirt_lxc_syms,
|
|
|
|
driver_header,
|
|
|
|
],
|
|
|
|
depends: [
|
|
|
|
docs_api_generated,
|
|
|
|
],
|
|
|
|
)
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen += {
|
2020-06-25 12:32:40 +00:00
|
|
|
'name': 'hvsupport',
|
|
|
|
'file': hvsupport_html_in,
|
|
|
|
}
|
|
|
|
|
2022-10-07 07:37:43 +00:00
|
|
|
news_html_in = docs_rst2html5_gen.process(meson.project_source_root() / 'NEWS.rst')
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen += {
|
2020-06-25 12:32:55 +00:00
|
|
|
'name': 'news',
|
|
|
|
'file': news_html_in,
|
2020-07-22 18:20:43 +00:00
|
|
|
'source': 'NEWS.rst',
|
2020-06-25 12:32:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
# The following code between the markers must be kept identical with the other
|
|
|
|
# copies of the code in various subdirs, since meson doesn't support any kind
|
|
|
|
# of functions.
|
|
|
|
|
|
|
|
# --- begin of XSLT processing ---
|
2020-06-18 00:25:19 +00:00
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
foreach data : html_xslt_gen
|
|
|
|
html_filename = data['name'] + '.html'
|
|
|
|
|
|
|
|
html_file = custom_target(
|
|
|
|
html_filename,
|
|
|
|
input: data.get('file', data['name'] + '.html.in'),
|
|
|
|
output: html_filename,
|
2020-06-18 00:25:19 +00:00
|
|
|
command: [
|
2020-10-12 14:13:08 +00:00
|
|
|
xsltproc_prog,
|
|
|
|
'--stringparam', 'pagesrc', data.get('source', ''),
|
2022-10-07 07:31:32 +00:00
|
|
|
'--stringparam', 'builddir', meson.project_build_root(),
|
2020-10-12 14:13:08 +00:00
|
|
|
'--stringparam', 'timestamp', docs_timestamp,
|
2022-04-05 14:52:57 +00:00
|
|
|
'--stringparam', 'href_base', data.get('href_base', ''),
|
2020-10-12 14:13:08 +00:00
|
|
|
'--nonet',
|
2022-04-05 14:52:57 +00:00
|
|
|
site_xsl,
|
2020-06-18 00:25:19 +00:00
|
|
|
'@INPUT@',
|
|
|
|
],
|
2020-10-13 09:32:59 +00:00
|
|
|
depends: data.get('depends', []),
|
2020-06-18 00:25:19 +00:00
|
|
|
depend_files: [ page_xsl ],
|
2020-10-12 14:13:08 +00:00
|
|
|
capture: true,
|
2020-06-18 00:25:19 +00:00
|
|
|
install: true,
|
2020-10-13 15:14:53 +00:00
|
|
|
install_dir: html_xslt_gen_install_dir,
|
2020-06-18 00:25:19 +00:00
|
|
|
)
|
2020-07-23 16:40:12 +00:00
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
install_web_deps += html_file
|
|
|
|
install_web_files += html_file.full_path() + ':' + html_xslt_gen_install_dir
|
2020-06-18 00:25:19 +00:00
|
|
|
endforeach
|
2020-06-18 00:27:09 +00:00
|
|
|
|
2020-10-13 15:14:53 +00:00
|
|
|
html_xslt_gen = []
|
|
|
|
|
|
|
|
# --- end of XSLT processing ---
|
|
|
|
|
2021-12-21 15:10:13 +00:00
|
|
|
subdir('css')
|
2020-06-18 00:27:48 +00:00
|
|
|
subdir('fonts')
|
2021-05-25 10:42:32 +00:00
|
|
|
subdir('go')
|
2020-06-18 00:28:33 +00:00
|
|
|
subdir('html')
|
2021-12-21 11:11:25 +00:00
|
|
|
subdir('images')
|
2020-06-18 00:30:14 +00:00
|
|
|
subdir('js')
|
2020-06-18 00:30:40 +00:00
|
|
|
subdir('kbase')
|
2020-06-18 00:31:31 +00:00
|
|
|
subdir('logos')
|
2020-06-25 12:33:22 +00:00
|
|
|
subdir('manpages')
|
2020-06-18 00:27:09 +00:00
|
|
|
|
|
|
|
foreach file : docs_assets
|
2020-07-23 16:40:12 +00:00
|
|
|
# This hack enables us to view the web pages
|
|
|
|
# from within the uninstalled build tree
|
2020-06-18 00:27:09 +00:00
|
|
|
configure_file(input: file, output: file, copy: true)
|
2020-07-23 16:40:12 +00:00
|
|
|
|
|
|
|
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir)
|
2020-06-18 00:27:09 +00:00
|
|
|
endforeach
|
2020-07-23 16:40:12 +00:00
|
|
|
|
|
|
|
run_target(
|
|
|
|
'install-web',
|
|
|
|
command: [
|
2022-10-07 07:43:33 +00:00
|
|
|
meson_python_prog, python3_prog.full_path(), meson_install_web_prog.full_path(),
|
2020-07-23 16:40:12 +00:00
|
|
|
install_web_files,
|
|
|
|
],
|
|
|
|
depends: install_web_deps,
|
|
|
|
)
|
2022-05-31 13:15:57 +00:00
|
|
|
|
|
|
|
test(
|
|
|
|
'check-html-references',
|
|
|
|
python3_prog,
|
|
|
|
args: [
|
2022-10-07 07:43:33 +00:00
|
|
|
check_html_references_prog.full_path(),
|
2022-05-31 13:15:57 +00:00
|
|
|
'--prefix',
|
2022-10-07 07:31:32 +00:00
|
|
|
meson.project_build_root() / 'docs'
|
2022-05-31 13:15:57 +00:00
|
|
|
],
|
|
|
|
env: runutf8,
|
|
|
|
)
|