DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com
Subject: [dpdk-dev] [PATCH v2 11/11] devtools: compile all buildable examples with pkg-config
Date: Fri, 13 Nov 2020 13:24:30 +0100	[thread overview]
Message-ID: <20201113122430.25354-12-david.marchand@redhat.com> (raw)
In-Reply-To: <20201113122430.25354-1-david.marchand@redhat.com>

Rather than just installing all examples, we can use the build checks to
filter out any examples that are missing dependencies or are otherwise
unbuildable on the current system.
Introduce a new "buildable" special value for the -Dexamples= meson
option, this way existing behavior on installing all examples is
preserved.

Select only buildable examples and test their compilation for the
x86-default target.

Note for maintainers/users of the script: for existing environments,
the x86-default target might get broken by this patch since the script
now tries to build all "installed" examples and dependencies for some
might be unfulfilled.
To fix this temporary situation, you can either delete the whole
directory or reconfigure it:
$ meson configure $DPDK_BUILD_TEST_DIR/build-x86-default \
  -Dexamples=buildable

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changelog since v1:
- rebased on main,
- introduced a new "buildable" special value for the -Dexamples option,
- installation of the "multi-level" examples has been fixed, so
  corresponding exceptions have been removed,
- a fix for the vhost is waiting in next-virtio, I assume it will get
  pulled before this series,
- the only remaining exception is for vm_power_manager which is broken,

---
 devtools/test-meson-builds.sh | 11 +++++++++--
 examples/meson.build          | 24 ++++++++++++++++++++++--
 meson.build                   |  2 ++
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 3ce49368cf..a04f3eb7ff 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -213,7 +213,8 @@ default_machine='nehalem'
 if ! check_cc_flags "-march=$default_machine" ; then
 	default_machine='corei7'
 fi
-build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine $use_shared
+build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine \
+	-Dexamples=buildable $use_shared
 
 # 32-bit with default compiler
 if check_cc_flags '-m32' ; then
@@ -266,10 +267,16 @@ pc_file=$(find $DESTDIR -name libdpdk.pc)
 export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
 libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
 export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
-examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
 # if pkg-config defines the necessary flags, test building some examples
 if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
 	export PKGCONF="pkg-config --define-prefix"
