Skip to contentSkip to conversation

Build file update proposals

RFC PATCH In review Bruce Richardson 7 participants 71 messages Apr 1, 2021 – Apr 28, 2021 Page 5 of 5

Subsystems (11)
lore
Share & tools
lore
#69 lore raw

PATCH v2 16/16 lib: allow disabling optional libraries

In reply to Bruce Richardson

Add support for the disable_libs option, to allow disabling the build of particular libraries. As part of this, maintain a list of what libraries can safely be disabled, without breaking the build - for now this list is solely those libraries which are not built on FreeBSD, kni, power and vhost. This list can be expanded by future patches.

---
 lib/meson.build   | 24 +++++++++++++++++++++++-
 meson_options.txt |  2 ++
 2 files changed, 25 insertions(+), 1 deletion(-)
lib/meson.build +23 -1
index 3a9a6c3be4..c9a20f65b7 100644
@@ -81,6 +81,23 @@ if is_windows
     ] # only supported libraries for windows
 endif
 
+optional_libs = [
+    'kni',
+    'power',
+    'vhost',
+]
+
+disabled_libs = []
+opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs')).stdout().split()
+foreach l:opt_disabled_libs
+    if not optional_libs.contains(l)
+        warning('Cannot disable mandatory library "@0@"'.format(l))
+        continue
+    endif
+    disabled_libs += l
+endforeach
+
+
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
 default_cflags += ['-DALLOW_INTERNAL_API']
@@ -114,7 +131,12 @@ foreach l:libraries
         deps += ['eal']
     endif
 
-    subdir(l)
+    if disabled_libs.contains(l)
+        build = false
+        reason = 'explicitly disabled via build config'
+    else
+        subdir(l)
+    endif
     if name != l
         warning('Library name, "@0@", and directory name, "@1@", do not match'.format(name, l))
     endif
meson_options.txt +2 -0
index 530fcddfa1..9d73fd5419 100644
@@ -6,6 +6,8 @@ option('developer_mode', type: 'feature', description:
         'turn on additional build checks relevant for DPDK developers')
 option('disable_drivers', type: 'string', value: '', description:
         'Comma-separated list of drivers to explicitly disable.')
+option('disable_libs', type: 'string', value: '', description:
+        'Comma-separated list of libraries to explicitly disable. [NOTE: not all libs can be disabled]')
 option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>', description:
         'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.')
 option('enable_docs', type: 'boolean', value: false, description:
Signature · 1 line
2.27.0
#70 lore raw

Re: [dpdk-dev] [PATCH v2 00/16] Build file updates

In reply to Bruce Richardson

20/04/2021 12:22, Bruce Richardson:

Quoted 21 lines

This set contains 5 changes/updates to the DPDK build and build files.

The changes in this set are:
1. Use "continue" keyword, new in 0.49 to shorten and reduce indentation levels in the foreach loops when building library or driver components.
2. For libraries, drop support for header-only libraries, which was added just for the "compat" lib which had a single header, and is now part of EAL. This similarly reduces indentation levels and makes the code easier to follow
3. Since the larger blocks of meson code in our repo is seeing massive whitespace changes, take the opportunity to switch our indentation style for meson files from that of C-files using tabs, to Meson/Python style using spaces.[1]
4. Remove the "librte_" prefix from all our library directories. While as useful cleanup, the main driver for this was that it simplifies the matching for #5 below.
5. Add a "disable_libs" build option to allow the user to optionally not build certain components. Include in this an explicit list of libraries which are "known safe" to disable in the build. For now this is a short list of three libs, all of which are safe because they are not buildable on FreeBSD. More work is needed to expand this list in future.

Quoted 1 line

[1] https://mesonbuild.com/Style-guide.html#tabs-or-spaces

I went an extra mile to align files list in drivers. That's a big bang applied for 21.05-rc1.

Please could you try to set up the git trick
to skip some of these changes in the git blame?

Thanks