forked from multitheftauto/mtasa-blue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux-build.sh
executable file
·63 lines (53 loc) · 1.23 KB
/
linux-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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Find premake binary location
if [ "$(uname)" == "Darwin" ]; then
PREMAKE5=utils/premake5-macos
else
PREMAKE5=utils/premake5
fi
ENV_CONFIG=$CONFIG
DEFAULT=2
# Debug vs Release
if [[ $2 = "release" ]] || [[ $2 = "debug" ]]; then
CONFIG=$2
elif [[ $2 != "" ]]; then
printf "Unknown build type \"$2\" provided\n"
exit 1
else
CONFIG=release
((DEFAULT--))
fi
# 32bit vs 64bit
if [[ $1 = "32" ]] || [[ $1 = "x86" ]]; then
CONFIG=${CONFIG}_x86
elif [[ $1 = "64" ]] || [[ $1 = "x64" ]]; then
CONFIG=${CONFIG}_x64
elif [[ $1 != "" ]]; then
printf "Unknown architecture \"$1\" provided\n"
exit 1
else
CONFIG=${CONFIG}_x64
((DEFAULT--))
fi
# Only apply $CONFIG from environment if no args provided
if [[ $ENV_CONFIG != "" ]]; then
if [[ $DEFAULT != 0 ]]; then
printf "Ignoring provided \$CONFIG environment variable, "
else
CONFIG=$ENV_CONFIG
fi
fi
printf "\$CONFIG=$CONFIG\n"
# Clean old build files
rm -Rf Build/
rm -Rf Bin/
# Generate makefiles
$PREMAKE5 gmake
# Number of cores
if [ "$(uname)" == "Darwin" ]; then
NUM_CORES=$(sysctl -n hw.ncpu)
else
NUM_CORES=$(grep -c ^processor /proc/cpuinfo)
fi
# Build!
make -C Build/ -j$NUM_CORES config=$CONFIG all