summaryrefslogtreecommitdiffstats
path: root/tools/meson-build.sh
blob: 2ef60cfa8e3e889a8b4279e66bf8a872ce072db6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux

src="$1"
dst="$2"
target="$3"
options="$4"
CC="$5"
CXX="$6"

# shellcheck disable=SC2086
[ -f "$dst/build.ninja" ] || CC="$CC" CXX="$CXX" meson setup "$src" "$dst" $options

# Locate ninja binary, on CentOS 7 it is called ninja-build, so
# use that name if available.
ninja="ninja"
if command -v ninja-build >/dev/null ; then
    ninja="ninja-build"
fi

"$ninja" -C "$dst" "$target"