-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·491 lines (455 loc) · 13 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
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
#
# OpenBOR - http://www.ChronoCrash.com
# -----------------------------------------------------------------------
# All rights reserved, see LICENSE in OpenBOR root for details.
#
# Copyright (c) 2004 - 2014 OpenBOR Team
#
#!/bin/bash
# Building script for all platforms
# build.sh by SX (SumolX@gmail.com)
# Used for resetting path prior to each platform.
export OLD_PATH=$PATH
# Display Version
function version {
. ./version.sh
make version
cp README ./releases/README.txt
cp LICENSE ./releases/LICENSE.txt
cp COMPILING ./releases/COMPILING.txt
cp translation.txt ./releases/translation.txt
}
# CleanUp Releases
function clean {
make clean-releases
}
# Distribute Releases
function distribute {
echo ------------------------------------------------------
echo " Validating Platforms Built w/Bash"
echo ------------------------------------------------------
echo
if ! test "releases/PSP/OpenBOR/EBOOT.PBP"; then
echo "PSP Platform Failed To Build!"
exit 1
fi
if ! test -e "releases/GP2X/OpenBOR/OpenBOR.gpe"; then
echo "GP2X Platform Failed To Build!"
exit 1
fi
if ! test -e "releases/WIZ/OpenBOR/OpenBOR.gpe"; then
echo "WIZ Platform Failed To Build!"
exit 1
fi
if ! test -e "releases/DC/OpenBOR/1ST_READ.BIN"; then
echo "Dreamcast Platform Failed To Build!"
exit 1
fi
if test -e "releases/WINDOWS/OpenBOR/OpenBOR.exe"; then
cd ../tools/borpak/source/
. build.sh win
cp borpak.exe ../../../engine/releases/WINDOWS/OpenBOR/
cp ../scripts/packer.bat ../../../engine/releases/WINDOWS/OpenBOR/
cp ../scripts/paxplode.bat ../../../engine/releases/WINDOWS/OpenBOR/
cd ../../../engine
else
echo "Windows Platform Failed To Build!"
exit 1
fi
if ! test -e "releases/WII/OpenBOR/boot.dol"; then
echo "Wii Platform Failed To Build!"
exit 1
fi
if ! test -e "releases/OPENDINGUX/OpenBOR/OpenBOR.dge"; then
echo "OpenDingux Platform Failed To Build!"
exit 1
fi
if test -e "releases/LINUX/OpenBOR/OpenBOR"; then
cd ../tools/borpak/source/
. build.sh lin
cp borpak ../../../engine/releases/LINUX/OpenBOR/
cp ../scripts/packer ../../../engine/releases/LINUX/OpenBOR/
cp ../scripts/paxplode ../../../engine/releases/LINUX/OpenBOR/
cd ../../../engine
else
if [ `echo $HOST_PLATFORM | grep -o "Linux"` ]; then
echo "Linux Platform Failed To Build!"
exit 1
fi
fi
if test -e "releases/DARWIN/OpenBOR.app/Contents/MacOS/OpenBOR"; then
cd ../tools/borpak/source/
. build.sh mac
cp borpak ../../../engine/releases/DARWIN/OpenBOR.app/Contents/Resources/
cp ../scripts/packer ../../../engine/releases/DARWIN/OpenBOR.app/Contents/Resources/
cp ../scripts/paxplode ../../../engine/releases/DARWIN/OpenBOR.app/Contents/Resources/
cd ../../../engine
else
echo "Darwin Platform Failed To Build!"
exit 1
fi
echo "All Platforms Created Successfully"
if ! test "$BUILDBATCH"; then
TRIMMED_URL=`svn info | grep "URL:" | sed s/URL:\ svn\+ssh//g`
if test -n $TRIMMED_URL; then
TRIMMED_URL="svn"$TRIMMED_URL
fi
svn log $TRIMMED_URL --verbose > ./releases/VERSION_INFO.txt
7za a -t7z -mx9 -r -x!.svn "./releases/OpenBOR $VERSION.7z" ./releases/*
fi
echo
}
# PSP Environment && Compile
function psp {
export PATH=$OLD_PATH
. ./environ.sh 1
if test $PSPDEV; then
make clean BUILD_PSP=1
make BUILD_PSP=1
if test -f "./EBOOT.PBP"; then
if test ! -e "./releases/PSP"; then
mkdir ./releases/PSP
mkdir ./releases/PSP/OpenBOR
mkdir ./releases/PSP/OpenBOR/Images
mkdir ./releases/PSP/OpenBOR/Logs
mkdir ./releases/PSP/OpenBOR/Paks
mkdir ./releases/PSP/OpenBOR/Saves
mkdir ./releases/PSP/OpenBOR/Modules
fi
mv EBOOT.PBP ./releases/PSP/OpenBOR/
mv OpenBOR.elf ./releases/PSP/OpenBOR/Modules/
cp ./psp/dvemgr/dvemgr.prx ./releases/PSP/OpenBOR/Modules/
cp ./psp/kernel/kernel.prx ./releases/PSP/OpenBOR/Modules/
cp ./psp/control/control.prx ./releases/PSP/OpenBOR/Modules/
cp ./psp/exception/exception.prx ./releases/PSP/OpenBOR/Modules/
cp ./resources/OpenBOR_Menu_480x272_Sony.png ./releases/PSP/OpenBOR/Images/Menu.png
cp ./resources/OpenBOR_Logo_480x272.png ./releases/PSP/OpenBOR/Images/Loading.png
fi
make clean BUILD_PSP=1
fi
}
# Gp2x Environment && Compile
function gp2x {
export PATH=$OLD_PATH
. ./environ.sh 3
if test $GP2XDEV; then
make clean BUILD_GP2X=1
make BUILD_GP2X=1
if test -f "./OpenBOR.gpe"; then
if test ! -e "./releases/GP2X"; then
mkdir ./releases/GP2X
mkdir ./releases/GP2X/OpenBOR
mkdir ./releases/GP2X/OpenBOR/Logs
mkdir ./releases/GP2X/OpenBOR/Paks
mkdir ./releases/GP2X/OpenBOR/Saves
mkdir ./releases/GP2X/OpenBOR/ScreenShots
fi
cp ./sdl/gp2x/modules/mmuhack.o ./releases/GP2X/OpenBOR/
mv OpenBOR.gpe ./releases/GP2X/OpenBOR/
fi
make clean BUILD_GP2X=1
fi
}
# Linux Environment && Compile (common to all architectures)
function linux {
export PATH=$OLD_PATH
export GCC_TARGET=$1
export TARGET_ARCH=$2
. ./environ.sh 4
if test $LNXDEV; then
if [[ ! $BUILD_DEBUG ]] ; then
make clean BUILD_LINUX=1
elif [[ "$TARGET_ARCH" == "amd64" ]] ; then
export NO_RAM_DEBUGGER=1
fi
make BUILD_LINUX=1
if test -f "./OpenBOR"; then
if test ! -e "./releases/$3"; then
mkdir ./releases/$3
mkdir ./releases/$3/OpenBOR
mkdir ./releases/$3/OpenBOR/Logs
mkdir ./releases/$3/OpenBOR/Paks
mkdir ./releases/$3/OpenBOR/Saves
mkdir ./releases/$3/OpenBOR/ScreenShots
fi
mv OpenBOR ./releases/$3/OpenBOR
echo "moved binary to ./releases/$3/ !"
fi
if [[ ! $BUILD_DEBUG ]] ; then
make clean BUILD_LINUX=1
fi
fi
[ $LNXDEV ]
}
# Compile for Linux under various architectures
function linux_x86 {
if [ `uname -s | grep -o "Linux"` ]; then
linux i.86-.*linux.* x86 LINUX || # try standard 32-bit GCC
[ `gcc -dumpmachine | grep -o x86_64-.*linux.*` ] && [ `gcc -print-multi-lib | grep -o '@m32'` ] && # check for x86_64 GCC with 32-bit multilib
linux x86_64-.*linux.* x86 LINUX # try 64-bit compiler with multilib
fi
}
function linux_amd64 {
if [ `uname -s | grep -o "Linux"` ]; then
linux x86_64-.*linux.* amd64 LINUX_AMD64 || # try standard 64-bit GCC
[ `gcc -dumpmachine | grep -o i.86-.*linux.*` ] && [ `gcc -print-multi-lib | grep -o '@m64'` ] && # check for x86 GCC with 64-bit multilib
linux i.86-.*linux.* amd64 LINUX_AMD64 # try 32-bit compiler with multilib
fi
}
function linux_something {
if [ ! $1 -o $1 = x86 ]; then
linux_x86
elif [ $1 = amd64 ]; then
linux_amd64
else
echo "Error: unknown Linux architecture '$1'"
fi
}
# Windows Environment && Compile
function windows {
export PATH=$OLD_PATH
. ./environ.sh 5
if test $WINDEV; then
make clean BUILD_WIN=1
make BUILD_WIN=1
if test -f "./OpenBOR.exe"; then
if test ! -e "./releases/WINDOWS" ; then
mkdir ./releases/WINDOWS
mkdir ./releases/WINDOWS/OpenBOR
mkdir ./releases/WINDOWS/OpenBOR/Logs
mkdir ./releases/WINDOWS/OpenBOR/Paks
mkdir ./releases/WINDOWS/OpenBOR/Saves
mkdir ./releases/WINDOWS/OpenBOR/ScreenShots
fi
mv OpenBOR.exe ./releases/WINDOWS/OpenBOR
fi
make clean BUILD_WIN=1
fi
}
# Dreamcast Environment && Compile
function dreamcast {
export PATH=$OLD_PATH
. ./environ.sh 6
if test $KOS_BASE; then
make clean BUILD_DC=1
make BUILD_DC=1
if test -f "./1ST_READ.BIN"; then
if test ! -e "./releases/DC" ; then
mkdir ./releases/DC
mkdir ./releases/DC/OpenBOR
fi
mv 1ST_READ.BIN ./releases/DC/OpenBOR/
fi
make clean BUILD_DC=1
fi
}
# Wii Environment && Compile
function wii {
export PATH=$OLD_PATH
. ./environ.sh 7
if test $DEVKITPPC; then
make clean BUILD_WII=1
make BUILD_WII=1
if test -f "./boot.dol"; then
if test ! -e "./releases/WII" ; then
mkdir ./releases/WII
mkdir ./releases/WII/OpenBOR
mkdir ./releases/WII/OpenBOR/Logs
mkdir ./releases/WII/OpenBOR/Paks
mkdir ./releases/WII/OpenBOR/Saves
mkdir ./releases/WII/OpenBOR/ScreenShots
fi
mv boot.dol ./releases/WII/OpenBOR/
cp ./resources/meta.xml ./releases/WII/OpenBOR
cp ./resources/OpenBOR_Icon_128x48.png ./releases/WII/OpenBOR/icon.png
fi
make clean BUILD_WII=1
fi
}
# OpenDingux Environment && Compile
function opendingux {
export PATH=$OLD_PATH
. ./environ.sh 8
if test $OPENDINGUX_TOOLCHAIN; then
make clean BUILD_OPENDINGUX=1
make BUILD_OPENDINGUX=1
if test $BUILD_GCW0; then
if test -f "OpenBOR"; then
if test ! -e "./releases/OPENDINGUX" ; then
mkdir ./releases/OPENDINGUX
mkdir ./releases/OPENDINGUX/OpenBOR
fi
rm ./releases/OPENDINGUX/OpenBOR.opk
mv OpenBOR ./releases/OPENDINGUX/OpenBOR/
cp ./gcw0/default.gcw0.desktop ./releases/OPENDINGUX/OpenBOR/
cp ./gcw0/openbor.png ./releases/OPENDINGUX/OpenBOR/
cp ./gcw0/readme.gcw0.txt ./releases/OPENDINGUX/OpenBOR/
mksquashfs ./releases/OPENDINGUX/OpenBOR/ ./releases/OPENDINGUX/OpenBOR.opk -all-root -noappend -no-exports -no-xattrs
fi
else
if test -f "OpenBOR.dge"; then
if test ! -e "./releases/OPENDINGUX" ; then
mkdir ./releases/OPENDINGUX
mkdir ./releases/OPENDINGUX/OpenBOR
mkdir ./releases/OPENDINGUX/OpenBOR/Logs
mkdir ./releases/OPENDINGUX/OpenBOR/Paks
mkdir ./releases/OPENDINGUX/OpenBOR/Saves
mkdir ./releases/OPENDINGUX/OpenBOR/ScreenShots
fi
mv OpenBOR.dge ./releases/OPENDINGUX/OpenBOR/
fi
fi
make clean BUILD_OPENDINGUX=1
fi
}
# WIZ Environment && Compile
function wiz {
export PATH=$OLD_PATH
. ./environ.sh 9
if test $WIZDEV; then
make clean BUILD_WIZ=1
make BUILD_WIZ=1
if test -f "./OpenBOR.gpe"; then
if test ! -e "./releases/WIZ"; then
mkdir ./releases/WIZ
mkdir ./releases/WIZ/OpenBOR
mkdir ./releases/WIZ/OpenBOR/Logs
mkdir ./releases/WIZ/OpenBOR/Paks
mkdir ./releases/WIZ/OpenBOR/Saves
mkdir ./releases/WIZ/OpenBOR/ScreenShots
fi
mv OpenBOR.gpe ./releases/WIZ/OpenBOR/
if [ `echo $HOST_PLATFORM | grep -o "SVN"` ]; then
cp $SDKPATH/lib/target/libSDL-1.2.so.0.11.2 ./releases/WIZ/OpenBOR/
cp $SDKPATH/lib/target/libSDL_gfx.so.0.0.17 ./releases/WIZ/OpenBOR/libSDL_gfx.so.0
else
cp $SDKPATH/lib/warm_2.6.24.ko ./releases/WIZ/OpenBOR/
cp $SDKPATH/lib/libSDL-1.2.so.0.11.2 ./releases/WIZ/OpenBOR/
cp $SDKPATH/lib/libSDL_gfx.so.0.0.17 ./releases/WIZ/OpenBOR/libSDL_gfx.so.0
fi
fi
make clean BUILD_WIZ=1
fi
}
# Darwin Environment && Compile
function darwin {
export PATH=$OLD_PATH
. ./environ.sh 10
if test $DWNDEV; then
make clean BUILD_DARWIN=1
make BUILD_DARWIN=1
if test -f "./OpenBOR"; then
if test ! -e "./releases/DARWIN"; then
mkdir ./releases/DARWIN
mkdir ./releases/DARWIN/OpenBOR.app
mkdir ./releases/DARWIN/OpenBOR.app/Contents
mkdir ./releases/DARWIN/OpenBOR.app/Contents/MacOS
mkdir ./releases/DARWIN/OpenBOR.app/Contents/Resources
mkdir ./releases/DARWIN/OpenBOR.app/Contents/Libraries
fi
mv OpenBOR ./releases/DARWIN/OpenBOR.app/Contents/MacOS
cp ./resources/PkgInfo ./releases/DARWIN/OpenBOR.app/Contents
cp ./resources/Info.plist ./releases/DARWIN/OpenBOR.app/Contents
cp ./resources/OpenBOR.icns ./releases/DARWIN/OpenBOR.app/Contents/Resources
if [ "${DWNDEV}" != "/opt/mac" ]; then
./darwin.sh
fi
fi
make clean BUILD_DARWIN=1
fi
}
function build_all {
clean
version
if test -e "buildspec.sh"; then
. ./buildspec.sh
else
psp
gp2x
linux_x86
linux_amd64
windows
dreamcast
wii
opendingux
wiz
darwin
fi
distribute
}
function print_help {
echo
echo "Run $0 with one of the below targets"
echo "-------------------------------------------------------"
echo " 0 = Distribute"
echo " 1 = PSP"
echo " 2 = (unused)"
echo " 3 = Gp2x"
echo " 4 = Linux (x86, amd64) Example: $0 4 amd64"
echo " 5 = Windows"
echo " 6 = Dreamcast"
echo " 7 = Wii"
echo " 8 = OpenDingux (A320 & GCW-Zero)"
echo " 9 = Wiz"
echo " 10 = Darwin"
echo " all = build for all applicable targets"
echo "-------------------------------------------------------"
echo "Example: $0 10"
echo
}
case $1 in
0)
version
distribute
;;
1)
version
psp
;;
2)
version
echo "No platform here anymore (used to be PS2)"
;;
3)
version
gp2x
;;
4)
version
linux_something $2
;;
5)
version
windows
;;
6)
version
dreamcast
;;
7)
version
wii
;;
8)
version
opendingux
;;
9)
version
wiz
;;
10)
version
darwin
;;
?)
version
print_help
;;
all)
build_all
;;
*)
print_help
;;
esac