From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5B425A0093;
	Mon, 15 Jun 2020 00:58:51 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 88A154CA6;
	Mon, 15 Jun 2020 00:58:44 +0200 (CEST)
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id AF7B74C90
 for <dev@dpdk.org>; Mon, 15 Jun 2020 00:58:43 +0200 (CEST)
Received: from compute7.internal (compute7.nyi.internal [10.202.2.47])
 by mailout.nyi.internal (Postfix) with ESMTP id EBC335C00C6;
 Sun, 14 Jun 2020 18:58:42 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute7.internal (MEProxy); Sun, 14 Jun 2020 18:58:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding; s=fm1; bh=eBbSeJGh0psHY
 kZLFlA1afguXVBE2uk1mkxh7nV7mew=; b=AcFpYdVj5ikPadBGuo4IAPH83VPJx
 2dShpzedF4i5w+FUOE0MRLXUMtap1CZmBTjBA57vwIy5Eza+h6sam76urWo4gf6g
 0XwBF9Z8KU4L2eMmMMwRSHlVHiHSoGAi5YTQemHadvcdqG44GpXli9yxX33c/BLi
 VETpxXmCVVng6AdQIiPRFlWeVx5BZqT7yrD0Gagp92MPypgq7GKFrSEgl8xk+5/I
 xZZbqNMHSrCgC5EXUqRwYPkdmigDm6snuXGB5qYH49LcGvE8XhVXjWtBK3ylcYED
 GK2rMRkMJXF+ZI9EMF+aIIS6Raw0WJZgueugz01tqQH5Jnow0dtnhIXXw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:date:from
 :in-reply-to:message-id:mime-version:references:subject:to
 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm3; bh=eBbSeJGh0psHYkZLFlA1afguXVBE2uk1mkxh7nV7mew=; b=DNS63ulO
 9FTsim5BYA3iM8rdbxEZTHmYvNa/QN0v6S2TDObdwJG4r2/VNQkcFeJd2TD7k/ME
 LDXVlsVgnQGLxcb4PZ+WqZinlwhh48VK3+u7pPuom/8TRAQHKUytfQypxZpxQISS
 Y6+dPwhPogxYGBpBm+dkhzypBEFfXb/zDX6etk30QraqmlMdbE6yVTMLu825aecY
 Yu0ljFqHQVINQkzxSRCG1dmTnQRsbcsi5JbV81uaBnnAuLh4lZSv876u85ju4k0Z
 eA5MzldC5IKT4X97yEs/8DpPRaxjobWWO26L3A2HBZ88o+y3IPs/GcsK6Xuf6IPD
 yyFk86JGVi3RMw==
X-ME-Sender: <xms:oqvmXpNYHJ0asST6AYy9fWcqixO0LgVlwWvYvWzeOZ5pUD1DhV69eQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeijedgudekucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre
 dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes
 mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvhefgiedvjeegtdevhe
 efhfetleefgfeivefgffevfeejgedtgfeutdehtdegveenucfkphepjeejrddufeegrddv
 tdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:oqvmXr_kH8Yb7SG2q_FJZLrOGLn9wkB74fOxgfcKo_x5GU-BruweqA>
 <xmx:oqvmXoRXjHwI1PUN28xpG1UcH8CeDKTRAKBrrVBhd-FxKps6HRg6Dw>
 <xmx:oqvmXltH9YgHHGaP_kYuV-Yi6dDk3G9vEOYHWvpkbm5CoGzksjas7g>
 <xmx:oqvmXhHDbe8ri4Ez9tioGcghgq0tUyQaHHJ7WHwqfNx918QUyAlOFA>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 14BA93280059;
 Sun, 14 Jun 2020 18:58:41 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, bruce.richardson@intel.com,
 drc@linux.vnet.ibm.com, dmitry.kozliuk@gmail.com
Date: Mon, 15 Jun 2020 00:57:44 +0200
Message-Id: <20200614225747.3839569-2-thomas@monjalon.net>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20200614225747.3839569-1-thomas@monjalon.net>
References: <20200614225747.3839569-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 1/4] devtools: shrink cross-compilation test
	definition
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Each cross-compilation case needs to define the target compiler
and the meson cross file.
Given the compiler is already defined in the cross file,
the latter is enough.

The function "build" is changed to accept a cross file alternatively
to the compiler name. In the case of a file (detected if readable),
the compiler is extracted with sed and tr, and the option --cross-file
is automatically added.

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

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 18b874fac5..602167e43a 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -117,16 +117,24 @@ install_target () # <builddir> <installdir>
 	fi
 }
 
-build () # <directory> <target compiler> <meson options>
+build () # <directory> <target compiler | cross file> <meson options>
 {
 	targetdir=$1
 	shift
-	targetcc=$1
+	crossfile=
+	[ -r $1 ] && crossfile=$1 || targetcc=$1
 	shift
 	# skip build if compiler not available
 	command -v ${CC##* } >/dev/null 2>&1 || return 0
+	if [ -n "$crossfile" ] ; then
+		cross="--cross-file $crossfile"
+		targetcc=$(sed -n 's,^c[[:space:]]*=[[:space:]]*,,p' \
+			$crossfile | tr -d "'" | tr -d '"')
+	else
+		cross=
+	fi
 	load_env $targetcc || return 0
-	config $srcdir $builds_dir/$targetdir --werror $*
+	config $srcdir $builds_dir/$targetdir $cross --werror $*
 	compile $builds_dir/$targetdir
 	if [ -n "$DPDK_ABI_REF_VERSION" ]; then
 		abirefdir=${DPDK_ABI_REF_DIR:-reference}/$DPDK_ABI_REF_VERSION
@@ -186,17 +194,15 @@ if [ "$ok" = "false" ] ; then
 fi
 build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine $use_shared
 
-c=aarch64-linux-gnu-gcc
 # generic armv8a with clang as host compiler
+f=$srcdir/config/arm/arm64_armv8_linux_gcc
 export CC="clang"
-build build-arm64-host-clang $c $use_shared \
-	--cross-file $srcdir/config/arm/arm64_armv8_linux_gcc
+build build-arm64-host-clang $f $use_shared
 unset CC
-# all gcc/arm configurations
+# some gcc/arm configurations
 for f in $srcdir/config/arm/arm64_[bdo]*gcc ; do
 	export CC="$CCACHE gcc"
-	build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) $c \
-		$use_shared --cross-file $f
+	build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) $f $use_shared
 	unset CC
 done
 
-- 
2.26.2