DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com,
	i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v4 4/4] build: select optional libraries
Date: Wed, 21 Jun 2023 19:00:58 +0200	[thread overview]
Message-ID: <20230621170058.2740340-5-david.marchand@redhat.com> (raw)
In-Reply-To: <20230621170058.2740340-1-david.marchand@redhat.com>

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.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
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   | 33 +++++++++++++++++++++++----------
 meson_options.txt |  4 +++-
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/lib/meson.build b/lib/meson.build
index a6e9e19b42..407769b270 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -92,17 +92,20 @@ dpdk_libs_deprecated += [
         'kni',
 ]
 
-disabled_libs = []
-opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
-        check: true).stdout().split()
-foreach l:opt_disabled_libs
+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
+
+always_enable = []
+foreach l:libraries
     if not optional_libs.contains(l)
-        warning('Cannot disable mandatory library "@0@"'.format(l))
-        continue
+        always_enable += l
     endif
-    disabled_libs += l
 endforeach
-
+enable_libs += always_enable
 
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@@ -139,12 +142,22 @@ foreach l:libraries
     if dpdk_libs_deprecated.contains(l) and not get_option('enable_deprecated_libs')
         build = false
         reason = 'deprecated libraries disabled via build config'
-    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'
         if dpdk_libs_deprecated.contains(l)
             reason += ' (deprecated lib)'
         endif
+    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'
+            if dpdk_libs_deprecated.contains(l)
+                reason += ' (deprecated lib)'
+            endif
+        endif
     endif
 
     if build
diff --git a/meson_options.txt b/meson_options.txt
index f959015e46..9951563146 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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:
-- 
2.40.1


  parent reply	other threads:[~2023-06-21 17:01 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 16:48 [PATCH 0/5] Extend optional libraries list David Marchand
2021-11-10 16:48 ` [PATCH 1/5] ci: test build with minimum configuration David Marchand
2021-11-16 17:06   ` Thomas Monjalon
2021-11-16 20:39     ` David Marchand
2021-11-16 21:47       ` Thomas Monjalon
2021-11-10 16:48 ` [PATCH 2/5] build: make GRO/GSO optional David Marchand
2021-11-16 17:11   ` Thomas Monjalon
2021-11-10 16:48 ` [PATCH 3/5] build: make metrics libraries optional David Marchand
2021-11-16 17:12   ` Thomas Monjalon
2021-11-10 16:48 ` [PATCH 4/5] build: make pdump optional David Marchand
2021-11-16 17:14   ` Thomas Monjalon
2021-11-10 16:48 ` [PATCH 5/5] build: select optional libraries David Marchand
2021-11-10 17:34   ` Bruce Richardson
2021-11-16 17:25     ` Thomas Monjalon
2021-11-17 10:47       ` Bruce Richardson
2021-11-17 11:27         ` David Marchand
2022-01-07 16:13           ` Morten Brørup
2022-01-07 16:47             ` Stephen Hemminger
2021-11-10 17:34 ` [PATCH 0/5] Extend optional libraries list Bruce Richardson
2021-11-17 11:28 ` [PATCH v2 " David Marchand
2021-11-17 11:28   ` [PATCH v2 1/5] ci: test minimum configuration David Marchand
2021-11-17 11:50     ` Thomas Monjalon
2021-11-17 13:38     ` Aaron Conole
2021-11-17 11:28   ` [PATCH v2 2/5] build: make GRO/GSO optional David Marchand
2021-11-17 11:28   ` [PATCH v2 3/5] build: make metrics libraries optional David Marchand
2021-11-17 11:28   ` [PATCH v2 4/5] build: make pdump optional David Marchand
2021-11-17 11:28   ` [PATCH v2 5/5] build: select optional libraries David Marchand
2023-06-16  7:14     ` [PATCH v3] " David Marchand
2023-06-16  9:42       ` Bruce Richardson
2023-06-19  8:00         ` David Marchand
2023-06-19 14:11       ` David Marchand
2023-06-19 14:26         ` Bruce Richardson
2023-06-20  8:31           ` David Marchand
2023-06-20  8:35             ` Bruce Richardson
2023-06-20  8:38               ` David Marchand
2023-06-20  8:44                 ` Bruce Richardson
2023-06-20  8:48                   ` David Marchand
2023-06-20  9:03                     ` Bruce Richardson
2023-06-20 14:33                       ` Thomas Monjalon
2023-06-20 14:40                         ` Bruce Richardson
2023-06-20 15:01                         ` Bruce Richardson
2023-06-21  9:54                           ` David Marchand
2023-06-21 10:49                             ` Bruce Richardson
2023-06-21 11:35                               ` Morten Brørup
2023-06-22  9:27                             ` Juraj Linkeš
2023-06-21 17:00     ` [PATCH v4 0/4] Select " David Marchand
2023-06-21 17:00       ` [PATCH v4 1/4] kni: move IOVA build check David Marchand
2023-06-22  8:37         ` Bruce Richardson
2023-06-21 17:00       ` [PATCH v4 2/4] build: rename enabled libraries list David Marchand
2023-06-22  8:38         ` Bruce Richardson
2023-06-21 17:00       ` [PATCH v4 3/4] build: select deprecated libraries David Marchand
2023-06-22  8:43         ` Bruce Richardson
2023-06-22  8:50           ` Bruce Richardson
2023-06-23  9:35           ` David Marchand
2023-06-23 11:04             ` Bruce Richardson
2023-06-23 11:15               ` Morten Brørup
2023-06-23 11:19                 ` Bruce Richardson
2023-06-23 11:32                   ` Morten Brørup
2023-06-28 12:10                     ` David Marchand
2023-06-21 17:00       ` David Marchand [this message]
2023-06-22  8:49         ` [PATCH v4 4/4] build: select optional libraries Bruce Richardson
2023-06-22  9:09       ` [PATCH v4 0/4] Select " Bruce Richardson
2023-06-22 16:41         ` Thomas Monjalon
2023-06-28 13:20     ` [PATCH v5 0/2] " David Marchand
2023-06-28 13:20       ` [PATCH v5 1/2] build: select deprecated libraries David Marchand
2023-06-29 12:44         ` Aaron Conole
2023-06-28 13:20       ` [PATCH v5 2/2] build: select optional libraries David Marchand
2023-06-28 14:48       ` [PATCH v5 0/2] Select " Morten Brørup
2023-07-17 12:54         ` Bruce Richardson
2021-11-17 11:52   ` [PATCH v2 0/5] Extend optional libraries list Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230621170058.2740340-5-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=bluca@debian.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@ovn.org \
    --cc=james.r.harris@intel.com \
    --cc=mohammed@hawari.fr \
    --cc=thomas@monjalon.net \
    --cc=tredaelli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).