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,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>
Subject: [PATCH v6 2/2] build: select optional libraries
Date: Thu, 29 Jun 2023 11:04:59 +0200	[thread overview]
Message-ID: <20230629090459.823130-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20230629090459.823130-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>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
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(-)

diff --git a/lib/meson.build b/lib/meson.build
index 73afd90b38..b8834fc277 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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
diff --git a/meson_options.txt b/meson_options.txt
index 839d4266c6..7312da3640 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-29  9:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  9:04 [PATCH v6 0/2] Select " David Marchand
2023-06-29  9:04 ` [PATCH v6 1/2] build: select deprecated libraries David Marchand
2023-06-29 12:48   ` Aaron Conole
2023-06-29 12:55     ` David Marchand
2023-06-29  9:04 ` David Marchand [this message]
2023-07-31 14:48 ` [PATCH v7 0/2] Select optional libraries David Marchand
2023-07-31 14:48   ` [PATCH v7 1/2] build: select deprecated libraries David Marchand
2023-07-31 19:04     ` Aaron Conole
2023-07-31 14:48   ` [PATCH v7 2/2] build: select optional libraries David Marchand
2023-08-23  7:57   ` [PATCH v7 0/2] Select " David Marchand

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=20230629090459.823130-3-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=mb@smartsharesystems.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).