Skip to contentSkip to conversation

Select optional libraries

PATCH Superseded David Marchand 2 participants 10 messages Jun 29, 2023 – Aug 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v6 cover Select optional libraries

This series is one implementation to try and please users who want to select more easily which parts of DPDK are built.

It introduces a change in behavior for enabling deprecated libraries:
this series is aimed at the next release but sent early as a demo of what changes are required.

A deprecation notice has been sent so that this work can be merged in v23.11:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Changes since v5:
- added acks from Morten,
- resent series as a new thread to avoid confusing patchwork with the previous partially applied series,

Changes since v4:
- rebased on main,
- switched to a list of enabled deprecated libraries,

Changes since v3:
- split kni cleanup,
- split variable rename cleanup,
- introduced a new meson option to control deprecated libraries activation,
- simplified the actual implementation of enable_libs to mimic enable_drivers behavior,

Signature · 14 lines
David Marchand

David Marchand (2):
  build: select deprecated libraries
  build: select optional libraries

 .ci/linux-build.sh            |  2 +-
 devtools/test-meson-builds.sh |  8 +++---
 lib/meson.build               | 50 +++++++++++++++++++++++++----------
 meson_options.txt             |  8 ++++--
 4 files changed, 47 insertions(+), 21 deletions(-)

-- 
2.40.1
#1 lore raw

PATCH v6 1/2 build: select deprecated libraries

Rework deprecated libraries selection by introducing a new configuration option.

This breaks existing configurations that were relying on disable_libs='' for enabling deprecated libraries.
On the other hand, it will make enabling optional libraries more straightforward by taking the deprecated libraries out of the picture.

---
Changes since v4:
- changed the option to a list of libraries instead of a global on/off knob,
- moved all deprecated libs checks under a single block for readability,

---
 .ci/linux-build.sh            |  2 +-
 devtools/test-meson-builds.sh |  8 ++++----
 lib/meson.build               | 28 ++++++++++++++++++++--------
 meson_options.txt             |  4 +++-
 4 files changed, 28 insertions(+), 14 deletions(-)
.ci/linux-build.sh +1 -1
index 45f2729996..e0b62bac90 100755
@@ -97,7 +97,7 @@ if [ "$MINI" = "true" ]; then
     OPTS="$OPTS -Denable_drivers=net/null"
     OPTS="$OPTS -Ddisable_libs=*"
 else
-    OPTS="$OPTS -Ddisable_libs="
+    OPTS="$OPTS -Denable_deprecated_libs=*"
 fi
 OPTS="$OPTS -Dlibdir=lib"
 
devtools/test-meson-builds.sh +4 -4
index 84b907d2ea..c41659d28b 100755
@@ -120,10 +120,10 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	# deprecated libs may be disabled by default, so for complete builds ensure
-	# no libs are disabled
-	if ! echo $* | grep -q -- 'disable_libs' ; then
-		options="$options -Ddisable_libs="
+	# deprecated libs are disabled by default, so for complete builds
+	# enable them
+	if ! echo $* | grep -q -- 'enable_deprecated_libs' ; then
+		options="$options -Denable_deprecated_libs=*"
 	fi
 	if echo $* | grep -qw -- '--default-library=shared' ; then
 		options="$options -Dexamples=all"
lib/meson.build +20 -8
index fac2f52cad..73afd90b38 100644
@@ -93,6 +93,15 @@ dpdk_libs_deprecated += [
         'kni',
 ]
 
+enable_deprecated_libs = []
+foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
+        check: true).stdout().split()
+    if not dpdk_libs_deprecated.contains(l)
+        continue
+    endif
+    enable_deprecated_libs += l
+endforeach
+
 disabled_libs = []
 opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
         check: true).stdout().split()
@@ -137,16 +146,19 @@ foreach l:libraries
         deps += ['eal']
     endif
 
