-
Notifications
You must be signed in to change notification settings - Fork 10
/
linux-build.sh
executable file
·491 lines (380 loc) · 12.6 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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
#!/bin/sh
RED='\033[1;31m'
GREEN='\033[1;32m'
BLUE='\033[1;34m'
NOCOLOR='\033[0m'
okay="${GREEN}ok${NOCOLOR}"
nope="${RED}nope${NOCOLOR}"
already="${BLUE}already built${NOCOLOR}"
buildFolder=`pwd`
if [ -x "$( command -v ccache )" ]; then
export CC="ccache $( command -v gcc )"
export CXX="ccache $( command -v g++ )"
fi
echo
pathToExternal="${buildFolder}"/external
echo "path to external packages is" "${pathToExternal}"
whereItGoes="_rootdir"
installPath="${buildFolder}"/"${whereItGoes}"
echo "install path is" "${installPath}"
echo
echo " zlib"
echo " Massively Spiffy Yet Delicately Unobtrusive Compression Library"
echo
zlib_version="1.3.1"
zlibname=zlib-"$zlib_version"
zlibinstallpath="${installPath}"/"$zlibname"
cd "${pathToExternal}"/zlib
##[ -d "$zlibname" ] && rm -r "$zlibname"
[ -d "$zlibname" ] || tar xzf "$zlibname".tar.gz
cd "$zlibname"
if [ ! -f ./okay ]; then
./configure --prefix="${zlibinstallpath}" --libdir="${zlibinstallpath}"/lib && make
make install
./configure --prefix="${zlibinstallpath}" --libdir="${zlibinstallpath}"/lib --static && make
make install
zlibInstalledLibs=`find "${zlibinstallpath}"/lib -name "libz*" -type f -print 2>/dev/null`
num_zlibs=`printf "${zlibInstalledLibs}" | wc -l`
if [ $num_zlibs -gt 0 ]; then
echo
for thezlib in $zlibInstalledLibs; do
file -h "${thezlib}"
done
echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${zlibinstallpath}"/include -type f -print
echo
printf "zlib "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
echo
echo " libpng"
echo " Portable Network Graphics reference library which supports almost all PNG features"
echo
libpng_version="1.6.43"
libpngname=libpng-"$libpng_version"
libpnginstallpath="${installPath}"/"$libpngname"
cd "${pathToExternal}"/libpng
if [ ! -d "$libpngname" ]; then
tar xzf "$libpngname".tar.gz
cd "$libpngname"
patch -p1 < ../no-known-incorrect-warnings.patch
cd ..
fi
cd "$libpngname"
if [ ! -f ./okay ]; then
if [ ! -f ./Makefile ]; then
LDFLAGS="-L${zlibinstallpath}/lib" \
CPPFLAGS="-I${zlibinstallpath}/include" \
./configure --prefix="${libpnginstallpath}" --enable-static --enable-shared --with-zlib-prefix="${zlibinstallpath}"
fi
make
make install
libpngInstalledLibs=`find "${libpnginstallpath}"/lib -name "libpng*" -type f -print 2>/dev/null`
num_libpngs=`printf "${libpngInstalledLibs}" | wc -l`
if [ $num_libpngs -gt 0 ]; then
echo
for thelibpng in $libpngInstalledLibs; do
file -h "${thelibpng}"
done
echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${libpnginstallpath}"/include -type f -print
echo
printf "libpng "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
echo
echo " ogg-vorbis ( libogg, libvorbis, vorbis-tools )"
echo " completely open, patent-free audio encoding and streaming technology"
echo
echo " libogg"
echo
libogg_version="1.3.3"
liboggname=libogg-"$libogg_version"
libogginstallpath="${installPath}"/"$liboggname"
cd "${pathToExternal}"/ogg-vorbis
[ -d "$liboggname" ] || tar xzf "$liboggname".tar.gz
cd "$liboggname"
if [ ! -f ./okay ]; then
if [ ! -f ./Makefile ]; then
./configure --prefix="${libogginstallpath}"
fi
make
make install
liboggInstalledLibs=`find "${libogginstallpath}"/lib -name "libogg*" -type f -print 2>/dev/null`
num_liboggs=`printf "${liboggInstalledLibs}" | wc -l`
if [ $num_liboggs -gt 0 ]; then
echo
for thelibogg in $liboggInstalledLibs; do
file -h "${thelibogg}"
done
echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${libogginstallpath}"/include -type f -print
echo
printf "libogg "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
echo
echo " libvorbis"
echo
libvorbis_version="1.3.6"
libvorbisname=libvorbis-"$libvorbis_version"
libvorbisinstallpath="${installPath}"/"$libvorbisname"
cd "${pathToExternal}"/ogg-vorbis
[ -d "$libvorbisname" ] || tar xzf "$libvorbisname".tar.gz
cd "$libvorbisname"
if [ ! -f ./okay ]; then
if [ ! -f ./Makefile ]; then
./configure --prefix="${libvorbisinstallpath}" --with-ogg="${libogginstallpath}" && make
fi
make install
libvorbisInstalledLibs=`find "${libvorbisinstallpath}"/lib -name "libvorbis*" -type f -print 2>/dev/null`
num_libvorbises=`printf "${libvorbisInstalledLibs}" | wc -l`
if [ $num_libvorbises -gt 0 ]; then
echo
for thelibvorbis in $libvorbisInstalledLibs; do
file -h "${thelibvorbis}"
done
echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${libvorbisinstallpath}"/include -type f -print
echo
printf "libvorbis "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
#echo
#echo " vorbis-tools"
#echo
#
#vorbistools_version="1.4.0"
#vorbistools_name=vorbis-tools-"$vorbistools_version"
#vorbistoolsinstallpath="${installPath}"/"$vorbistools_name"
#
#cd "${pathToExternal}"/ogg-vorbis
#[ -d "$vorbistools_name" ] || tar xzf "$vorbistools_name".tar.gz
#cd "$vorbistools_name"
#
#if [ ! -f ./okay ]; then
#
# if [ ! -f ./Makefile ]; then
# ./configure \
# --prefix="${vorbistoolsinstallpath}" \
# --with-ogg-libraries="${libogginstallpath}"/lib \
# --with-ogg-includes="${libogginstallpath}"/include \
# --with-vorbis-libraries="${libvorbisinstallpath}"/lib \
# --with-vorbis-includes="${libvorbisinstallpath}"/include \
# && make
# fi
# make install
#
# vorbistoolsInstalledBins=`find "${vorbistoolsinstallpath}"/bin -type f -print 2>/dev/null`
# num_vorbistools=`printf "${vorbistoolsInstalledBins}" | wc -l`
# if [ $num_vorbistools -gt 0 ]; then
# echo
# for thevorbistool in $vorbistoolsInstalledBins; do
# file -h "${thevorbistool}"
# done
#
# echo "okay" > ./okay
# fi
#
# echo
# printf "vorbis-tools "
# if [ -f ./okay ]; then
# echo "$okay"
# else
# echo "$nope"
# fi
#
#else
#
# echo "$already"
#
#fi
echo
echo " tinyxml2"
echo " simple, small, C++ XML parser that can be easily integrated into other programs"
echo
tinyxml2_version="10.0.0"
tinyxml2name=tinyxml2-"$tinyxml2_version"
tinyxml2installpath="${installPath}"/"$tinyxml2name"
if [ -x "$( command -v cmake )" ]; then
cd "${pathToExternal}"/tinyxml2
[ -d "$tinyxml2name" ] || tar xzf "$tinyxml2name".tar.gz
cd "$tinyxml2name"
if [ ! -f ./okay ]; then
if [ ! -f xmltest.cpp.orig ]; then
mv xmltest.cpp xmltest.cpp.orig
cat xmltest.cpp.orig | sed s/123456789012345678/123456789012345678LL/ > xmltest.cpp
fi
[ -d Boo ] || mkdir Boo
cd Boo
if [ ! -f ./Makefile ]; then
export CC=`command -v gcc`
export CXX=`command -v g++`
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH="${tinyxml2installpath}" \
..
fi
make
make install
rm -r "${tinyxml2installpath}"/lib/cmake
cd "${tinyxml2installpath}"
tinyxmlInstalledLibs=`find "${tinyxml2installpath}"/lib -name "*tinyxml*" -type f -print 2>/dev/null`
num_tinyxmls=`printf "${tinyxmlInstalledLibs}" | wc -l`
if [ $num_tinyxmls -gt 0 ]; then
echo
for thetinyxml in $tinyxmlInstalledLibs; do
file -h "${thetinyxml}"
done
fi
if [ -f ./include/tinyxml2.h ]; then
mv ./include/tinyxml2.h ./ && rmdir ./include
[ -f ./tinyxml2.h ] && echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${tinyxml2installpath}" -name "*.h" -type f -print
echo
printf "tinyxml2 "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
else
echo "can’t build tinyxml2"
echo "${RED}it needs cmake to be built${NOCOLOR}"
fi
echo
echo " allegro 4"
echo " cross-platform library for video game and multimedia programming"
echo
allegro4version="4.4.3.1"
allegro4name=allegro-"$allegro4version"
allegro4installpath="${installPath}"/"$allegro4name"
if [ -x "$( command -v cmake )" ]; then
cd "${pathToExternal}"/allegro
if [ ! -d "$allegro4name" ]; then
tar xzf "$allegro4name".tar.gz
cd "$allegro4name"
patch -p1 < ../false_three_finger.patch
sed -i 's/WANT_ALLEGROGL \"Enable AllegroGL\" on/WANT_ALLEGROGL \"Enable AllegroGL\" off/' ./CMakeLists.txt
sed -i 's/WANT_EXAMPLES \"Build example programs\" on/WANT_EXAMPLES \"Build example programs\" off/' ./CMakeLists.txt
sed -i 's/WANT_TOOLS \"Build tool programs\" on/WANT_TOOLS \"Build tool programs\" off/' ./CMakeLists.txt
sed -i 's/WANT_TESTS \"Build test programs\" on/WANT_TESTS \"Build test programs\" off/' ./CMakeLists.txt
cp "${buildFolder}"/gamedata/head48.icon.png ./misc/icon.png
cp "${buildFolder}"/gamedata/icon.xpm ./misc/
cp "${buildFolder}"/gamedata/icon.xpm ./src/x/
cd ..
fi
cd "$allegro4name"
if [ ! -f ./okay ]; then
[ -d TheBuild ] || mkdir TheBuild
cd TheBuild
if [ ! -f ./Makefile ]; then
sed -i 's/add_subdirectory(docs)/##add_subdirectory(docs)/' ../CMakeLists.txt
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DZLIB_INCLUDE_DIR:PATH="${zlibinstallpath}"/include \
-DZLIB_LIBRARY="${zlibinstallpath}"/lib/libz.so \
-DPNG_PNG_INCLUDE_DIR:PATH="${libpnginstallpath}"/include \
-DPNG_LIBRARY="${libpnginstallpath}"/lib/libpng.so \
-DOGG_INCLUDE_DIR:PATH="${libogginstallpath}"/include \
-DVORBIS_INCLUDE_DIR:PATH="${libvorbisinstallpath}"/include \
-DCMAKE_INSTALL_PREFIX:PATH="${allegro4installpath}" \
-DCMAKE_C_FLAGS:STRING="-fno-common" \
..
fi
make && make install
cd ..
allegro4InstalledLibs=`find "${allegro4installpath}"/lib -name "lib*alleg*" -type f -print 2>/dev/null`
num_allegro4s=`printf "${allegro4InstalledLibs}" | wc -l`
if [ $num_allegro4s -gt 0 ]; then
echo
for theliballeg in $allegro4InstalledLibs; do
file -h "${theliballeg}"
done
echo "okay" > ./okay
fi
[ -f ./okay ] && echo && find "${allegro4installpath}"/include -type f -print
echo
printf "allegro 4 "
if [ -f ./okay ]; then
echo "$okay"
else
echo "$nope"
fi
else
echo "$already"
fi
else
echo "can’t build allegro 4"
echo "${RED}it needs cmake to be built${NOCOLOR}"
fi
echo
echo " Head over Heels"
echo
if [ ! -d "${allegro4installpath}/lib" ] ; then
echo "${RED}allegro4 libraries are absent${NOCOLOR}"
echo "can't go ahead"
exit 1
fi
if [ ! -d "${allegro4installpath}/include" ] ; then
echo "${RED}allegro4 headers are absent${NOCOLOR}"
echo "can't go ahead"
exit 2
fi
if [ -d "${allegro4installpath}/bin" ] ; then
export PATH="${allegro4installpath}/bin":$PATH
else
echo "${RED}allegro4 binaries are absent${NOCOLOR}"
echo "can't go ahead"
exit 3
fi
cd "${buildFolder}"
[ -d ./m4 ] || mkdir m4
[ -f ./configure ] || autoreconf -f -i
gameInstallPath="${installPath}"
## [ -f source/Makefile ] && rm -v source/Makefile
if [ ! -f source/Makefile ]; then
LDFLAGS="-Wl,-rpath ${zlibinstallpath}/lib -Wl,-rpath ${libpnginstallpath}/lib -Wl,-rpath ${libogginstallpath}/lib -Wl,-rpath ${libvorbisinstallpath}/lib -Wl,-rpath ${tinyxml2installpath}/lib -Wl,-rpath ${allegro4installpath}/lib" \
./configure \
--prefix="${gameInstallPath}" \
--with-libpng-prefix="${libpnginstallpath}" \
--with-ogg-prefix="${libogginstallpath}" \
--with-vorbis-prefix="${libvorbisinstallpath}" \
--with-tinyxml2-libs="${tinyxml2installpath}"/lib \
--with-tinyxml2-includes="${tinyxml2installpath}" \
--with-allegro4 \
--with-allegro-libs="${allegro4installpath}"/lib \
--with-allegro-includes="${allegro4installpath}"/include
##--enable-debug=yes
fi
make && make install ##DESTDIR="${gameInstallPath}"