-
Notifications
You must be signed in to change notification settings - Fork 526
/
build.sh
executable file
·35 lines (27 loc) · 768 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -e
# Move to this script's directory.
CDPATH= cd -- "$(dirname -- "$0")"
case $1 in
plain|debug|debugoptimized|release|minsize)
BUILDTYPE=$1
shift
;;
*)
BUILDTYPE=release
;;
esac
BUILDDIR=build/${BUILDTYPE}
MESON=$(PATH="${PATH}:${HOME}/.local/bin" command -v meson || :)
MESON=${MESON:?"Could not find meson. Is it installed and in PATH?"}
if [ -f "${BUILDDIR}/build.ninja" ]
then
"${MESON}" configure "${BUILDDIR}" -Dbuildtype="${BUILDTYPE}" -Dprefix="${INSTALL_PREFIX:-/usr/local}" "$@"
else
"${MESON}" "${BUILDDIR}" --buildtype "${BUILDTYPE}" --prefix "${INSTALL_PREFIX:-/usr/local}" "$@"
fi
"${MESON}" compile -C "${BUILDDIR}"
if [ -n "${INSTALL_PREFIX}" ]
then
"${MESON}" install -C "${BUILDDIR}"
fi