From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 8EC69DE0
 for <dev@dpdk.org>; Sat, 26 May 2018 13:21:49 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id D6A8520DCC;
 Sat, 26 May 2018 07:21:48 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sat, 26 May 2018 07:21:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:date:from:in-reply-to:message-id:references:subject:to
 :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=SWRQ2BBzRkrknv
 7RA0Xk5PrGUx5mBCt5hYENpJBnQ8A=; b=AedbALBakneZnffUY0RSuGYfpxptPh
 sEPOlyVW9R2Eex7v9WMVjlBYqp6/W8yEVjrz9MGyunP9WkdbcKqC35Lszokjley8
 QPGewvz0J/7YSvCO5StUSRU6ChXnV3m1Z+99r9MWLBr1qXN0/l0KYr9FOtY5q6Jz
 I4ayuQC8V4gR4=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:date:from:in-reply-to:message-id
 :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; bh=SWRQ2BBzRkrknv7RA0Xk5PrGUx5mBCt5hYENpJBnQ8A=; b=c5gVjn7m
 3MmJ5HUE+bWi1U8QKZl1Z+D/WgOzlyYQLAGUlv81lUT9w30B0p0tA1PkLlQRMUNU
 JkuMOuBIVujnAWx9E93aCuy5x/b5994cH7yoOVZ3ZceM7qvzMoqq7z/gIXOd9YUW
 koIxoIkVplIsGqf1ezxLTNuIw625uHu2znTmnLe+nsKzcgOyFnrzGCcNleNTF0rb
 LI4Px5D3vvUGQvX7qVp2MMKxum3p+0F1Ltt1Wn+bl/+YA6/4QarQgQkZTjxAu1Da
 OTjUStZFtOo9SiiDPRH+L3NHi+h5EF5vgDX34Fj/dHFuAlH7kj6cOE+/TX8ADVjq
 hI1gUoOzEtGplg==
X-ME-Proxy: <xmx:TEMJWzjZXDdFoF5HLyvt8M-I8ueINjPfcQLS4b9zB1eFvg2ri2F3bA>
X-ME-Proxy: <xmx:TEMJWwPDmQGIs_B-y5PvmTK88wNrmN_Rs3NPCdPxOxbbr0CLDq0ljg>
X-ME-Proxy: <xmx:TEMJW04DS1xxn2MA2QtFHdnF1jUoqXUdBEW9sU1M41pRoZGDQdpGEQ>
X-ME-Proxy: <xmx:TEMJW-35lko25rxjFSCgQL2xsSSlBuhjS_fDopEl2RopSV4t66eu9A>
X-ME-Proxy: <xmx:TEMJW1ZD5_CSiiJU81DqXcD8SWhWy2KkqFKIhP464row-84IZu0Hxw>
X-ME-Proxy: <xmx:TEMJW2-qFoqR0ZGjphGrcYlu7oPfyVDiTsxhew4dw4K5AY7sEwnHhA>
X-ME-Sender: <xms:TEMJWyPk5NI8kvl4I9Z-0siVDN5Y8-ow8zUNHUMX9rBfPFkbgRjhKw>
Received: from xps.monjalon.net (14.18.136.77.rev.sfr.net [77.136.18.14])
 by mail.messagingengine.com (Postfix) with ESMTPA id 3BCDCE4412;
 Sat, 26 May 2018 07:21:46 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Date: Sat, 26 May 2018 13:21:42 +0200
Message-Id: <20180526112142.9975-1-thomas@monjalon.net>
X-Mailer: git-send-email 2.16.2
In-Reply-To: <20180424123255.204330-1-bruce.richardson@intel.com>
References: <20180424123255.204330-1-bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v4] devtools: add test script for meson builds
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://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sat, 26 May 2018 11:21:49 -0000

From: Bruce Richardson <bruce.richardson@intel.com>

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 starting with "build-" is a meson build, which is
probably an ok assumption].

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: it is a rework with 3 major changes
   - automatically stop on error thanks to -e
   - directory name starts with "build-"
   - optionally load a config file to get some environment variables
v3:
   - remove forcing "cd": use current directory
   - remove CROSS: use hard-written aarch64-linux-gnu-gcc
   - remove config load in script start
v4:
   - remove config file loading (will be improved and sent later)
   - the v4 is closer to what Bruce sent as v1
---
 MAINTAINERS                   |  1 +
 devtools/test-meson-builds.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100755 devtools/test-meson-builds.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index e56c72687..4d015fe53 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -86,6 +86,7 @@ F: devtools/get-maintainer.sh
 F: devtools/git-log-fixes.sh
 F: devtools/load-devel-config
 F: devtools/test-build.sh
+F: devtools/test-meson-builds.sh
 F: license/
 
 
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
new file mode 100755
index 000000000..78d712aea
--- /dev/null
+++ b/devtools/test-meson-builds.sh
@@ -0,0 +1,43 @@
+#! /bin/sh -e
+# 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 starts with "build-"
+# * if a build-directory already exists we assume it was properly configured
+# Run ninja after configuration is done.
+
+MESON=${MESON:-meson}
+
+build () # <directory> <meson options>
+{
+	dir=$1
+	shift
+	if [ ! -d "$dir" ] ; then
+		options="--werror -Dexamples=all $*"
+		echo "$MESON $options $dir"
+		$MESON $options $dir
+		unset CC
+	fi
+	echo "ninja -C $dir"
+	ninja -C $dir
+}
+
+# shared and static linked builds with gcc and clang
+for c in gcc clang ; do
+	for s in static shared ; do
+		export CC="ccache $c"
+		build build-$c-$s --default-library=$s
+	done
+done
+
+# test compilation with minimal x86 instruction set
+build build-x86-default -Dmachine=nehalem
+
+# enable cross compilation if gcc cross-compiler is found
+for f in config/arm/arm*gcc ; do
+	if ! command -v aarch64-linux-gnu-gcc >/dev/null 2>&1 ; then
+		continue
+	fi
+	build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) --cross-file $f
+done
-- 
2.16.2