From ab9407c3addde1eee0f93e7c3491536cd4db4369 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Mon, 27 Jan 2020 14:28:22 +0000 Subject: [PATCH] build: allow using wildcards to disable drivers Rather than having to explicitly list each and every driver to disable in a build, we can use a small python script and the python glob library to expand out the wildcards. This means that we can configure meson using e.g. meson -Ddisable_drivers=crypto/*,event/* build to do a build omitting all the crypto and event drivers. Explicitly specified drivers e.g. net/i40e, work as before, and can be mixed with wildcarded drivers as required. Signed-off-by: Bruce Richardson Reviewed-by: Robin Jarry Acked-by: Luca Boccassi --- MAINTAINERS | 1 + buildtools/list-dir-globs.py | 19 +++++++++++++++++++ buildtools/meson.build | 2 +- doc/build-sdk-meson.txt | 5 ++++- drivers/meson.build | 3 ++- 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 buildtools/list-dir-globs.py diff --git a/MAINTAINERS b/MAINTAINERS index cb2994140b..bc98b9167e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -130,6 +130,7 @@ F: meson_options.txt F: config/rte_config.h F: buildtools/call-sphinx-build.py F: buildtools/gen-pmdinfo-cfile.sh +F: buildtools/list-dir-globs.py F: buildtools/map_to_def.py F: buildtools/symlink-drivers-solibs.sh diff --git a/buildtools/list-dir-globs.py b/buildtools/list-dir-globs.py new file mode 100755 index 0000000000..80b5e801f2 --- /dev/null +++ b/buildtools/list-dir-globs.py @@ -0,0 +1,19 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import sys +import os +from glob import iglob + +if len(sys.argv) != 2: + print("Usage: {0} [,[,...]]".format(sys.argv[0])) + sys.exit(1) + +root = os.path.join(os.getenv('MESON_SOURCE_ROOT', '.'), + os.getenv('MESON_SUBDIR', '.')) + +for path in sys.argv[1].split(','): + for p in iglob(os.path.join(root, path)): + if os.path.isdir(p): + print(os.path.relpath(p)) diff --git a/buildtools/meson.build b/buildtools/meson.build index cd1d054036..0f563d89a3 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -4,7 +4,7 @@ subdir('pmdinfogen') pmdinfo = find_program('gen-pmdinfo-cfile.sh') - +list_dir_globs = find_program('list-dir-globs.py') check_experimental_syms = find_program('check-experimental-syms.sh') # set up map-to-def script using python, either built-in or external diff --git a/doc/build-sdk-meson.txt b/doc/build-sdk-meson.txt index fc7fe37b54..319a19ef6b 100644 --- a/doc/build-sdk-meson.txt +++ b/doc/build-sdk-meson.txt @@ -84,7 +84,10 @@ Project-specific options are passed used -Doption=value:: meson -Dmachine=default # use builder-independent baseline -march -Examples of setting the same options using meson configure:: + meson -Ddisable_drivers=event/*,net/tap # disable tap driver and all + # eventdev PMDs for a smaller build + +Examples of setting some of the same options using meson configure:: meson configure -Dwerror=true diff --git a/drivers/meson.build b/drivers/meson.build index bd154fa7ad..5502bf9924 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -17,7 +17,8 @@ dpdk_driver_classes = ['common', 'event', # depends on common, bus, mempool and net. 'baseband'] # depends on common and bus. -disabled_drivers = get_option('disable_drivers').split(',') +disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'), + ).stdout().split() default_cflags = machine_args if cc.has_argument('-Wno-format-truncation') -- 2.20.1