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 -f $0))/..
12 use_shared="--default-library=shared"
14 if command -v ninja >/dev/null 2>&1 ; then
16 elif command -v ninja-build >/dev/null 2>&1 ; then
19 echo "ERROR: ninja is not found" >&2
23 build () # <directory> <meson options>
27 if [ ! -f "$builddir/build.ninja" ] ; then
28 options="--werror -Dexamples=all $*"
29 echo "$MESON $options $srcdir $builddir"
30 $MESON $options $srcdir $builddir
33 if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
34 # for full output from ninja use "-v"
35 echo "$ninja_cmd -v -C $builddir"
36 $ninja_cmd -v -C $builddir
37 elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
38 # for keeping the history of short cmds, pipe through cat
39 echo "$ninja_cmd -C $builddir | cat"
40 $ninja_cmd -C $builddir | cat
42 echo "$ninja_cmd -C $builddir"
43 $ninja_cmd -C $builddir
47 if [ "$1" == "-vv" ] ; then
48 TEST_MESON_BUILD_VERY_VERBOSE=1
49 elif [ "$1" == "-v" ] ; then
50 TEST_MESON_BUILD_VERBOSE=1
53 # shared and static linked builds with gcc and clang
54 for c in gcc clang ; do
55 for s in static shared ; do
57 build build-$c-$s --default-library=$s
61 # test compilation with minimal x86 instruction set
62 build build-x86-default -Dmachine=nehalem $use_shared
64 # enable cross compilation if gcc cross-compiler is found
65 c=aarch64-linux-gnu-gcc
66 if command -v $c >/dev/null 2>&1 ; then
67 # compile the general v8a also for clang to increase coverage
68 export CC="ccache clang"
69 build build-arm64-host-clang $use_shared \
70 --cross-file config/arm/arm64_armv8_linuxapp_gcc
72 for f in config/arm/arm*gcc ; do
73 export CC="ccache gcc"
74 build build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) \
75 $use_shared --cross-file $f