-    if disabled_libs.contains(l)
-        build = false
-        reason = 'explicitly disabled via build config'
-        if dpdk_libs_deprecated.contains(l)
-            reason += ' (deprecated lib)'
-        endif
-    else
-        if dpdk_libs_deprecated.contains(l)
+    if dpdk_libs_deprecated.contains(l)
+        if not enable_deprecated_libs.contains(l)
+            build = false
+            reason = 'not in enabled deprecated libraries build config'
+        else
             warning('Enabling deprecated library, "@0@"'.format(l))
         endif
+    elif disabled_libs.contains(l)
+        build = false
+        reason = 'explicitly disabled via build config'
+    endif
+
+    if build
         subdir(l)
     endif
     if name != l
meson_options.txt +3 -1
index 82c8297065..839d4266c6 100644
@@ -10,7 +10,7 @@ option('disable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to explicitly disable.')
 option('disable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to explicitly disable.')
-option('disable_libs', type: 'string', value: 'flow_classify,kni', description:
+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.')
@@ -18,6 +18,8 @@ option('enable_docs', type: 'boolean', value: false, description:
        'build documentation')
 option('enable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to build. If unspecified, build all apps.')
+option('enable_deprecated_libs', type: 'string', value: '', description:
+       'Comma-separated list of deprecated libraries to explicitly enable.')
 option('enable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to build. If unspecified, build all drivers.')
 option('enable_driver_sdk', type: 'boolean', value: false, description:
Signature · 1 line
2.40.1
#2 lore raw

Re: [PATCH v6 1/2] build: select deprecated libraries

Quoted 11 lines · David Marchand

Rework deprecated libraries selection by introducing a new configuration option.

This breaks existing configurations that were relying on disable_libs='' for enabling deprecated libraries.
On the other hand, it will make enabling optional libraries more straightforward by taking the deprecated libraries out of the picture.

---

Sorry - same comments apply to this as previous w.r.t. doc updates.

Quoted 114 lines

Changes since v4:
- changed the option to a list of libraries instead of a global on/off knob,
- moved all deprecated libs checks under a single block for readability,

---
 .ci/linux-build.sh            |  2 +-
 devtools/test-meson-builds.sh |  8 ++++----
 lib/meson.build               | 28 ++++++++++++++++++++--------
 meson_options.txt             |  4 +++-
 4 files changed, 28 insertions(+), 14 deletions(-)
.ci/linux-build.sh +1 -1
index 45f2729996..e0b62bac90 100755
@@ -97,7 +97,7 @@ if [ "$MINI" = "true" ]; then
     OPTS="$OPTS -Denable_drivers=net/null"
     OPTS="$OPTS -Ddisable_libs=*"
 else
-    OPTS="$OPTS -Ddisable_libs="
+    OPTS="$OPTS -Denable_deprecated_libs=*"
 fi
 OPTS="$OPTS -Dlibdir=lib"
 
devtools/test-meson-builds.sh +4 -4
index 84b907d2ea..c41659d28b 100755
@@ -120,10 +120,10 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	# deprecated libs may be disabled by default, so for complete builds ensure
-	# no libs are disabled
-	if ! echo $* | grep -q -- 'disable_libs' ; then
-		options="$options -Ddisable_libs="
+	# deprecated libs are disabled by default, so for complete builds
+	# enable them
+	if ! echo $* | grep -q -- 'enable_deprecated_libs' ; then
+		options="$options -Denable_deprecated_libs=*"
 	fi
 	if echo $* | grep -qw -- '--default-library=shared' ; then
 		options="$options -Dexamples=all"
lib/meson.build +20 -8
index fac2f52cad..73afd90b38 100644
@@ -93,6 +93,15 @@ dpdk_libs_deprecated += [
         'kni',
 ]
 
+enable_deprecated_libs = []
+foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
+        check: true).stdout().split()
+    if not dpdk_libs_deprecated.contains(l)
+        continue
+    endif
+    enable_deprecated_libs += l
+endforeach
+
 disabled_libs = []
 opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
         check: true).stdout().split()
