[v2,1/1] devtools: fix build test config inheritance from env

Message ID 20201112142233.1433309-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Headers
Series [v2,1/1] devtools: fix build test config inheritance from env |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Thomas Monjalon Nov. 12, 2020, 2:22 p.m. UTC
  The variables DPDK_MESON_OPTIONS, PATH, PKG_CONFIG_PATH,
CPPFLAGS, CFLAGS and LDFLAGS can be customized in the config file
loaded by devtools/load-devel-config at each build.
The configuration can be adjusted per target thanks to the value set
in the DPDK_TARGET variable.

PKG_CONFIG_PATH is specific to each target, so it must be empty
before configuring each build from the file according to DPDK_TARGET.
Inheriting a default PKG_CONFIG_PATH for all targets does not make sense
and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment
to customize a build test from the shell. Example:
	DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
	DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes: 272236741258 ("devtools: load target-specific compilation environment")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
---
v2:
- unset PKG_CONFIG_PATH because empty is printed by meson
- add more comments
---
 devtools/test-meson-builds.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

David Marchand Nov. 12, 2020, 2:36 p.m. UTC | #1
On Thu, Nov 12, 2020 at 3:22 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The variables DPDK_MESON_OPTIONS, PATH, PKG_CONFIG_PATH,
> CPPFLAGS, CFLAGS and LDFLAGS can be customized in the config file
> loaded by devtools/load-devel-config at each build.
> The configuration can be adjusted per target thanks to the value set
> in the DPDK_TARGET variable.
>
> PKG_CONFIG_PATH is specific to each target, so it must be empty
> before configuring each build from the file according to DPDK_TARGET.
> Inheriting a default PKG_CONFIG_PATH for all targets does not make sense
> and is prone to confusion.
>
> DPDK_MESON_OPTIONS might take a global initial value from environment
> to customize a build test from the shell. Example:
>         DPDK_MESON_OPTIONS="b_lto=true"
> Some target-specific options can be added in the configuration file:
>         DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"
>
> Fixes: 272236741258 ("devtools: load target-specific compilation environment")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Tested-by: Jerin Jacob <jerinj@marvell.com>

Acked-by: David Marchand <david.marchand@redhat.com>
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 0c95d1cc98..f32b5784f4 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -38,10 +38,10 @@  else
 fi
 
 default_path=$PATH
-default_pkgpath=$PKG_CONFIG_PATH
 default_cppflags=$CPPFLAGS
 default_cflags=$CFLAGS
 default_ldflags=$LDFLAGS
+default_meson_options=$DPDK_MESON_OPTIONS
 
 check_cc_flags () # <flag to check> <flag2> ...
 {
@@ -52,12 +52,14 @@  check_cc_flags () # <flag to check> <flag2> ...
 load_env () # <target compiler>
 {
 	targetcc=$1
+	# reset variables before target-specific config
 	export PATH=$default_path
-	export PKG_CONFIG_PATH=$default_pkgpath
+	unset PKG_CONFIG_PATH # global default makes no sense
 	export CPPFLAGS=$default_cppflags
 	export CFLAGS=$default_cflags
 	export LDFLAGS=$default_ldflags
-	unset DPDK_MESON_OPTIONS
+	export DPDK_MESON_OPTIONS=$default_meson_options
+	# set target hint for use in the loaded config file
 	if [ -n "$target_override" ] ; then
 		DPDK_TARGET=$target_override
 	elif command -v $targetcc >/dev/null 2>&1 ; then