[PATCH v4 4/4] build: select optional libraries

Bruce Richardson bruce.richardson at intel.com
Thu Jun 22 10:49:00 CEST 2023


On Wed, Jun 21, 2023 at 07:00:58PM +0200, David Marchand wrote:
> 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 at redhat.com>
> ---

LGTM - one minor suggestion inline below.

Acked-by: Bruce Richardson <bruce.richardson at intel.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

Minor nit, I'd actually put this block further up the file just after the
optional_libs list. It's more an array definition, and moving it up puts
the next line (below) to add to enable_libs immediately after the other
assignments to enable_libs.

> -
> +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
> 


More information about the dev mailing list