forked from LeelaChessZero/lc0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·42 lines (32 loc) · 736 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
36
37
38
39
40
41
42
#!/usr/bin/env bash
pushd "$(dirname "$0")"
set -e
case $1 in
plain|debug|debugoptimized|release|minsize)
BUILDTYPE=$1
shift
;;
*)
BUILDTYPE=release
;;
esac
BUILDDIR=build/${BUILDTYPE}
if ! hash meson 2>/dev/null && [ -x ${HOME}/.local/bin/meson ]
then
export PATH=${PATH}:${HOME}/.local/bin
fi
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
cd ${BUILDDIR}
NINJA=$(awk '/ninja/ {ninja=$4} END {print ninja}' meson-logs/meson-log.txt)
if [ -n "${INSTALL_PREFIX}" ]
then
${NINJA} install
else
${NINJA}
fi
popd