@@ -137,16 +146,19 @@ foreach l:libraries
         deps += ['eal']
     endif
 
-    if disabled_libs.contains(l)
-        build = false
-        reason = 'explicitly disabled via build config'
-        if dpdk_libs_deprecated.contains(l)
-            reason += ' (deprecated lib)'
-        endif
-    else
-        if dpdk_libs_deprecated.contains(l)
+    if dpdk_libs_deprecated.contains(l)
+        if not enable_deprecated_libs.contains(l)
+            build = false
+            reason = 'not in enabled deprecated libraries build config'
+        else
             warning('Enabling deprecated library, "@0@"'.format(l))
         endif
+    elif disabled_libs.contains(l)
+        build = false
+        reason = 'explicitly disabled via build config'
+    endif
+
+    if build
         subdir(l)
     endif
     if name != l
meson_options.txt +3 -1
index 82c8297065..839d4266c6 100644
@@ -10,7 +10,7 @@ option('disable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to explicitly disable.')
 option('disable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to explicitly disable.')
-option('disable_libs', type: 'string', value: 'flow_classify,kni', description:
+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.')
@@ -18,6 +18,8 @@ option('enable_docs', type: 'boolean', value: false, description:
        'build documentation')
 option('enable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to build. If unspecified, build all apps.')
+option('enable_deprecated_libs', type: 'string', value: '', description:
+       'Comma-separated list of deprecated libraries to explicitly enable.')
 option('enable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to build. If unspecified, build all drivers.')
 option('enable_driver_sdk', type: 'boolean', value: false, description:
#3 lore raw

Re: [PATCH v6 1/2] build: select deprecated libraries

Quoted 11 lines · Aaron Conole
Quoted 8 lines · David Marchand

Rework deprecated libraries selection by introducing a new configuration option.

This breaks existing configurations that were relying on disable_libs='' for enabling deprecated libraries.
On the other hand, it will make enabling optional libraries more straightforward by taking the deprecated libraries out of the picture.

Quoted 5 lines
Quoted 3 lines

---

Sorry - same comments apply to this as previous w.r.t. doc updates.

Indeed, good catch on existing usage of disable_libs in kni and flow_classify docs.
It will be fixed in a next revision.

Merci Aaron.

Signature · 1 line
David Marchand
#4 lore raw

PATCH v6 2/2 build: select optional libraries

In reply to David Marchand

There is currently no way to know which libraries are optional. Introduce a enable_libs option (close to what we have for drivers) so that packagers or projects consuming DPDK can more easily select the optional libraries that matter to them and disable other optional libraries.

---
Changes since v4:
- moved always_enable earlier for readability,

Changes since v3:
- split non related cleanup changes,
- fixed false positive complaints about disabling mandatory libs by building the list of always enabled libs, appending this list to enable_list and checking the disable side,
- updated enable/disable_libs descriptions,

Changes since v2:
- moved the IOVA check for kni build in lib/kni/meson.build,
- reworked deprecated libraries handling by only considering them when no enable_libs option is set. With this, no need for a default value in meson_options.txt, yet configurations in the CI must be adjusted,
- moved mandatory libraries check after enable/disable_libs evaluation,

---
 lib/meson.build   | 34 ++++++++++++++++++++++------------
 meson_options.txt |  4 +++-
 2 files changed, 25 insertions(+), 13 deletions(-)
lib/meson.build +22 -12
index 73afd90b38..b8834fc277 100644
@@ -88,6 +88,13 @@ optional_libs = [
         'vhost',
 ]
 
+always_enable = []
+foreach l:libraries
+    if not optional_libs.contains(l)
+        always_enable += l
+    endif
+endforeach
+
 dpdk_libs_deprecated += [
         'flow_classify',
         'kni',
@@ -102,17 +109,13 @@ foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
     enable_deprecated_libs += l
 endforeach
 
-disabled_libs = []
-opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
-        check: true).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
+disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split()
 
+enable_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split()
+if enable_libs.length() == 0
+    enable_libs += optional_libs
+endif
+enable_libs += always_enable
 
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@@ -153,9 +156,16 @@ foreach l:libraries
         else
             warning('Enabling deprecated library, "@0@"'.format(l))
         endif
-    elif disabled_libs.contains(l)
+    elif not enable_libs.contains(l)
         build = false
-        reason = 'explicitly disabled via build config'
+        reason = 'not in enabled libraries build config'
+    elif disable_libs.contains(l)
+        if always_enable.contains(l)
+            warning('Cannot disable mandatory library "@0@"'.format(l))
+        else
+            build = false
+            reason = 'explicitly disabled via build config'
+        endif
     endif
 
     if build
meson_options.txt +3 -1
index 839d4266c6..7312da3640 100644
@@ -11,7 +11,7 @@ option('disable_apps', type: 'string', value: '', description:
 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]')
+       'Comma-separated list of optional libraries to explicitly disable. [NOTE: mandatory libs cannot 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:
@@ -26,6 +26,8 @@ option('enable_driver_sdk', type: 'boolean', value: false, description:
        'Install headers to build drivers.')
 option('enable_kmods', type: 'boolean', value: false, description:
        'build kernel modules')
+option('enable_libs', type: 'string', value: '', description:
+       'Comma-separated list of optional libraries to explicitly enable. [NOTE: mandatory libs are always enabled]')
 option('examples', type: 'string', value: '', description:
        'Comma-separated list of examples to build by default')
 option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', description:
Signature · 1 line
2.40.1
#5 lore raw

v7 cover Select optional libraries

In reply to David Marchand

This series is one implementation to try and please users who want to select more easily which parts of DPDK are built.

It introduces a change in behavior for enabling deprecated libraries:
this series is aimed at the next release but sent early as a demo of what changes are required.

A deprecation notice has been sent so that this work can be merged in v23.11:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Changes since v6:
- rebased on v23.11-rc0,
- updated docs,

Changes since v5:
- added acks from Morten,
- resent series as a new thread to avoid confusing patchwork with the previous partially applied series,

Changes since v4:
- rebased on main,
- switched to a list of enabled deprecated libraries,

Changes since v3:
- split kni cleanup,
- split variable rename cleanup,
- introduced a new meson option to control deprecated libraries activation,
- simplified the actual implementation of enable_libs to mimic enable_drivers behavior,

Signature · 18 lines
David Marchand

David Marchand (2):
  build: select deprecated libraries
  build: select optional libraries

 .ci/linux-build.sh                            |  2 +-
 devtools/test-meson-builds.sh                 |  8 +--
 doc/guides/prog_guide/flow_classify_lib.rst   |  5 +-
 .../prog_guide/kernel_nic_interface.rst       |  3 +-
 doc/guides/rel_notes/deprecation.rst          |  4 --
 doc/guides/rel_notes/release_23_11.rst        |  6 +++
 lib/meson.build                               | 50 +++++++++++++------
 meson_options.txt                             |  8 ++-
 8 files changed, 58 insertions(+), 28 deletions(-)

-- 
2.41.0
#6 lore raw

PATCH v7 1/2 build: select deprecated libraries

Rework deprecated libraries selection by introducing a new configuration option.

This breaks existing configurations that were relying on disable_libs='' for enabling deprecated libraries.
On the other hand, it will make enabling optional libraries more straightforward by taking the deprecated libraries out of the picture.

---
Changes since v5:
- rebased,
- updated doc (kni, flow classify docs),
- updated deprecation notices and RN,

Changes since v4:
- changed the option to a list of libraries instead of a global on/off knob,
- moved all deprecated libs checks under a single block for readability,

---
 .ci/linux-build.sh                            |  2 +-
 devtools/test-meson-builds.sh                 |  8 +++---
 doc/guides/prog_guide/flow_classify_lib.rst   |  5 ++--
 .../prog_guide/kernel_nic_interface.rst       |  3 +-
 doc/guides/rel_notes/deprecation.rst          |  4 ---
 doc/guides/rel_notes/release_23_11.rst        |  3 ++
 lib/meson.build                               | 28 +++++++++++++------
 meson_options.txt                             |  4 ++-
 8 files changed, 36 insertions(+), 21 deletions(-)
.ci/linux-build.sh +1 -1
index 45f2729996..e0b62bac90 100755
@@ -97,7 +97,7 @@ if [ "$MINI" = "true" ]; then
     OPTS="$OPTS -Denable_drivers=net/null"
     OPTS="$OPTS -Ddisable_libs=*"
 else
-    OPTS="$OPTS -Ddisable_libs="
+    OPTS="$OPTS -Denable_deprecated_libs=*"
 fi
 OPTS="$OPTS -Dlibdir=lib"
 
devtools/test-meson-builds.sh +4 -4
index 84b907d2ea..c41659d28b 100755
@@ -120,10 +120,10 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	# deprecated libs may be disabled by default, so for complete builds ensure
-	# no libs are disabled
-	if ! echo $* | grep -q -- 'disable_libs' ; then
-		options="$options -Ddisable_libs="
+	# deprecated libs are disabled by default, so for complete builds
+	# enable them
+	if ! echo $* | grep -q -- 'enable_deprecated_libs' ; then
+		options="$options -Denable_deprecated_libs=*"
 	fi
 	if echo $* | grep -qw -- '--default-library=shared' ; then
 		options="$options -Dexamples=all"
doc/guides/prog_guide/flow_classify_lib.rst +3 -2
index ad2e10ec26..558a982e3b 100644
@@ -10,8 +10,9 @@ Flow Classification Library
    See :doc:`../rel_notes/deprecation`.
 
    It is disabled by default in the DPDK build.
-   To re-enable the library, remove 'flow_classify' from the "disable_libs"
-   meson option when configuring a build.
+   To re-enable the library, tell meson to enable 'flow_classify' as part of
+   the deprecated libraries meson option
+   ``-Denable_deprecated_libs=flow_classify``.
 
 DPDK provides a Flow Classification library that provides the ability
 to classify an input packet by matching it against a set of Flow rules.
doc/guides/prog_guide/kernel_nic_interface.rst +2 -1
index 392e5df75f..1097ecc695 100644
@@ -18,7 +18,8 @@ Kernel NIC Interface
 .. note::
 
    KNI is disabled by default in the DPDK build.
-   To re-enable the library, remove 'kni' from the "disable_libs" meson option when configuring a build.
+   To re-enable the library, tell meson to enable 'kni' as part of the
+   deprecated libraries meson option ``-Denable_deprecated_libs=kni``.
 
 The DPDK Kernel NIC Interface (KNI) allows userspace applications access to the Linux* control plane.
 
doc/guides/rel_notes/deprecation.rst +0 -4
index 494b401cda..10ba03a71c 100644
@@ -35,10 +35,6 @@ Deprecation Notices
     which also added support for standard atomics
     (Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html)
 
-* build: Enabling deprecated libraries (``flow_classify``, ``kni``)
-  won't be possible anymore through the use of the ``disable_libs`` build option.
-  A new build option for deprecated libraries will be introduced instead.
-
 * kvargs: The function ``rte_kvargs_process`` will get a new parameter
   for returning key match count. It will ease handling of no-match case.
 
doc/guides/rel_notes/release_23_11.rst +3 -0
index 6b4dd21fd0..781b338101 100644
@@ -55,6 +55,9 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* build: Enabling deprecated libraries (``flow_classify``, ``kni``) is now done
+  using the new ``enable_deprecated_libraries`` build option.
+
 
 Removed Items
 -------------
lib/meson.build +20 -8
index fac2f52cad..73afd90b38 100644
@@ -93,6 +93,15 @@ dpdk_libs_deprecated += [
         'kni',
 ]
 
+enable_deprecated_libs = []
+foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
+        check: true).stdout().split()
+    if not dpdk_libs_deprecated.contains(l)
+        continue
+    endif
+    enable_deprecated_libs += l
+endforeach
+
 disabled_libs = []
 opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
         check: true).stdout().split()
