-
Notifications
You must be signed in to change notification settings - Fork 13
/
build_tools.sh
executable file
·90 lines (80 loc) · 1.5 KB
/
build_tools.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
. ./build.cfg
if ! [ -x "$(command -v git)" ]
then
printf "'git' is not installed.\n"
exit
fi
set -e
VVM_MAKEFILE=./src/vvmtool/Makefile
COMPILE_SYS=$(uname)
# Check how many cores/processors we should use for building
if ! [ -x "$(command -v nproc)" ]
then
# check if we're on OpenBSD then
if ! [ -x "$(command -v sysctl)" ]
then
BUILD_PROC=1
else
BUILD_PROC=$(sysctl -n hw.ncpu)
fi
else
BUILD_PROC=$(nproc)
fi
# Compiler choice
if [ "$COMPILE_SYS" = "OpenBSD" ]
then
ENGINE_CC=cc
ENGINE_CXX=c++
else
if [ "$BUILD_CLANG" = "1" ]; then
ENGINE_CC=clang
ENGINE_CXX=clang++
else
ENGINE_CC=gcc
ENGINE_CXX=g++
fi
fi
# GNU Make is _not_ make!...
if [ "$COMPILE_OS" = "Msys" ]; then
MAKE=make
PLATFORM=win64
else
if ! [ -x "$(command -v gmake)" ]
then
# only assume that Linux may not ship with a gmake... HACK!
if [ "$COMPILE_SYS" = "Linux" ]
then
MAKE=make
else
printf "You need to install GNU make.\n"
fi
else
MAKE=gmake
fi
fi
mkdir -p ./bin
if [ -f "$VVM_MAKEFILE" ]
then
if [ "$BUILD_UPDATE" -eq 1 ]
then
printf "vvmtool is present, updating...\n"
cd ./src/vvmtool
git pull
else
cd ./src/vvmtool
fi
else
printf "vvmtool is NOT present, cloning...\n"
cd ./src/
git clone https://github.com/VeraVisions/vvmtool
cd ./vvmtool
fi
if [ "$BUILD_CLEAN" -eq 1 ]
then
$MAKE clean
fi
$MAKE -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX
printf "Built vvmtool successfully.\n"
cp -v vvmtool ../../bin/vvmtool
printf "DONE. Built ALL components successfully.\n"