2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright(c) 2018 Intel Corporation
5 # Run meson to auto-configure the various builds.
6 # * all builds get put in a directory whose name starts with "build-"
7 # * if a build-directory already exists we assume it was properly configured
8 # Run ninja after configuration is done.
10 srcdir=$(dirname $(readlink -m $0))/..
13 if command -v ninja >/dev/null 2>&1 ; then
15 elif command -v ninja-build >/dev/null 2>&1 ; then
18 echo "ERROR: ninja is not found" >&2
22 build () # <directory> <meson options>
26 if [ ! -d "$builddir" ] ; then
27 options="--werror -Dexamples=all $*"
28 echo "$MESON $options $srcdir $builddir"
29 $MESON $options $srcdir $builddir
32 echo "$ninja_cmd -C $builddir"
33 $ninja_cmd -C $builddir
36 # shared and static linked builds with gcc and clang
37 for c in gcc clang ; do
38 for s in static shared ; do
40 build build-$c-$s --default-library=$s
44 # test compilation with minimal x86 instruction set
45 build build-x86-default -Dmachine=nehalem
47 # enable cross compilation if gcc cross-compiler is found
48 c=aarch64-linux-gnu-gcc
49 if command -v $c >/dev/null 2>&1 ; then
50 # compile the general v8a also for clang to increase coverage
51 export CC="ccache clang"
52 build build-arm64-host-clang --cross-file \
53 config/arm/arm64_armv8_linuxapp_gcc
55 for f in config/arm/arm*gcc ; do
56 export CC="ccache gcc"
57 build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \