forked from Flatlander57/TheImaginedServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
50 lines (41 loc) · 1.06 KB
/
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
#!/bin/bash
# CCache + multicore compilation script
# For "The Forgotten Server"
# Example:
# # make clean
# # time ./build.sh
# Gives:
# real 3m27.070s
# user 6m4.066s
# sys 0m16.659s
# CCACHE recompile (from scratch):
# # make clean
# # time ./build.sh
# Gives:
# real 0m27.620s
# user 0m43.744s
# sys 0m4.766s
# 1/7 of the original compile time!
# When more you do it, more ccache will cache, default is limited to use 1GB storage
echo "The Forgotten Server build script - "
# Enable CCache
if test -x `which ccache`; then
echo "Using ccache"
if [ -f /usr/lib/ccache/bin ]; then
export PATH=/usr/lib/ccache/bin/:$PATH
echo "CCache binaries located in /usr/lib/ccache/bin"
else
export PATH=/usr/lib/ccache/:$PATH
echo "CCache binaries located in /usr/lib/ccache"
fi
else
echo "Warning: NOT using ccache, increase build time"
fi
# Get number cores
CORES=`grep processor /proc/cpuinfo | wc -l`
# Set make processes - 1 + number of cores
MAKEOPT=$(($CORES + 1))
echo ""
echo "Start building on $CORES cores, using $MAKEOPT processes"
echo ""
make V=0 -j $MAKEOPT