DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, thomas@monjalon.net,
	bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org,
	james.r.harris@intel.com, mohammed@hawari.fr
Subject: [PATCH 5/5] build: select optional libraries
Date: Wed, 10 Nov 2021 17:48:14 +0100	[thread overview]
Message-ID: <20211110164814.5231-6-david.marchand@redhat.com> (raw)
In-Reply-To: <20211110164814.5231-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.

Note: the enabled_libs variable is renamed for sake of consistency.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 buildtools/chkincs/meson.build |  2 +-
 lib/meson.build                | 34 ++++++++++++++++++----------------
 meson.build                    |  3 ++-
 meson_options.txt              |  2 ++
 4 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index 5ffca89761..6b93d5f46c 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -18,7 +18,7 @@ sources = files('main.c')
 sources += gen_c_files.process(dpdk_chkinc_headers)
 
 deps = []
-foreach l:enabled_libs
+foreach l:dpdk_libs_enabled
     deps += get_variable('static_rte_' + l)
 endforeach
 
diff --git a/lib/meson.build b/lib/meson.build
index dad9fce14d..47c857c0fc 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -78,17 +78,10 @@ optional_libs = [
         'vhost',
 ]
 
-disabled_libs = []
-opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
+enable_libs = run_command(list_dir_globs, get_option('enable_libs'),
+        check: true).stdout().split()
+disable_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
-
 
 default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
@@ -98,8 +91,6 @@ if cc.has_argument('-Wno-format-truncation')
     default_cflags += '-Wno-format-truncation'
 endif
 
-enabled_libs = [] # used to print summary at the end
-
 foreach l:libraries
     build = true
     reason = '<unknown reason>' # set if build == false to explain why
@@ -123,10 +114,21 @@ foreach l:libraries
         deps += ['eal']
     endif
 
-    if disabled_libs.contains(l)
-        build = false
-        reason = 'explicitly disabled via build config'
+    if optional_libs.contains(l)
+        # check for enabled libraries only if one is set in config
+        if enable_libs.length() != 0 and not enable_libs.contains(l)
+            build = false
+            reason = 'not in enabled libraries build config'
+        elif disable_libs.contains(l)
+            build = false
+            reason = 'explicitly disabled via build config'
+        endif
     else
+        if disable_libs.contains(l)
+            warning('Cannot disable mandatory library "@0@"'.format(l))
+        endif
+    endif
+    if build
         subdir(l)
     endif
     if name != l
@@ -150,7 +152,7 @@ foreach l:libraries
         static_deps += [get_variable('static_rte_' + d)]
     endforeach
 
-    enabled_libs += name
+    dpdk_libs_enabled += name
     dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1)
     install_headers(headers)
     install_headers(indirect_headers)
diff --git a/meson.build b/meson.build
index 12cb6e0e83..65855ceee8 100644
--- a/meson.build
+++ b/meson.build
@@ -35,6 +35,7 @@ dpdk_driver_classes = []
 dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_libs_disabled = []
+dpdk_libs_enabled = []
 dpdk_drvs_disabled = []
 abi_version_file = files('ABI_VERSION')
 
@@ -102,7 +103,7 @@ subdir('buildtools/pkg-config')
 output_message = '\n=================\nLibraries Enabled\n=================\n'
 output_message += '\nlibs:\n\t'
 output_count = 0
-foreach lib:enabled_libs
+foreach lib:dpdk_libs_enabled
     output_message += lib + ', '
     output_count += 1
     if output_count == 8
diff --git a/meson_options.txt b/meson_options.txt
index 7c220ad68d..ccb92cff7a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,8 @@ option('enable_docs', type: 'boolean', value: false, description:
        'build documentation')
 option('enable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to build. If unspecified, build all drivers.')
+option('enable_libs', type: 'string', value: '', description:
+       'Comma-separated list of libraries to explicitly enable.')
 option('enable_driver_sdk', type: 'boolean', value: false, description:
        'Install headers to build drivers.')
 option('enable_kmods', type: 'boolean', value: false, description:
-- 
2.23.0


  parent reply	other threads:[~2021-11-10 16:49 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 ` David Marchand [this message]
2021-11-10 17:34   ` [PATCH 5/5] build: select optional libraries 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       ` [PATCH v4 4/4] build: select optional libraries David Marchand
2023-06-22  8:49         ` 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=20211110164814.5231-6-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).