When a whole driver class is disabled due to missing dependencies, we
are silently ignoring the fact that the user may have requested drivers
of that class and therefore that the build configuration should fail.
This can be seen by configuring a build with parameters
"-Denable_drivers=event/sw -Ddisable_libs=eventdev". With eventdev
disabled, all event drivers are never considered and no error from this
misconfiguration results.

Fix this by adding a check for requested drivers when disabling a whole
class of devices.

Fixes: 70b6941e4e22 ("build: check drivers class dependencies early")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index 02adf51173..b761e19be5 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -119,6 +119,14 @@ foreach subpath:subdirs
                 endif
                 message('Disabling @1@/* drivers: missing internal dependency 
"@0@"'
                         .format(d, class))
+                # error out if a driver in this class was explicitly requested,
+                # i.e. not via wildcard, since it can now never be built.
+                foreach drv_path : get_option('enable_drivers').split(',')
+                    if drv_path.startswith(class + '/')
+                        error('Cannot build explicitly requested driver 
"@0@".\n'.format(drv_path)
+                                +'\tReason: missing internal dependency 
"@0@"'.format(d))
+                    endif
+                endforeach
                 break
             endif
         endforeach
-- 
2.53.0

Reply via email to