meson: do not emit modules with no enabled sources
PATCH 1/1 meson: do not emit modules with no enabled sources
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.
--- meson.build | 3 +++ 1 file changed, 3 insertions(+)
meson.build +3 -0
@@ -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'
Signature · 1 line
2.47.3
Quoted 16 lines · Rohitashv Kumar
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_moduleunconditionally. 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 needCONFIG_VIRTIO_GPU) in a build without virtio-gpu, or hw-s390x-virtio-gpu-ccw (registered unconditionally, source needsCONFIG_VIRTIO_CCW) in a build without an s390x target.
Quoted 4 lines
The
target_modulesloop 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]>
Quoted 21 lines
--- meson.build | 3 +++ 1 file changed, 3 insertions(+)meson.build +3
-1@@ -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
Quoted 15 lines · Rohitashv Kumar
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_moduleunconditionally. 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 needCONFIG_VIRTIO_GPU) in a build without virtio-gpu, or hw-s390x-virtio-gpu-ccw (registered unconditionally, source needsCONFIG_VIRTIO_CCW) in a build without an s390x target.
Quoted 8 lines
The
target_modulesloop 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(+)