@@ -137,16 +146,19 @@ foreach l:libraries
         deps += ['eal']
     endif
 
-    if disabled_libs.contains(l)
-        build = false
-        reason = 'explicitly disabled via build config'
-        if dpdk_libs_deprecated.contains(l)
-            reason += ' (deprecated lib)'
-        endif
-    else
-        if dpdk_libs_deprecated.contains(l)
+    if dpdk_libs_deprecated.contains(l)
+        if not enable_deprecated_libs.contains(l)
+            build = false
+            reason = 'not in enabled deprecated libraries build config'
+        else
             warning('Enabling deprecated library, "@0@"'.format(l))
         endif
+    elif disabled_libs.contains(l)
+        build = false
+        reason = 'explicitly disabled via build config'
+    endif
+
+    if build
         subdir(l)
     endif
     if name != l
meson_options.txt +3 -1
index 82c8297065..839d4266c6 100644
@@ -10,7 +10,7 @@ option('disable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to explicitly disable.')
 option('disable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to explicitly disable.')
-option('disable_libs', type: 'string', value: 'flow_classify,kni', description:
+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.')
@@ -18,6 +18,8 @@ option('enable_docs', type: 'boolean', value: false, description:
        'build documentation')
 option('enable_apps', type: 'string', value: '', description:
        'Comma-separated list of apps to build. If unspecified, build all apps.')
+option('enable_deprecated_libs', type: 'string', value: '', description:
+       'Comma-separated list of deprecated libraries to explicitly enable.')
 option('enable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to build. If unspecified, build all drivers.')
 option('enable_driver_sdk', type: 'boolean', value: false, description:
Signature · 1 line
2.41.0
Acked-by on v7 1/2
#7 lore raw

Re: [PATCH v7 1/2] build: select deprecated libraries

Quoted 8 lines · David Marchand

Rework deprecated libraries selection by introducing a new configuration option.

This breaks existing configurations that were relying on disable_libs='' for enabling deprecated libraries.
On the other hand, it will make enabling optional libraries more straightforward by taking the deprecated libraries out of the picture.

Quoted 4 lines

---

#8 lore raw

PATCH v7 2/2 build: select optional libraries

In reply to David Marchand

There is currently no way to know which libraries are optional. Introduce a enable_libs option (close to what we have for drivers) so that packagers or projects consuming DPDK can more easily select the optional libraries that matter to them and disable other optional libraries.

---
Changes since v5:
- added an entry in the release notes,

Changes since v4:
- moved always_enable earlier for readability,

Changes since v3:
- split non related cleanup changes,
- fixed false positive complaints about disabling mandatory libs by building the list of always enabled libs, appending this list to enable_list and checking the disable side,
- updated enable/disable_libs descriptions,

Changes since v2:
- moved the IOVA check for kni build in lib/kni/meson.build,
- reworked deprecated libraries handling by only considering them when no enable_libs option is set. With this, no need for a default value in meson_options.txt, yet configurations in the CI must be adjusted,
- moved mandatory libraries check after enable/disable_libs evaluation,

---
 doc/guides/rel_notes/release_23_11.rst |  3 +++
 lib/meson.build                        | 34 +++++++++++++++++---------
 meson_options.txt                      |  4 ++-
 3 files changed, 28 insertions(+), 13 deletions(-)
doc/guides/rel_notes/release_23_11.rst +3 -0
index 781b338101..c073612b82 100644
@@ -58,6 +58,9 @@ New Features
 * build: Enabling deprecated libraries (``flow_classify``, ``kni``) is now done
   using the new ``enable_deprecated_libraries`` build option.
 
+* build: Optional libraries can now be selected with the new ``enable_libs``
+  build option similarly to the existing ``enable_drivers`` build option.
+
 
 Removed Items
 -------------
lib/meson.build +22 -12
index 73afd90b38..b8834fc277 100644
@@ -88,6 +88,13 @@ optional_libs = [
         'vhost',
 ]
 
+always_enable = []
+foreach l:libraries
+    if not optional_libs.contains(l)
+        always_enable += l
+    endif
+endforeach
+
 dpdk_libs_deprecated += [
         'flow_classify',
         'kni',
@@ -102,17 +109,13 @@ foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'),
     enable_deprecated_libs += l
 endforeach
 
-disabled_libs = []
-opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
-        check: true).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
+disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split()
 
+enable_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split()
+if enable_libs.length() == 0
+    enable_libs += optional_libs
+endif
+enable_libs += always_enable
 
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@@ -153,9 +156,16 @@ foreach l:libraries
         else
             warning('Enabling deprecated library, "@0@"'.format(l))
         endif
-    elif disabled_libs.contains(l)
+    elif not enable_libs.contains(l)
         build = false
-        reason = 'explicitly disabled via build config'
+        reason = 'not in enabled libraries build config'
+    elif disable_libs.contains(l)
+        if always_enable.contains(l)
+            warning('Cannot disable mandatory library "@0@"'.format(l))
+        else
+            build = false
+            reason = 'explicitly disabled via build config'
+        endif
     endif
 
     if build
meson_options.txt +3 -1
index 839d4266c6..7312da3640 100644
@@ -11,7 +11,7 @@ option('disable_apps', type: 'string', value: '', description:
 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]')
+       'Comma-separated list of optional libraries to explicitly disable. [NOTE: mandatory libs cannot 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:
@@ -26,6 +26,8 @@ option('enable_driver_sdk', type: 'boolean', value: false, description:
        'Install headers to build drivers.')
 option('enable_kmods', type: 'boolean', value: false, description:
        'build kernel modules')
+option('enable_libs', type: 'string', value: '', description:
+       'Comma-separated list of optional libraries to explicitly enable. [NOTE: mandatory libs are always enabled]')
 option('examples', type: 'string', value: '', description:
        'Comma-separated list of examples to build by default')
 option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', description:
Signature · 1 line
2.41.0
#9 lore raw
In reply to David Marchand
Quoted 42 lines · David Marchand

This series is one implementation to try and please users who want to select more easily which parts of DPDK are built.

It introduces a change in behavior for enabling deprecated libraries:
this series is aimed at the next release but sent early as a demo of what changes are required.

A deprecation notice has been sent so that this work can be merged in v23.11:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Changes since v6:
- rebased on v23.11-rc0,
- updated docs,

Changes since v5:
- added acks from Morten,
- resent series as a new thread to avoid confusing patchwork with the previous partially applied series,

Changes since v4:
- rebased on main,
- switched to a list of enabled deprecated libraries,

Changes since v3:
- split kni cleanup,
- split variable rename cleanup,
- introduced a new meson option to control deprecated libraries activation,
- simplified the actual implementation of enable_libs to mimic enable_drivers behavior,

--
David Marchand

David Marchand (2):
build: select deprecated libraries
build: select optional libraries

Quoted 9 lines
 .ci/linux-build.sh                            |  2 +-
 devtools/test-meson-builds.sh                 |  8 +--
 doc/guides/prog_guide/flow_classify_lib.rst   |  5 +-
 .../prog_guide/kernel_nic_interface.rst       |  3 +-
 doc/guides/rel_notes/deprecation.rst          |  4 --
 doc/guides/rel_notes/release_23_11.rst        |  6 +++
 lib/meson.build                               | 50 +++++++++++++------
 meson_options.txt                             |  8 ++-
 8 files changed, 58 insertions(+), 28 deletions(-)

Series applied.

Signature · 1 line
David Marchand