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 since v1:
- 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 (10):
  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
  meson.build: ignore audio drivers when configured with --disable-audio

 Kconfig.host                     |  3 ++
 audio/audio-stub.c               | 22 +++++++++
 audio/meson.build                |  5 ++
 hmp-commands-info.hx             |  2 +
 hmp-commands.hx                  |  2 +
 hw/audio/Kconfig                 | 21 ++++----
 hw/audio/pcspk.c                 | 12 ++++-
 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 +-
 replay/meson.build               |  9 +++-
 replay/replay-audio-stub.c       | 21 ++++++++
 replay/stubs-system.c            | 12 -----
 scripts/meson-buildoptions.sh    |  3 ++
 system/vl.c                      |  6 +++
 tests/audio/meson.build          |  2 +-
 tests/qtest/libqtest.c           |  2 +
 ui/dbus.c                        |  2 +
 ui/vnc.c                         | 31 ++++++++++--
 22 files changed, 186 insertions(+), 64 deletions(-)
 create mode 100644 audio/audio-stub.c
 create mode 100644 replay/replay-audio-stub.c

-- 
2.34.1


Reply via email to