aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-05-18 07:52:11 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-05-18 07:52:12 -0700
commitf0b95ab6b8192d84338496a0b6fd8f2c08a4a3a8 (patch)
tree8f99ce982a26a4ca54d67cd6e1cd86236887da5c /docs
parent266ccbb27b3ec6661f22395ec2c41d854c94d761 (diff)
parentfe3ab4eb2de46076cbafcbc86b22e71ad24894c6 (diff)
downloadqemu-f0b95ab6b8192d84338496a0b6fd8f2c08a4a3a8.zip
qemu-f0b95ab6b8192d84338496a0b6fd8f2c08a4a3a8.tar.gz
qemu-f0b95ab6b8192d84338496a0b6fd8f2c08a4a3a8.tar.bz2
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* kvm: enable dirty ring for arm64 * target/i386: new features * target/i386: AVX fixes * configure: create a python venv unconditionally * meson: bump to 0.63.0 and move tests from configure * meson: Pass -j option to sphinx * drop support for Python 3.6 * fix check-python-tox * fix "make clean" in the source directory # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmRmDYQUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroOXSwf/WKmYPe09yHfxfVSFsSz83QpB3e+f # KJx6FdyMMt26ZQJpcqorobrDV23R8FyxngXPkwoxqobAEtXB/AH0/S/u8RUZ46Qt # IrF8FXr4ZdyLW7CW6nmIejmlul0iRmFD7D98E6dZ3QXfype3Ifra7gG74spZ1B44 # ZNvaomJKUK8Ga8rbChs9KtgrxlOC5q8IfTWF5ZExmZszPC9NRnZmU5Oncnuwek9T # Ic6zDPoAeF3jDtovZhxg1HAB9e/ENZX/V9NjO92yZa8u/TITQ88l4tJctf7uiLxO # 2oGY12ln8i//pbjyUe4iM+bNh5+reAChEI8iv7WxEsj9s2HBUJ68f3tpbQ== # =Zg00 # -----END PGP SIGNATURE----- # gpg: Signature made Thu 18 May 2023 04:35:32 AM PDT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (68 commits) docs/devel: update build system docs configure: remove unnecessary check configure: reorder option parsing code configure: remove unnecessary mkdir configure: do not rerun the tests with -Werror configure: remove compiler sanity check build: move --disable-debug-info to meson build: move compiler version check to meson build: move remaining compiler flag tests to meson build: move warning flag selection to meson build: move stack protector flag selection to meson build: move coroutine backend selection to meson build: move SafeStack tests to meson build: move sanitizer tests to meson meson: prepare move of QEMU_CFLAGS to meson configure, meson: move --enable-modules to Meson configure: remove pkg-config functions build: move glib detection and workarounds to meson meson: drop unnecessary declare_dependency() meson: add more version numbers to the summary ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'docs')
-rw-r--r--docs/about/build-platforms.rst2
-rw-r--r--docs/conf.py9
-rw-r--r--docs/devel/acpi-bits.rst6
-rw-r--r--docs/devel/build-system.rst290
-rw-r--r--docs/devel/testing.rst14
-rw-r--r--docs/meson.build14
-rw-r--r--docs/sphinx/dbusdomain.py4
-rw-r--r--docs/sphinx/fakedbusdoc.py5
-rw-r--r--docs/sphinx/qmp_lexer.py5
9 files changed, 212 insertions, 137 deletions
diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst
index 89cae5a..0e2cb9e 100644
--- a/docs/about/build-platforms.rst
+++ b/docs/about/build-platforms.rst
@@ -98,7 +98,7 @@ Python runtime
option of the ``configure`` script to point QEMU to a supported
version of the Python runtime.
- As of QEMU |version|, the minimum supported version of Python is 3.6.
+ As of QEMU |version|, the minimum supported version of Python is 3.7.
Python build dependencies
Some of QEMU's build dependencies are written in Python. Usually these
diff --git a/docs/conf.py b/docs/conf.py
index 00767b0..c687ff2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -32,15 +32,6 @@ import sphinx
from distutils.version import LooseVersion
from sphinx.errors import ConfigError
-# Make Sphinx fail cleanly if using an old Python, rather than obscurely
-# failing because some code in one of our extensions doesn't work there.
-# In newer versions of Sphinx this will display nicely; in older versions
-# Sphinx will also produce a Python backtrace but at least the information
-# gets printed...
-if sys.version_info < (3,6):
- raise ConfigError(
- "QEMU requires a Sphinx that uses Python 3.6 or better\n")
-
# The per-manual conf.py will set qemu_docdir for a single-manual build;
# otherwise set it here if this is an entire-manual-set build.
# This is always the absolute path of the docs/ directory in the source tree.
diff --git a/docs/devel/acpi-bits.rst b/docs/devel/acpi-bits.rst
index 22e2580..9677b00 100644
--- a/docs/devel/acpi-bits.rst
+++ b/docs/devel/acpi-bits.rst
@@ -61,19 +61,19 @@ Under ``tests/avocado/`` as the root we have:
::
$ make check-venv (needed only the first time to create the venv)
- $ ./tests/venv/bin/avocado run -t acpi tests/avocado
+ $ ./pyvenv/bin/avocado run -t acpi tests/avocado
The above will run all acpi avocado tests including this one.
In order to run the individual tests, perform the following:
::
- $ ./tests/venv/bin/avocado run tests/avocado/acpi-bits.py --tap -
+ $ ./pyvenv/bin/avocado run tests/avocado/acpi-bits.py --tap -
The above will produce output in tap format. You can omit "--tap -" in the
end and it will produce output like the following:
::
- $ ./tests/venv/bin/avocado run tests/avocado/acpi-bits.py
+ $ ./pyvenv/bin/avocado run tests/avocado/acpi-bits.py
Fetching asset from tests/avocado/acpi-bits.py:AcpiBitsTest.test_acpi_smbios_bits
JOB ID : eab225724da7b64c012c65705dc2fa14ab1defef
JOB LOG : /home/anisinha/avocado/job-results/job-2022-10-10T17.58-eab2257/job.log
diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 1894721..551c5a5 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -4,30 +4,14 @@ The QEMU build system architecture
This document aims to help developers understand the architecture of the
QEMU build system. As with projects using GNU autotools, the QEMU build
-system has two stages, first the developer runs the "configure" script
+system has two stages; first the developer runs the "configure" script
to determine the local build environment characteristics, then they run
-"make" to build the project. There is about where the similarities with
+"make" to build the project. This is about where the similarities with
GNU autotools end, so try to forget what you know about them.
+The two general ways to perform a build are as follows:
-Stage 1: configure
-==================
-
-The QEMU configure script is written directly in shell, and should be
-compatible with any POSIX shell, hence it uses #!/bin/sh. An important
-implication of this is that it is important to avoid using bash-isms on
-development platforms where bash is the primary host.
-
-In contrast to autoconf scripts, QEMU's configure is expected to be
-silent while it is checking for features. It will only display output
-when an error occurs, or to show the final feature enablement summary
-on completion.
-
-Because QEMU uses the Meson build system under the hood, only VPATH
-builds are supported. There are two general ways to invoke configure &
-perform a build:
-
- - VPATH, build artifacts outside of QEMU source tree entirely::
+ - build artifacts outside of QEMU source tree entirely::
cd ../
mkdir build
@@ -35,88 +19,122 @@ perform a build:
../qemu/configure
make
- - VPATH, build artifacts in a subdir of QEMU source tree::
+ - build artifacts in a subdir of QEMU source tree::
mkdir build
cd build
../configure
make
-The configure script automatically recognizes
-command line options for which a same-named Meson option exists;
-dashes in the command line are replaced with underscores.
+Most of the actual build process uses Meson under the hood, therefore
+build artifacts cannot be placed in the source tree itself.
+
+
+Stage 1: configure
+==================
+
+The configure script has five tasks:
+
+ - detect the host architecture
-Many checks on the compilation environment are still found in configure
-rather than ``meson.build``, but new checks should be added directly to
-``meson.build``.
+ - list the targets for which to build emulators; the list of
+ targets also affects which firmware binaries and tests to build
+
+ - find the compilers (native and cross) used to build executables,
+ firmware and tests. The results are written as either Makefile
+ fragments (``config-host.mak``) or a Meson machine file
+ (``config-meson.cross``)
+
+ - create a virtual environment in which all Python code runs during
+ the build, and possibly install packages into it from PyPI
+
+ - invoke Meson in the virtual environment, to perform the actual
+ configuration step for the emulator build
+
+The configure script automatically recognizes command line options for
+which a same-named Meson option exists; dashes in the command line are
+replaced with underscores.
+
+Almost all QEMU developers that need to modify the build system will
+only be concerned with Meson, and therefore can skip the rest of this
+section.
+
+
+Modifying ``configure``
+-----------------------
+
+``configure`` is a shell script; it uses ``#!/bin/sh`` and therefore
+should be compatible with any POSIX shell. It is important to avoid
+using bash-isms to avoid breaking development platforms where bash is
+the primary host.
+
+The configure script provides a variety of functions to help writing
+portable shell code and providing consistent behavior across architectures
+and operating systems:
+
+``error_exit $MESSAGE $MORE...``
+ Print $MESSAGE to stderr, followed by $MORE... and then exit from the
+ configure script with non-zero status.
-Patches are also welcome to move existing checks from the configure
-phase to ``meson.build``. When doing so, ensure that ``meson.build`` does
-not use anymore the keys that you have removed from ``config-host.mak``.
-Typically these will be replaced in ``meson.build`` by boolean variables,
-``get_option('optname')`` invocations, or ``dep.found()`` expressions.
-In general, the remaining checks have little or no interdependencies,
-so they can be moved one by one.
+``has $COMMAND``
+ Determine if $COMMAND exists in the current environment, either as a
+ shell builtin, or executable binary, returning 0 on success. The
+ replacement in Meson is ``find_program()``.
-Helper functions
-----------------
+``probe_target_compiler $TARGET``
+ Detect a cross compiler and cross tools for the QEMU target $TARGET (e.g.,
+ ``$CPU-softmmu``, ``$CPU-linux-user``, ``$CPU-bsd-user``). If a working
+ compiler is present, return success and set variables ``$target_cc``,
+ ``$target_ar``, etc. to non-empty values.
-The configure script provides a variety of helper functions to assist
-developers in checking for system features:
+``write_target_makefile``
+ Write a Makefile fragment to stdout, exposing the result of the most
+ ``probe_target_compiler`` call as the usual Make variables (``CC``,
+ ``AR``, ``LD``, etc.).
-``do_cc $ARGS...``
- Attempt to run the system C compiler passing it $ARGS...
-``do_cxx $ARGS...``
- Attempt to run the system C++ compiler passing it $ARGS...
+Configure does not generally perform tests for compiler options beyond
+basic checks to detect the host platform and ensure the compiler is
+functioning. These are performed using a few more helper functions:
``compile_object $CFLAGS``
Attempt to compile a test program with the system C compiler using
$CFLAGS. The test program must have been previously written to a file
- called $TMPC. The replacement in Meson is the compiler object ``cc``,
- which has methods such as ``cc.compiles()``,
- ``cc.check_header()``, ``cc.has_function()``.
+ called $TMPC.
``compile_prog $CFLAGS $LDFLAGS``
Attempt to compile a test program with the system C compiler using
$CFLAGS and link it with the system linker using $LDFLAGS. The test
program must have been previously written to a file called $TMPC.
- The replacement in Meson is ``cc.find_library()`` and ``cc.links()``.
-
-``has $COMMAND``
- Determine if $COMMAND exists in the current environment, either as a
- shell builtin, or executable binary, returning 0 on success. The
- replacement in Meson is ``find_program()``.
``check_define $NAME``
- Determine if the macro $NAME is defined by the system C compiler
+ Determine if the macro $NAME is defined by the system C compiler.
-``check_include $NAME``
- Determine if the include $NAME file is available to the system C
- compiler. The replacement in Meson is ``cc.has_header()``.
+``do_compiler $CC $ARGS...``
+ Attempt to run the C compiler $CC, passing it $ARGS... This function
+ does not use flags passed via options such as ``--extra-cflags``, and
+ therefore can be used to check for cross compilers. However, most
+ such checks are done at ``make`` time instead (see for example the
+ ``cc-option`` macro in ``pc-bios/option-rom/Makefile``).
``write_c_skeleton``
Write a minimal C program main() function to the temporary file
- indicated by $TMPC
+ indicated by $TMPC.
-``error_exit $MESSAGE $MORE...``
- Print $MESSAGE to stderr, followed by $MORE... and then exit from the
- configure script with non-zero status
-``query_pkg_config $ARGS...``
- Run pkg-config passing it $ARGS. If QEMU is doing a static build,
- then --static will be automatically added to $ARGS
+Python virtual environments and the QEMU build system
+-----------------------------------------------------
+TBD
Stage 2: Meson
==============
-The Meson build system is currently used to describe the build
-process for:
+The Meson build system describes the build and install process for:
1) executables, which include:
- - Tools - ``qemu-img``, ``qemu-nbd``, ``qga`` (guest agent), etc
+ - Tools - ``qemu-img``, ``qemu-nbd``, ``qemu-ga`` (guest agent), etc
- System emulators - ``qemu-system-$ARCH``
@@ -126,7 +144,8 @@ process for:
2) documentation
-3) ROMs, which can be either installed as binary blobs or compiled
+3) ROMs, whether provided as binary blobs in the QEMU distributions
+ or cross compiled under the direction of the configure script
4) other data files, such as icons or desktop files
@@ -281,8 +300,7 @@ system/userspace emulation target
Adding checks
-------------
-New checks should be added to Meson. Compiler checks can be as simple as
-the following::
+Compiler checks can be as simple as the following::
config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h'))
@@ -311,8 +329,7 @@ dependency will be used::
sdl_image = not_found
if not get_option('sdl_image').auto() or have_system
sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
- method: 'pkg-config',
- static: enable_static)
+ method: 'pkg-config')
endif
This avoids warnings on static builds of user-mode emulators, for example.
@@ -360,22 +377,30 @@ script, which may point to something other than the first python3
binary on the path.
-Stage 3: makefiles
-==================
+Stage 3: Make
+=============
-The use of GNU make is required with the QEMU build system.
+The next step in building QEMU is to invoke make. GNU Make is required
+to build QEMU, and may be installed as ``gmake`` on some hosts.
-The output of Meson is a build.ninja file, which is used with the Ninja
-build system. QEMU uses a different approach, where Makefile rules are
-synthesized from the build.ninja file. The main Makefile includes these
-rules and wraps them so that e.g. submodules are built before QEMU.
-The resulting build system is largely non-recursive in nature, in
-contrast to common practices seen with automake.
+The output of Meson is a ``build.ninja`` file, which is used with the
+Ninja build tool. However, QEMU's build comprises other components than
+just the emulators (namely firmware and the tests in ``tests/tcg``) which
+need different cross compilers. The QEMU Makefile wraps both Ninja and
+the smaller build systems for firmware and tests; it also takes care of
+running ``configure`` again when the script changes. Apart from invoking
+these sub-Makefiles, the resulting build is largely non-recursive.
-Tests are also ran by the Makefile with the traditional ``make check``
-phony target, while benchmarks are run with ``make bench``. Meson test
-suites such as ``unit`` can be ran with ``make check-unit`` too. It is also
-possible to run tests defined in meson.build with ``meson test``.
+Tests, whether defined in ``meson.build`` or not, are also ran by the
+Makefile with the traditional ``make check`` phony target, while benchmarks
+are run with ``make bench``. Meson test suites such as ``unit`` can be ran
+with ``make check-unit``, and ``make check-tcg`` builds and runs "non-Meson"
+tests for all targets.
+
+If desired, it is also possible to use ``ninja`` and ``meson test``,
+respectively to build emulators and run tests defined in meson.build.
+The main difference is that ``make`` needs the ``-jN`` flag in order to
+enable parallel builds or tests.
Useful make targets
-------------------
@@ -387,6 +412,7 @@ Useful make targets
Print the value of the variable VAR. Useful for debugging the build
system.
+
Important files for the build system
====================================
@@ -400,8 +426,7 @@ number of dynamically created files listed later.
``Makefile``
The main entry point used when invoking make to build all the components
of QEMU. The default 'all' target will naturally result in the build of
- every component. Makefile takes care of recursively building submodules
- directly via a non-recursive set of rules.
+ every component.
``*/meson.build``
The meson.build file in the root directory is the main entry point for the
@@ -410,59 +435,92 @@ number of dynamically created files listed later.
other meson.build files spread throughout the QEMU source tree.
``tests/Makefile.include``
- Rules for external test harnesses. These include the TCG tests,
- ``qemu-iotests`` and the Avocado-based integration tests.
+ Rules for external test harnesses. These include the TCG tests
+ and the Avocado-based integration tests.
``tests/docker/Makefile.include``
- Rules for Docker tests. Like tests/Makefile, this file is included
- directly by the top level Makefile, anything defined in this file will
- influence the entire build system.
+ Rules for Docker tests. Like ``tests/Makefile.include``, this file is
+ included directly by the top level Makefile, anything defined in this
+ file will influence the entire build system.
``tests/vm/Makefile.include``
- Rules for VM-based tests. Like tests/Makefile, this file is included
- directly by the top level Makefile, anything defined in this file will
- influence the entire build system.
+ Rules for VM-based tests. Like ``tests/Makefile.include``, this file is
+ included directly by the top level Makefile, anything defined in this
+ file will influence the entire build system.
Dynamically created files
-------------------------
-The following files are generated dynamically by configure in order to
-control the behaviour of the statically defined makefiles. This avoids
-the need for QEMU makefiles to go through any pre-processing as seen
-with autotools, where Makefile.am generates Makefile.in which generates
-Makefile.
+The following files are generated at run-time in order to control the
+behaviour of the Makefiles. This avoids the need for QEMU makefiles to
+go through any pre-processing as seen with autotools, where configure
+generates ``Makefile`` from ``Makefile.in``.
Built by configure:
``config-host.mak``
When configure has determined the characteristics of the build host it
- will write a long list of variables to config-host.mak file. This
- provides the various install directories, compiler / linker flags and a
+ will write them to this file for use in ``Makefile`` and to a smaller
+ extent ``meson.build``. These include the paths to various tools and a
variety of ``CONFIG_*`` variables related to optionally enabled features.
- This is imported by the top level Makefile and meson.build in order to
- tailor the build output.
- config-host.mak is also used as a dependency checking mechanism. If make
+ ``config-host.mak`` is also used as a dependency checking mechanism. If make
sees that the modification timestamp on configure is newer than that on
- config-host.mak, then configure will be re-run.
+ ``config-host.mak``, then configure will be re-run.
+
+ The variables defined here apply to all QEMU
+ build outputs.
+
+``config-meson.cross``
+
+ A Meson "cross file" (or native file) used to communicate the paths to
+ the toolchain and other configuration options.
+
+``config.status``
- The variables defined here are those which are applicable to all QEMU
- build outputs. Variables which are potentially different for each
- emulator target are defined by the next file...
+ A small shell script that will invoke configure again with the same
+ environment variables that were set during the first run. It's used to
+ rerun configure after changes to the source code, but it can also be
+ inspected manually to check the contents of the environment.
+``Makefile.prereqs``
+
+ A set of Makefile dependencies that order the build and execution of
+ firmware and tests after the container images and emulators that they
+ need.
+
+``pc-bios/*/config.mak``, ``tests/tcg/config-host.mak``, ``tests/tcg/*/config-target.mak``
+
+ Configuration variables used to build the firmware and TCG tests,
+ including paths to cross compilation toolchains.
+
+``pyvenv``
+
+ A Python virtual environment that is used for all Python code running
+ during the build. Using a virtual environment ensures that even code
+ that is run via ``sphinx-build``, ``meson`` etc. uses the same interpreter
+ and packages.
Built by Meson:
+``config-host.h``
+ Used by C code to determine the properties of the build environment
+ and the set of enabled features for the entire build.
+
``${TARGET-NAME}-config-devices.mak``
- TARGET-NAME is again the name of a system or userspace emulator. The
- config-devices.mak file is automatically generated by make using the
- scripts/make_device_config.sh program, feeding it the
- default-configs/$TARGET-NAME file as input.
-
-``config-host.h``, ``$TARGET_NAME-config-target.h``, ``$TARGET_NAME-config-devices.h``
- These files are used by source code to determine what features are
- enabled. They are generated from the contents of the corresponding
- ``*.mak`` files using Meson's ``configure_file()`` function.
+ TARGET-NAME is the name of a system emulator. The file is
+ generated by Meson using files under ``configs/devices`` as input.
+
+``${TARGET-NAME}-config-target.mak``
+ TARGET-NAME is the name of a system or usermode emulator. The file is
+ generated by Meson using files under ``configs/targets`` as input.
+
+``$TARGET_NAME-config-target.h``, ``$TARGET_NAME-config-devices.h``
+ Used by C code to determine the properties and enabled
+ features for each target. enabled. They are generated from
+ the contents of the corresponding ``*.mak`` files using Meson's
+ ``configure_file()`` function; each target can include them using
+ the ``CONFIG_TARGET`` and ``CONFIG_DEVICES`` macro respectively.
``build.ninja``
The build rules.
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 203facb..2cafec4 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -888,9 +888,9 @@ You can run the avocado tests simply by executing:
make check-avocado
-This involves the automatic creation of Python virtual environment
-within the build tree (at ``tests/venv``) which will have all the
-right dependencies, and will save tests results also within the
+This involves the automatic installation, from PyPI, of all the
+necessary avocado-framework dependencies into the QEMU venv within the
+build tree (at ``./pyvenv``). Test results are also saved within the
build tree (at ``tests/results``).
Note: the build environment must be using a Python 3 stack, and have
@@ -947,7 +947,7 @@ may be invoked by running:
.. code::
- tests/venv/bin/avocado run $OPTION1 $OPTION2 tests/avocado/
+ pyvenv/bin/avocado run $OPTION1 $OPTION2 tests/avocado/
Note that if ``make check-avocado`` was not executed before, it is
possible to create the Python virtual environment with the dependencies
@@ -962,20 +962,20 @@ a test file. To run tests from a single file within the build tree, use:
.. code::
- tests/venv/bin/avocado run tests/avocado/$TESTFILE
+ pyvenv/bin/avocado run tests/avocado/$TESTFILE
To run a single test within a test file, use:
.. code::
- tests/venv/bin/avocado run tests/avocado/$TESTFILE:$TESTCLASS.$TESTNAME
+ pyvenv/bin/avocado run tests/avocado/$TESTFILE:$TESTCLASS.$TESTNAME
Valid test names are visible in the output from any previous execution
of Avocado or ``make check-avocado``, and can also be queried using:
.. code::
- tests/venv/bin/avocado list tests/avocado
+ pyvenv/bin/avocado list tests/avocado
Manual Installation
~~~~~~~~~~~~~~~~~~~
diff --git a/docs/meson.build b/docs/meson.build
index f220800..9040f86 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -1,4 +1,4 @@
-sphinx_build = find_program(get_option('sphinx_build'),
+sphinx_build = find_program(fs.parent(python.full_path()) / 'sphinx-build',
required: get_option('docs'))
# Check if tools are available to build documentation.
@@ -10,6 +10,18 @@ if sphinx_build.found()
SPHINX_ARGS += [ '-W', '-Dkerneldoc_werror=1' ]
endif
+ sphinx_version = run_command(SPHINX_ARGS + ['--version'],
+ check: true).stdout().split()[1]
+ if sphinx_version.version_compare('>=1.7.0')
+ SPHINX_ARGS += ['-j', 'auto']
+ else
+ nproc = find_program('nproc')
+ if nproc.found()
+ jobs = run_command(nproc, check: true).stdout()
+ SPHINX_ARGS += ['-j', jobs]
+ endif
+ endif
+
# This is a bit awkward but works: create a trivial document and
# try to run it with our configuration file (which enforces a
# version requirement). This will fail if sphinx-build is too old.
diff --git a/docs/sphinx/dbusdomain.py b/docs/sphinx/dbusdomain.py
index 2ea95af..9872fd5 100644
--- a/docs/sphinx/dbusdomain.py
+++ b/docs/sphinx/dbusdomain.py
@@ -400,6 +400,10 @@ class DBusDomain(Domain):
for refname, obj in self.objects.items():
yield (refname, refname, obj.objtype, obj.docname, obj.node_id, 1)
+ def merge_domaindata(self, docnames, otherdata):
+ for name, obj in otherdata['objects'].items():
+ if obj.docname in docnames:
+ self.data['objects'][name] = obj
def setup(app):
app.add_domain(DBusDomain)
diff --git a/docs/sphinx/fakedbusdoc.py b/docs/sphinx/fakedbusdoc.py
index d2c5079..2d2e6ef 100644
--- a/docs/sphinx/fakedbusdoc.py
+++ b/docs/sphinx/fakedbusdoc.py
@@ -23,3 +23,8 @@ class FakeDBusDocDirective(Directive):
def setup(app: Sphinx) -> Dict[str, Any]:
"""Register a fake dbus-doc directive with Sphinx"""
app.add_directive("dbus-doc", FakeDBusDocDirective)
+
+ return dict(
+ parallel_read_safe = True,
+ parallel_write_safe = True
+ )
diff --git a/docs/sphinx/qmp_lexer.py b/docs/sphinx/qmp_lexer.py
index f7e4c0e..a59de8a 100644
--- a/docs/sphinx/qmp_lexer.py
+++ b/docs/sphinx/qmp_lexer.py
@@ -41,3 +41,8 @@ def setup(sphinx):
sphinx.add_lexer('QMP', QMPExampleLexer)
except errors.VersionRequirementError:
sphinx.add_lexer('QMP', QMPExampleLexer())
+
+ return dict(
+ parallel_read_safe = True,
+ parallel_write_safe = True
+ )