This series adds a compile-time option to disable building
audio-related sources (mostly, files under `audio/` and `hw/audio/`).
It adds `--disable-audio` and `--enable-audio` options to the
`configure` script. Audio remains enabled by default, and the changes are
harmless in that case.
When audio is disabled, it may not be possible to build a number of
devices and machines. This is expected, and can be addressed on a
case-by-case basis if needed. For now, this is done only for the
PC Speaker (PCSPK).
This feature may be useful in production environments which only use a
specific subset of QEMU’s functionality and, in particular, do not need
the audio subsystem. In such environments it is generally beneficial to
avoid building unused code, for both security and maintenance reasons
(for example, to satisfy various static code analysers).
Changes in v3:
* ui/vnc:
- Included some useful information in the commit message.
- Added a note in qemu-options.hx about using VNC with `--disable-audio`.
- Made a few stylistic changes.
* system/vl:
- Updated qemu-options.hx so the `audiodev` and `audio` options are
omitted if audio is disabled.
* ui/dbus:
- Updated ui/dbus.c so the code related to the `audiodev` property
is not compiled if audio is disabled.
- In qapi/ui.json, made the `*audiodev` field of the DisplayDBus struct
conditional so it's not present if audio is disabled.
- Added a brief note about disabling audio in the D-Bus section of
qemu-options.hx.
* The `audio: do not build..` patch:
- audio/audio-stub.c is removed. Instead, new ifdefs are added in a few
places.
* Added a patch that removes the `audiodevs` root container in qom/object.c
if audio is disabled.
* Rebased onto the master branch.
Changes in v2:
* Rebased onto the master branch (in particular, onto the changes from the
large series submitted by Marc-André Lureau).
* D-Bus is now handled differently when audio is disabled: instead of
interrupting initialisation, we simply don’t initialise the audio
interface.
* Incorporated a few changes suggested by Paolo Bonzini and Thomas Huth.
The main ones are:
- Cleaned up the PCSPK changes (removed redundant ifdefs and the
`audio_be` field).
- Removed the HMP commands rather than stubbing them out.
- Replaced the `configure` change with a change in
`scripts/meson-buildoptions.sh`.
- Removed `qdev_prop_audiodev` in `hw/core/qdev-properties-system.c`
rather than stubbing out `audio_be_get_id`.
(Here "removed" means adding an appropriate ifdef.)
Sergei Heifetz (11):
audio: add `audio` build option for meson and Kconfig
ui/vnc: disable audio feature when configured with --disable-audio
tests/qtest: remove -audio none when configured with --disable-audio
hw/audio/pcspk: change PCSPK behaviour with --disable-audio
Kconfig: add AUDIO dependency to audio-related devices
system/vl: remove audio and audiodev options when audio is disabled
ui/dbus: run without Audio interface when audio is disabled
tests/audio: do not compile if audio is disabled
audio: do not build audio-related sources with --disable-audio
qom: remove audiodevs root container if audio is disabled
meson.build: ignore audio drivers when configured with --disable-audio
Kconfig.host | 3 ++
audio/meson.build | 4 ++
hmp-commands-info.hx | 2 +
hmp-commands.hx | 2 +
hw/audio/Kconfig | 21 ++++----
hw/audio/pcspk.c | 12 ++++-
hw/core/machine.c | 6 +++
hw/core/qdev-properties-system.c | 2 +
hw/i386/pc.c | 2 +
hw/usb/Kconfig | 2 +-
meson.build | 83 ++++++++++++++++++--------------
meson_options.txt | 3 ++
qapi/audio.json | 3 +-
qapi/ui.json | 2 +-
qemu-options.hx | 9 ++++
qom/object.c | 2 +
replay/meson.build | 9 +++-
replay/replay-audio-stub.c | 21 ++++++++
replay/stubs-system.c | 12 -----
scripts/meson-buildoptions.sh | 3 ++
system/runstate.c | 2 +
system/vl.c | 8 +++
tests/audio/meson.build | 2 +-
tests/qtest/libqtest.c | 2 +
ui/dbus.c | 8 +++
ui/vnc.c | 27 +++++++++++
26 files changed, 190 insertions(+), 62 deletions(-)
create mode 100644 replay/replay-audio-stub.c
--
2.34.1