-
Notifications
You must be signed in to change notification settings - Fork 0
/
RUNME
executable file
·209 lines (184 loc) · 5.48 KB
/
RUNME
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/sh
#
# Copyright (C) 2014 Neil McGill
#
# This game is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This game is distributed in the hope that it will be fun,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this game; if not, write to the Free
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. ./build/VERSION
. ./build/common.sh
echo ${RED}
echo " @@@@@@@@ @@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@"
echo " @@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@@ @@@@@@@@ @@@@@@@"
echo " !@@ @@! @@@ @@! @@@ !@@ @@! @@!"
echo " !@! !@! @!@ !@! @!@ !@! !@! !@!"
echo " !@! @!@!@ @!@ !@! @!@!!@! !@! @!@!@ @!!!:! @!!"
echo " !!! !!@!! !@! !!! !!@!@! !!! !!@!! !!!!!: !!!"
echo " :!! !!: !!: !!! !!: :!! :!! !!: !!: !!:"
echo " :!: !:: :!: !:! :!: !:! :!: !:: :!: :!:"
echo " ::: :::: ::::: :: :: ::: ::: :::: :: :::: ::"
echo " :: :: : : : : : : : :: :: : : :: :: :"
echo " : : . :: : : : :"
echo " . : : . . ."
echo " : ."
echo " ."
echo ${RESET}
LOG=./build.log
tech_support()
{
#
# Record some useful to send back home on fail if we are permitted
#
(
date
log_info "DEBUG: System"
echo =====================================================
uname -a
echo
log_info "DEBUG: Environment"
echo =====================================================
env
echo
log_info "DEBUG: Installed packages"
echo =====================================================
(apt --installed list | grep -i SDL) 2>/dev/null
(apt --installed list | grep gcc) 2>/dev/null
(apt --installed list | grep clang) 2>/dev/null
pacman -Q 2>/dev/null # msys2
echo
log_info "DEBUG: Installed compilers"
echo =====================================================
which clang++
which clang
which g++
which gcc
clang --version 2>/dev/null
gcc --version 2>/dev/null
/mingw64/bin/gcc.exe --version 2>/dev/null # msys2
echo
log_info "DEBUG: Make:"
echo =====================================================
set -x
which make
make --version
set +x
echo
log_info "DEBUG: Makefile:"
echo =====================================================
cat Makefile
echo
log_info "DEBUG: src/Makefile:"
echo =====================================================
cat src/Makefile
echo
log_info "DEBUG: Makefile output for debugging:"
echo =====================================================
set -x
make -e -n -d all
set +x
echo
) >> $LOG 2>&1
}
run() {
STDOUT=$2
EXIT_CODE=.exit_code
($1 2>&1; echo $? > $EXIT_CODE) | tee "$STDOUT"
MY_RET="$(cat $EXIT_CODE)"
/bin/rm $EXIT_CODE
return "$MY_RET"
}
help()
{
cat << %%
Build options:
Usage: $0 [options]
[--rel] Release build (all optimizations)
[--dev] Enable development warnings (fastest compile)
[--dev2] Enable stack checking (SLOW)
[--prof] Enable gprof
[--gcc] Prefer g++ over clang
[--github] CI/CD build (turns off modification of README)
%%
}
OPT_REL=
OPT_DEV1=
OPT_DEV2=
OPT_PROF=
OPT_GCC=
OPT_GITHUB=
read_opts()
{
while [ "$#" -ne 0 ];
do
option=$1
case $option in
-*dev2)
OPT_DEV2="yes"
export OPT_DEV2
OPT_DEV1="yes"
export OPT_DEV1
shift
;;
-*dev)
OPT_DEV1="yes"
export OPT_DEV1
shift
;;
-*rel)
OPT_REL="yes"
export OPT_REL
shift
;;
-*prof)
OPT_PROF="yes"
export OPT_PROF
shift
;;
-*gcc)
OPT_GCC="yes"
export OPT_GCC
shift
;;
-*github)
OPT_GITHUB="yes"
export OPT_GITHUB
shift
;;
*)
log_err "Unknown argument: [$option]"
help
exit 1
;;
esac
done
}
read_opts "$@"
make pre
run build/build.sh $LOG
if [ $? -ne 0 ]; then
log_info "Gathering tech support info to $LOG"
tech_support >> $LOG
log_err "Build failed."
log_err "Could you send $LOG to $MAINTAINER?"
log_err "Or file an issue at https://github.com/goblinhack/gorget"
exit 1
else
#
# For quick re-makes
#
ln -sf build/Makefile .
log "Built successfully"
rm $LOG
fi