forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathninja_compile.sh
34 lines (28 loc) · 891 Bytes
/
ninja_compile.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
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
. "$DIR/prelude.sh"
cd src
set -o errexit
set -o verbose
activate_venv
if [[ -n "${ninja_jobs}" ]]; then
JOBS_ARG="-j${ninja_jobs}"
fi
if [ "Windows_NT" = "$OS" ]; then
vcvars="$(vswhere -latest -property installationPath | tr '\\' '/' | dos2unix.exe)/VC/Auxiliary/Build/"
echo "call \"$vcvars/vcvarsall.bat\" amd64" > msvc.bat
for i in "${compile_env[@]}"; do
echo "set $i" >> msvc.bat
done
echo "ninja -f ${ninja_file} ${JOBS_ARG} ${targets}" >> msvc.bat
for i in $(seq ${ninja_retries:=1}); do
cmd /C msvc.bat && RET=0 && break || RET=$? && sleep 1
done
else
for i in $(seq ${ninja_retries:=1}); do
eval ${compile_env} ninja -f ${ninja_file} ${JOBS_ARG} ${targets} && RET=0 && break || RET=$? && sleep 1
done
fi
if [ $RET -ne 0 ]; then
echo "Ninja command failed"
exit $RET
fi