[dpdk-dev] devtools: add test script for meson builds

Message ID 20180424123255.204330-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson April 24, 2018, 12:32 p.m. UTC
  To simplify testing with the meson and ninja builds, we can add a script
to set up and do multiple builds. Currently this script sets up:

* clang and gcc builds
* builds using static and shared linkage for binaries (libs are always
   built as both)
* a build using the lowest instruction-set level for x86 (-march=nehalem)
* cross-builds for each cross-file listed in config/arm

Each build is configured in a directory ending in *-build, and then for
the build stage, we just call ninja in each directory in turn. [i.e. we
assume every directory ending in "-build" is a meson build, which is
probably an ok assumption].

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/test-meson-builds.sh | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100755 devtools/test-meson-builds.sh
  

Comments

Bruce Richardson April 24, 2018, 2:36 p.m. UTC | #1
On Tue, Apr 24, 2018 at 01:32:55PM +0100, Bruce Richardson wrote:
> To simplify testing with the meson and ninja builds, we can add a script
> to set up and do multiple builds. Currently this script sets up:
> 
> * clang and gcc builds
> * builds using static and shared linkage for binaries (libs are always
>    built as both)
> * a build using the lowest instruction-set level for x86 (-march=nehalem)
> * cross-builds for each cross-file listed in config/arm
> 
> Each build is configured in a directory ending in *-build, and then for
> the build stage, we just call ninja in each directory in turn. [i.e. we
> assume every directory ending in "-build" is a meson build, which is
> probably an ok assumption].
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

By way of update, below is the list I have of open items for the meson
build of DPDK. While it may seems quite a list, it also shows the amount of
material we have in DPDK itself!

While I plan do a number of these, e.g. doing up the documentation on
meson, it would be great if people, particularly driver maintainers, could
look to add support for the missing items in the next release of DPDK. The
biggest gap to close is getting more of the NIC drivers supported.

Please send me on any corrections, too.

Regards,
/Bruce

Gaps for meson build:

- Build of html/pdf docs
- Documentation updates
	- Programmers guide update about the build system itself and
	    it's way of working
	- GSG updates on using meson
- Improved support for unit tests (e.g. benchmark vs regular tests)
- Vector driver support on ARM for ixgbe and i40e
- Map file checking for experimental tags.
- ICC support
- 32-bit compilation

- Library compilation completeness:
	- app - Done
	- drivers/baseband
		 null
		 turbo_sw
	- drivers/bus - Done
	- drivers/crypto
		- aesni_gcm
		- aesni_mb
		- armv8
		- kasumi
		- mrvl
		- scheduler
		- snow3g
		- zuc
	- drivers/event
		- opdl
	- drivers/mempool - Done
	- drivers/net
		- ark
		- avf
		- avp
		- bnx2x
		- bnxt
		- cxgbe
		- ena
		- failsafe
		- kni
		- liquidio
		- mlx4
		- mlx5
		- mvpp2
		- nfp
		- qede
		- softnic
		- szedata2
		- tap
		- vdev_netvsc
		- vhost
		- vmxnet3
	- drivers/raw - [some patches submitted]
	- examples/
		- multi_process
		- netmap_compat
		- performance-thread
		- quota_watermark
		- server_node_efd
		- vm_power_manager
	- kernel/
		 kni
	- lib/ - Done
	- test/
		- cmdline_test
		- test-acl
		- test-pipeline
  
Bruce Richardson April 24, 2018, 2:38 p.m. UTC | #2
On Tue, Apr 24, 2018 at 01:32:55PM +0100, Bruce Richardson wrote:
> To simplify testing with the meson and ninja builds, we can add a script
> to set up and do multiple builds. Currently this script sets up:
> 
> * clang and gcc builds
> * builds using static and shared linkage for binaries (libs are always
>    built as both)
> * a build using the lowest instruction-set level for x86 (-march=nehalem)
> * cross-builds for each cross-file listed in config/arm
> 
> Each build is configured in a directory ending in *-build, and then for
> the build stage, we just call ninja in each directory in turn. [i.e. we
> assume every directory ending in "-build" is a meson build, which is
> probably an ok assumption].
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  devtools/test-meson-builds.sh | 55 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100755 devtools/test-meson-builds.sh
> 
For anyone using this script, I'd recommend updating your copy of meson to
version 0.46. There are some performance optimizations in it that
significantly reduce the time it takes to have meson configure a build.
Actual build time with ninja is as fast as ever, however! :-)

/Bruce
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
new file mode 100755
index 000000000..07a0f4e3c
--- /dev/null
+++ b/devtools/test-meson-builds.sh
@@ -0,0 +1,55 @@ 
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# run meson to auto-configure the various builds
+# * all builds get put in a directory whose name ends in "-build"
+# * if a build-directory already exists we assume it was properly configured
+mesonbuilds ()
+{
+	if [ "$MESON" == "" ]; then
+		MESON=meson;
+	fi;
+	_MESON="$MESON --werror -Dexamples=all";
+
+	# configure shared and static linked builds with gcc and clang
+	for c in gcc clang; do
+		for s in static shared; do
+			builddir=$c-$s-build;
+			if [ -d $builddir ]; then
+				continue;
+			fi
+			echo CC="ccache $c" $_MESON --default-library=$s -Ddefault_library=$s $builddir;
+			CC="ccache $c" $_MESON --default-library=$s -Ddefault_library=$s $builddir || break;
+		done;
+	done;
+
+	# test compilation with minimal x86 instruction set
+	if [ ! -d default-build ] ; then
+		cmd="$_MESON -Dmachine=nehalem default-build";
+		echo $cmd && $cmd || break
+	fi
+
+	# enable cross compilation if gcc cross-compiler is found
+	if command -v aarch64-linux-gnu-gcc >/dev/null 2>&1 ;  then
+		for f in config/arm/arm*gcc; do
+			builddir=`basename $f | awk -F'_' '{print $2}'`;
+			builddir=$builddir-build;
+			if [ -d $builddir ]; then
+				continue;
+			fi
+			cmd="$_MESON --cross-file $f $builddir";
+			echo $cmd && $cmd || break;
+		done;
+	fi;
+}
+
+run_ninja ()
+{
+	for d in *-build ; do
+		ninja -C $d || break
+	done
+}
+
+mesonbuilds
+run_ninja