From: Rohitashv Kumar <[email protected]>

With modular builds, the system/block module loop adds the common
boilerplate (modulecommon) to every registered module and emits a
shared_module unconditionally.  A module whose device sources are all
disabled by the configuration then still produces a shared object
containing nothing but the boilerplate: an empty stub that provides no
devices and only complicates packaging.

This happens when a module is registered under a broader condition than
the one gating its sources, e.g. hw-display-virtio-gpu-pci (registered on
CONFIG_VIRTIO_PCI, sources need CONFIG_VIRTIO_GPU) in a build without
virtio-gpu, or hw-s390x-virtio-gpu-ccw (registered unconditionally,
source needs CONFIG_VIRTIO_CCW) in a build without an s390x target.

The target_modules loop already skips modules whose applied source set is
empty; make the system/block loop consistent and do the same.

Signed-off-by: Rohitashv Kumar <[email protected]>
---
 meson.build | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meson.build b/meson.build
index 49a5baf5..557edd71 100644
--- a/meson.build
+++ b/meson.build
@@ -3903,6 +3903,9 @@ foreach d, list : modules
     if enable_modules
       module_ss.add(modulecommon)
       module_ss = module_ss.apply(config_all_devices, strict: false)
+      if module_ss.sources() == []
+        continue
+      endif
       sl = static_library(d + '-' + m, [genh, module_ss.sources()],
                           dependencies: module_ss.dependencies(), pic: true)
       if d == 'block'
-- 
2.47.3


Reply via email to