forked from Return-To-The-Roots/s25client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh.cmake
112 lines (99 loc) · 1.71 KB
/
start.sh.cmake
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
export LD_LIBRARY_PATH=libsiedler2/src
export EF_ALLOW_MALLOC_0=1
export EF_PROTECT_FREE=0
export EF_FREE_WIPES=1
BIN=@RTTR_BINDIR@/s25client
CMD=
ARGS=
BINARGS=
BUGLE=
while test $# != 0 ; do
case $1 in
--*=*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=2
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=1
;;
esac
case $ac_option in
-l | --load)
BINARGS="$ac_optarg"
if [ -n "$ac_optarg" ]
then
ac_shift=2
fi
;;
-n | --nowait)
NOWAIT=1
;;
-m | --makeargs)
MAKEARGS="$ac_optarg"
if [ -n "$ac_optarg" ]
then
ac_shift=2
fi
;;
debug)
CMD=gdb
BIN="--args $BIN"
;;
valgrind)
CMD=valgrind
ARGS="$ARGS --leak-check=full --log-file=s25client"
;;
callgrind)
CMD=valgrind
ARGS="$ARGS --tool=callgrind --instr-atstart=no"
;;
--bugle-chain)
BUGLE="$ac_optarg"
ac_shift=2
;;
bugle)
BUGLE=showcalltimes
;;
ddd)
CMD=ddd
;;
mpatrol)
CMD=mpatrol
ARGS="$ARGS -C"
;;
*)
echo "Unknown option: $ac_option"
exit 1
;;
esac
shift $ac_shift
done
if [ -f /proc/cpuinfo ] ; then
CPU_COUNT=`grep -ce '^processor' /proc/cpuinfo`
if test "$CPU_COUNT" -gt 1; then
MAKEARGS="-j $((1+$CPU_COUNT)) $MAKEARGS"
fi
elif [ $(sysctl -n hw.ncpu) -gt 1 ]; then
MAKEARGS="-j $((1 + $(sysctl -n hw.ncpu))) $MAKEARGS"
fi
make $MAKEARGS
if [ $? != 0 ] ; then
exit 1
fi
case $CMD in
gdb)
if [ -n "$NOWAIT" ] ; then
ARGS="$ARGS -x start.gdb"
fi
;;
esac
if [ -n "$BUGLE" ]; then
BUGLE_FILTERS="bugle/filters" BUGLE_STATISTICS="bugle/statistics" BUGLE_CHAIN="$BUGLE" LD_PRELOAD=libbugle.so $CMD $ARGS $BIN $BINARGS
else
$CMD $ARGS $BIN $BINARGS
fi
exit $?