[1/6] lib: allow recursive disabling of libs in build

Message ID 20220113173918.2700651-2-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series allow more DPDK libraries to be disabled on build |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Jan. 13, 2022, 5:39 p.m. UTC
  Align the code in lib/meson.build with that in drivers/meson.build to
enable recursive disabling of libraries, i.e. if library b depends on
library a, disable library b if a is disabled (either explicitly or
implicitly). This allows libraries to be optional even if other DPDK
libs depend on them, something that was not previously possible.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/meson.build | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
  

Patch

diff --git a/lib/meson.build b/lib/meson.build
index fbaa6ef7c2..af4662e942 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -134,23 +134,29 @@  foreach l:libraries
         warning('Library name, "@0@", and directory name, "@1@", do not match'.format(name, l))
     endif
 
-    if not build
-        dpdk_libs_disabled += name
-        set_variable(name.underscorify() + '_disable_reason', reason)
-        continue
-    endif
-
     shared_deps = ext_deps
     static_deps = ext_deps
     foreach d:deps
+        if not build
+            break
+        endif
         if not is_variable('shared_rte_' + d)
-            error('Missing internal dependency "@0@" for @1@ [@2@]'
+            build = false
+            reason = 'missing internal dependency, "@0@"'.format(d)
+            message('Disabling @1@ [@2@]: missing internal dependency "@0@"'
                     .format(d, name, 'lib/' + l))
+        else
+            shared_deps += [get_variable('shared_rte_' + d)]
+            static_deps += [get_variable('static_rte_' + d)]
         endif
-        shared_deps += [get_variable('shared_rte_' + d)]
-        static_deps += [get_variable('static_rte_' + d)]
     endforeach
 
+    if not build
+        dpdk_libs_disabled += name
+        set_variable(name.underscorify() + '_disable_reason', reason)
+        continue
+    endif
+
     enabled_libs += name
     dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1)
     install_headers(headers)