-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.sh
executable file
·69 lines (56 loc) · 1.29 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Desc: Savage Wheels Linux Build Script
CMD="$1"
CPU_CORES="2"
TAR="$(which tar)"
CUR_DIR="$(dirname $(readlink -f $0))"
BIN_PATH="$CUR_DIR/bin"
BUILD_PATH="$CUR_DIR/release"
CMAKE="$(which cmake)"
CPACK="$(which cpack)"
VERMAJ=`perl -nle 'print $1 if /.*VER_MAJ\s(\d+).*/' src/Main.h`
VERMIN=`perl -nle 'print $1 if /.*VER_MIN\s(\d+).*/' src/Main.h`
VERSION="$VERMAJ.$VERMIN"
usage() {
echo "dist-build.sh - Savage Wheels ${VERMAJ}.${VERMIN} distributable package build script"
echo "Usage:"
echo " clean - clean files from previous package build"
echo " build - clean and create new package files"
echo
}
cleanup() {
echo "Cleaning up old files ..."
cd $BUILD_PATH
make clean
cd ..
rm $BUILD_PATH/* -rf
echo "Cleanup done."
}
build() {
echo "Building package ..."
if [ ! -e $CMAKE ]; then
echo "CMake was not found - $CMAKE"
exit
fi
if [ ! -e $CPACK ]; then
echo "CPack was not found - $CPACK"
exit
fi
cd $BUILD_PATH
$CMAKE cmake -G "Unix Makefiles" ../ \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_BUILD_STATIC=1
make -j$CPU_CORES
$CPACK
cd ..
echo "Build done."
echo "You can find the game packages in $BUILD_PATH. Enjoy :)"
}
if [ "$1" = "clean" ]; then
cleanup
elif [ "$1EMPTY" = "EMPTY" ]; then
cleanup
build
else
usage
fi