From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D308514E8 for ; Fri, 25 May 2018 17:19:03 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 May 2018 08:19:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,440,1520924400"; d="scan'208";a="50190814" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55]) by fmsmga002.fm.intel.com with SMTP; 25 May 2018 08:19:00 -0700 Received: by (sSMTP sendmail emulation); Fri, 25 May 2018 16:18:59 +0100 Date: Fri, 25 May 2018 16:18:58 +0100 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org Message-ID: <20180525151858.GA18500@bricha3-MOBL.ger.corp.intel.com> References: <20180424123255.204330-1-bruce.richardson@intel.com> <20180525145158.5113-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180525145158.5113-1-thomas@monjalon.net> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2018 15:19:04 -0000 On Fri, May 25, 2018 at 04:51:58PM +0200, Thomas Monjalon wrote: > From: Bruce Richardson > > 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]. > > It can use the same configuration file as for the legacy test-build.sh. > > Signed-off-by: Bruce Richardson > Signed-off-by: Thomas Monjalon > --- > 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 > --- > MAINTAINERS | 1 + > devtools/test-meson-builds.sh | 75 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 76 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..8ce0a1d31 > --- /dev/null > +++ b/devtools/test-meson-builds.sh > @@ -0,0 +1,75 @@ > +#! /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. > + > +default_path=$PATH > + > +# Load config options > +. $(dirname $(readlink -e $0))/load-devel-config > + Why is this needed here, it seems to be called before each individual config anyway. > +reset_env () > +{ > + export PATH=$default_path > + unset CROSS > + unset ARMV8_CRYPTO_LIB_PATH > + unset FLEXRAN_SDK > + unset LIBMUSDK_PATH > + unset LIBSSO_SNOW3G_PATH > + unset LIBSSO_KASUMI_PATH > + unset LIBSSO_ZUC_PATH > + unset PQOS_INSTALL_PATH These variables bar PATH are unused by meson build, so should be removed here to avoid giving the impression they are use. $CROSS is used by the script so perhaps it can be kept. However, the whole point of the cross-files is that you include all the needed details of your compiler there. I think we should move away from using the CROSS value completely, and use the cross-files properly. > +} > + > +cd $(dirname $(readlink -m $0))/.. > + I don't think we should force the builds to be always put into the base directory. Instead of using cd, I think we should instead capture the base directory path and pass that to meson. > +load_config () > +{ > + reset_env > + . $(dirname $(readlink -e $0))/load-devel-config > + MESON=${MESON:-meson} > +} Why does this need to be done each time? > + > +build () # > +{ > + dir=$1 > + shift > + if [ ! -d "$dir" ] ; then > + options="--werror -Dexamples=all $*" > + # TODO: the configuration variables $DPDK_DEP_CFLAGS > + # and $DPDK_DEP_LDFLAGS are not handled in this script > + 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 > + load_config > + export CC="ccache $c" > + build build-$c-$s --default-library=$s > + done > +done > + > +# test compilation with minimal x86 instruction set > +load_config > +build build-x86-default -Dmachine=nehalem > + > +# enable cross compilation if gcc cross-compiler is found > +for f in config/arm/arm*gcc ; do > + DPDK_TARGET=$(basename $f | tr '_' '-') > + load_config > + CROSS=${CROSS:-aarch64-linux-gnu-} > + if ! command -v ${CROSS}gcc >/dev/null 2>&1 ; then > + continue > + fi > + build build-$(echo $DPDK_TARGET | cut -d'-' -f-2) --cross-file $f > +done > -- > 2.16.2 >