[6/6] devtools: load target-specific compilation environment
diff mbox series

Message ID 20190812230358.988-7-thomas@monjalon.net
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • build system improvements
Related show

Checks

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

Commit Message

Thomas Monjalon Aug. 12, 2019, 11:03 p.m. UTC
In order to re-use the same test environment as with
test-build.sh, the configuration file is loaded at each build,
after adjusting the variable DPDK_TARGET.

This is especially useful to set the variable PKG_CONFIG_PATH,
or define some meson options (without -D) in DPDK_MESON_OPTIONS.

The DPDK_TARGET values can be
	aarch64-*, powerpc64-*, x86_64-*.
The matching DPDK_TARGET values for test-build.sh are
	arm64-*, ppc_64-*, x86_64-*.
The advised expressions to use in the common configuration file are:
	if echo $DPDK_TARGET | grep -q '^a.*64-' ; then
	elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then
	elif echo $DPDK_TARGET | grep -q '^x86_64' ; then
	fi

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/test-meson-builds.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

Luca Boccassi Aug. 13, 2019, 9:41 a.m. UTC | #1
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> In order to re-use the same test environment as with
> test-build.sh, the configuration file is loaded at each build,
> after adjusting the variable DPDK_TARGET.
> 
> This is especially useful to set the variable PKG_CONFIG_PATH,
> or define some meson options (without -D) in DPDK_MESON_OPTIONS.
> 
> The DPDK_TARGET values can be
>         aarch64-*, powerpc64-*, x86_64-*.
> The matching DPDK_TARGET values for test-build.sh are
>         arm64-*, ppc_64-*, x86_64-*.
> The advised expressions to use in the common configuration file are:
>         if echo $DPDK_TARGET | grep -q '^a.*64-' ; then
>         elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then
>         elif echo $DPDK_TARGET | grep -q '^x86_64' ; then
>         fi
> 
> Signed-off-by: Thomas Monjalon <
> thomas@monjalon.net
> >
> ---
>  devtools/test-meson-builds.sh | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)

Acked-by: Luca Boccassi <bluca@debian.org>

Patch
diff mbox series

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index f2b0b347b..a51a04d5a 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -29,15 +29,32 @@  else
 	exit 1
 fi
 
+default_path=$PATH
+default_pkgpath=$PKG_CONFIG_PATH
+
+reset_env ()
+{
+	export PATH=$default_path
+	export PKG_CONFIG_PATH=$default_pkgpath
+	unset DPDK_MESON_OPTIONS
+}
+
 build () # <directory> <target compiler> <meson options>
 {
 	builddir=$1
 	shift
 	targetcc=$1
 	shift
+	reset_env
+	DPDK_TARGET=$($targetcc -v 2>&1 | sed -n 's,^Target: ,,p')
+	. $srcdir/devtools/load-devel-config
 	if command -v $CC $targetcc >/dev/null 2>&1 ; then
 		if [ ! -f "$builddir/build.ninja" ] ; then
-			options="--werror -Dexamples=all $*"
+			options="--werror -Dexamples=all"
+			for option in $DPDK_MESON_OPTIONS ; do
+				options="$options -D$option"
+			done
+			options="$options $*"
 			echo "$MESON $options $srcdir $builddir"
 			$MESON $options $srcdir $builddir
 			unset CC