+	examples=${DPDK_BUILD_TEST_EXAMPLES:-}
+	if [ -z "$examples" ]; then
+		for mk in $DESTDIR/usr/local/share/dpdk/examples/*/Makefile; do
+			name=$(basename $(dirname $mk))
+			examples="$examples $name"
+		done
+	fi
 	for example in $examples; do
 		echo "## Building $example"
 		$MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example \
diff --git a/examples/meson.build b/examples/meson.build
index 46ec80919e..a23ab79e8c 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -55,9 +55,18 @@ endif
 if get_option('examples').to_lower() == 'all'
 	examples = all_examples
 	allow_skips = true # don't flag an error if we can't build an app
+	install_buildable = false
+elif get_option('examples').to_lower() == 'buildable'
+	examples = all_examples
+	allow_skips = true
+	install_buildable = true # only install examples that can be built
+	# FIXME: vm_power_manager relies on an internal header and can't build
+	# outside dpdk tree.
+	dpdk_examples_exclude += ['vm_power_manager']
 else
 	examples = get_option('examples').split(',')
 	allow_skips = false # error out if we can't build a requested app
+	install_buildable = false
 endif
 default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
@@ -81,10 +90,15 @@ foreach example: examples
 		foreach d:deps
 			var_name = get_option('default_library') + '_rte_' + d
 			if not is_variable(var_name)
-				error('Missing dependency "@0@" for example "@1@"'.format(d, name))
+				message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+				build = false
+			else
+				dep_objs += [get_variable(var_name)]
 			endif
-			dep_objs += [get_variable(var_name)]
 		endforeach
+	endif
+
+	if build
 		if allow_experimental_apis
 			cflags += '-DALLOW_EXPERIMENTAL_API'
 		endif
@@ -98,5 +112,11 @@ foreach example: examples
 		error('Cannot build requested example "' + name + '"')
 	else
 		message('Skipping example "' + name + '"')
+		if install_buildable
+			# exclude based on top-level directory only
+			dir = example.split('/')[0]
+			dpdk_examples_exclude += dir
+			message('Excluding example directory "@0@" from install'.format(dir))
+		endif
 	endif
 endforeach
diff --git a/meson.build b/meson.build
index 45d974cd2c..559a9d2f1b 100644
--- a/meson.build
+++ b/meson.build
@@ -58,9 +58,11 @@ subdir('doc')
 
 # build any examples explicitly requested - useful for developers - and
 # install any example code into the appropriate install path
+dpdk_examples_exclude = []
 subdir('examples')
 install_subdir('examples',
 	install_dir: get_option('datadir') + '/dpdk',
+	exclude_directories: dpdk_examples_exclude,
 	exclude_files: 'meson.build')
 
 # build kernel modules if enabled
-- 
2.23.0


  parent reply	other threads:[~2020-11-13 12:28 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 15:12 [dpdk-dev] [PATCH 00/10] Examples compilation fixes David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 01/10] examples/fips_validation: fix build with pkg-config David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 02/10] examples/ipsec-gw: " David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 03/10] examples/kni: " David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 04/10] examples/l2fwd-crypto: " David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 05/10] examples/l3fwd-graph: fix static build David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 06/10] examples/ntb: fix clean target David Marchand
2020-11-12  1:30   ` Li, Xiaoyun
2020-11-10 15:12 ` [dpdk-dev] [PATCH 07/10] examples/vhost_blk: fix build with pkg-config David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 08/10] examples/rxtx_callbacks: " David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 09/10] devtools: compile all examples " David Marchand
2020-11-10 16:02   ` Bruce Richardson
2020-11-10 17:18   ` Bruce Richardson
2020-11-10 17:27     ` David Marchand
2020-11-10 15:12 ` [dpdk-dev] [PATCH 10/10] examples: restore trace point David Marchand
2020-11-10 16:04 ` [dpdk-dev] [PATCH 00/10] Examples compilation fixes Bruce Richardson
2020-11-13 12:24 ` [dpdk-dev] [PATCH v2 00/11] " David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 01/11] examples/fips_validation: fix build with pkg-config David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 02/11] examples/ipsec-gw: " David Marchand
2020-11-16  4:16     ` [dpdk-dev] [EXT] " Anoob Joseph
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 03/11] examples/kni: " David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 04/11] examples/l2fwd-crypto: " David Marchand
2020-11-13 13:53     ` Bruce Richardson
2020-11-13 14:15       ` David Marchand
2020-11-13 15:41         ` David Marchand
2020-11-13 16:08           ` Bruce Richardson
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 05/11] examples/l3fwd-graph: fix static build David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 06/11] examples/ntb: fix clean target David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 07/11] examples/performance-thread: fix build with pkg-config David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 08/11] examples/vhost_blk: " David Marchand
2020-11-13 13:00     ` Maxime Coquelin
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 09/11] examples/rxtx_callbacks: " David Marchand
2020-11-13 12:24   ` [dpdk-dev] [PATCH v2 10/11] examples: restore trace point David Marchand
2020-11-13 12:24   ` David Marchand [this message]
2020-11-13 12:37     ` [dpdk-dev] [PATCH v2 11/11] devtools: compile all buildable examples with pkg-config David Marchand
2020-11-13 14:06     ` Bruce Richardson
2020-11-13 14:14       ` David Marchand
2020-11-13 14:24         ` Bruce Richardson
2020-11-14  9:05 ` [dpdk-dev] [PATCH v3 00/11] Examples compilation fixes David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 01/11] examples/fips_validation: fix build with pkg-config David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 02/11] examples/ipsec-gw: " David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 03/11] examples/kni: " David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 04/11] examples/l2fwd-crypto: " David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 05/11] examples/l3fwd-graph: fix static build David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 06/11] examples/l3fwd-graph: fix pkg-config usage David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 07/11] examples/ntb: fix clean target David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 08/11] examples/performance-thread: fix build with pkg-config David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 09/11] examples/vhost_blk: " David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 10/11] examples/rxtx_callbacks: " David Marchand
2020-11-14  9:05   ` [dpdk-dev] [PATCH v3 11/11] examples: restore trace point David Marchand
2020-11-15 14:37   ` [dpdk-dev] [PATCH v3 00/11] Examples compilation fixes 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=20201113122430.25354-12-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).