[go: up one dir, main page]

Menu

[904618]: / proj / bb.sh  Maximize  Restore  History

Download this file

789 lines (656 with data), 23.7 kB

  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
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
#!/bin/sh
# :oCCCCOCoc.
# .cCO8OOOOOOOOO8Oo:
# .oOO8OOOOOOOOOOOOOOOCc
# cO8888: .:oOOOOC. TM
# :888888: :CCCc .oOOOOC. ### ### #########
# C888888: .ooo: .C######## ##### ##### ###### ###### ##########
# O888888: .oO### ### ##### ##### ######## ######## #### ###
# C888888: :8O. .C########## ### #### ### ## ## ## ## #### ###
# :8@@@@8: :888c o### ### #### ### ######## ######## ##########
# :8@@@@C C@@@@ oo######## ### ## ### ###### ###### #########
# cO@@@@@@@@@@@@@@@@@Oc0
# :oO8@@@@@@@@@@Oo.
# .oCOOOOOCc. http://remood.org/
# -----------------------------------------------------------------------------
# Copyright (C) 2009-2011 GhostlyDeath <ghostlydeath@remood.org>
# -----------------------------------------------------------------------------
# Buildbot Helper, or just an easy as hell to use builder script.
### PRE-CHECKS ###
### COOL STUFF ###
# Building Stuff
BBROOT='./proj'
BBREMOOD='.'
# Cool
COOLPREFIX=' $> '
COOLERROR=' !> '
# Versioning
REMOODVERSION="$(cat version)"
REMOODVERSIONSTRIP="$(sed 's/\.//g' < version)"
REMOODARCH="$(dpkg --print-architecture)"
# File names
REMOODBASENAME="remood"
REMOODBASESOURCE="remood-src-$REMOODVERSIONSTRIP"
REMOODDEBIANSHORT="remood_$REMOODVERSIONSTRIP"
REMOODDEBIANNAME="${REMOODDEBIANSHORT}_$REMOODARCH"
### CHECK FOR HG ###
if [ "$HG" != "ignore" ]
then
if ! which hg > /dev/null 2> /dev/null || ! hg status "$BBREMOOD" > /dev/null 2> /dev/null
then
HG=""
else
HG="ok"
fi
fi
### LOOP ARG BUILDING ###
for target in $*
do
# Which package is being built?
case $target
in
###############################################################################
### Standard release (tar.gz)
###############################################################################
release)
;;
###############################################################################
### Update sys/tarfiles.txt
###############################################################################
system_tarfiles)
# Print message
echo "$COOLPREFIX Updating sys/tarfiles.txt" 1>&2
# Is hg ok?
if [ "$HG" != "ok" ]
then
echo "$COOLERROR Mercurial not found!" 1>&2
fi
# Clear file
rm -f "$BBREMOOD/sys/tarfiles.txt"
# For every file
find "$BBREMOOD" -type f | grep -v '\/\.hg\/' | sed 's/^\.\///' | while read file
do
# Check if the file is tracked
if hg status "$file" -m -a -r -d -c 2> /dev/null | grep '^[MARC\!\?]\ ' > /dev/null 2> /dev/null
then
echo "$file" >> "$BBREMOOD/sys/tarfiles.txt"
fi
done
# Sort it
sort < "$BBREMOOD/sys/tarfiles.txt" > /tmp/$$
mv /tmp/$$ "$BBREMOOD/sys/tarfiles.txt"
# Print message
echo "$COOLPREFIX Done" 1>&2
;;
###############################################################################
### tar source to stdout
###############################################################################
source_tar_stdout)
echo "$COOLPREFIX tar to stdout" 1>&2
# Create directory to put symlinks in
mkdir -p "tsrc$$/$REMOODBASESOURCE" > /dev/null 2> /dev/null
#
(while read line
do
# Create directory to place symlink in
mkdir -p "tsrc$$/$REMOODBASESOURCE/$(dirname "$line")"
ln -s "$(readlink -m "$BBREMOOD/$line")" "tsrc$$/$REMOODBASESOURCE/$line"
done) < "sys/tarfiles.txt" > /dev/null 2> /dev/null
# Go into tree and create archive
(cd "tsrc$$"; tar -chvvf - "$REMOODBASESOURCE") 2> /dev/null
# Delete source tree
rm -rf "tsrc$$" > /dev/null 2> /dev/null
;;
###############################################################################
### tar source
###############################################################################
source_tar)
TARGETNAME="$REMOODBASESOURCE.tar"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
# If hg exists, use that instead
if [ "$HG" = "ok" ]
then
hg archive -p "$REMOODBASESOURCE/" -t tar "$TARGETNAME" 1>&2
# Otherwise, use harder method
else
# Read tar from std and make archive
"$BBROOT/bb.sh" source_tar_stdout > "$TARGETNAME"
fi
;;
###############################################################################
### tar.gz source code
###############################################################################
source_tgz)
TARGETNAME="$REMOODBASESOURCE.tgz"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
# If hg exists, use that instead
if [ "$HG" = "ok" ]
then
hg archive -p "$REMOODBASESOURCE/" -t tgz "$TARGETNAME" 1>&2
# Otherwise, use harder method
else
# Read tar from std and make archive
"$BBROOT/bb.sh" source_tar_stdout | gzip -9 -c - > "$TARGETNAME"
fi
;;
###############################################################################
### tar.bz2 source code
###############################################################################
source_tbz)
TARGETNAME="$REMOODBASESOURCE.tbz"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
# If hg exists, use that instead
if [ "$HG" = "ok" ]
then
hg archive -p "$REMOODBASESOURCE/" -t tgz "$TARGETNAME" 1>&2
# Otherwise, use harder method
else
# Read tar from std and make archive
"$BBROOT/bb.sh" source_tar_stdout | bzip2 -9 -c - > "$TARGETNAME"
fi
;;
###############################################################################
### tar.xz source code
###############################################################################
source_txz)
TARGETNAME="$REMOODBASESOURCE.txz"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
# If hg exists, use that instead
if [ "$HG" = "ok" ]
then
# hg lacks xz support so first create tar archive
"$BBROOT/bb.sh" source_tar
# Recompress as xz
xz -9 -c - < "$REMOODBASESOURCE.tar" > "$TARGETNAME"
# Otherwise, use harder method
else
# Read tar from std and make archive
"$BBROOT/bb.sh" source_tar_stdout | xz -9 -c - > "$TARGETNAME"
fi
;;
###############################################################################
### zip source code
###############################################################################
source_zip)
TARGETNAME="$REMOODBASESOURCE.zip"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
# If hg exists, use that instead
if [ "$HG" = "ok" ]
then
hg archive -p "$REMOODBASESOURCE/" -t zip "$TARGETNAME" 1>&2
# Otherwise, use harder method
else
# Oops
echo "$COOLPREFIX ZIP wihtout hg not yet supported." 1>&2
fi
;;
###############################################################################
### Debian source package
###############################################################################
debian_src)
echo "$COOLPREFIX Build Debian Source Package" 1>&2
"$BBROOT/bb.sh" source_tgz
echo "$COOLPREFIX Renaming tgz" 1>&2
mv -v "$REMOODBASESOURCE.tgz" "$REMOODDEBIANSHORT.orig.tar.gz"
;;
###############################################################################
### Debian package (UGLY method)
###############################################################################
debian_ugly)
TARGETNAME="$REMOODDEBIANNAME.deb"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
echo "$COOLPREFIX Cleaning default source" 1>&2
if ! make clean USEINTERFACE=sdl
then
echo "$COOLPREFIX Failed to clean" 1>&2
exit 1
fi
echo "$COOLPREFIX Building default source" 1>&2
if ! make $MAKEFLAGS USEINTERFACE=sdl
then
echo "$COOLPREFIX Failed to build" 1>&2
exit 1
fi
echo "$COOLPREFIX Clearing old debian dir (if any)" 1>&2
rm -rvf ./debian/
echo "$COOLPREFIX Creating new tree" 1>&2
mkdir -p ./debian/DEBIAN
mkdir -p ./debian/usr/games/
mkdir -p ./debian/usr/share/applications
mkdir -p ./debian/usr/share/doc/remood
mkdir -p ./debian/usr/share/games/doom
mkdir -p ./debian/usr/share/menu
mkdir -p ./debian/usr/share/pixmaps
echo "$COOLPREFIX Filling binary tree" 1>&2
cp -v "$BBREMOOD/sys/remood.desktop" ./debian/usr/share/applications
cp -v "./bin/remood" ./debian/usr/games/remood.real
cp -v "$BBREMOOD/sys/wrap.sh" ./debian/usr/games/remood
cp -v "$BBREMOOD/bin/remood.wad" ./debian/usr/share/games/doom
cp -v "$BBREMOOD/sys/xmenu" ./debian/usr/share/menu
cp -v "$BBREMOOD/sys/remood.xpm" ./debian/usr/share/pixmaps
cp -v "$BBREMOOD/sys/debpostinst" ./debian/DEBIAN/postinst
chmod 755 ./debian/DEBIAN/postinst
cp -v "$BBREMOOD/sys/debprerm" ./debian/DEBIAN/prerm
chmod 755 ./debian/DEBIAN/prerm
echo "$COOLPREFIX Creating control file" 1>&2
DEBIANCONTROLFILE="./debian/DEBIAN/control"
echo "Package: remood" > $DEBIANCONTROLFILE
echo "Architecture: $REMOODARCH" >> $DEBIANCONTROLFILE
echo "Version: $REMOODVERSION" >> $DEBIANCONTROLFILE
echo "Maintainer: GhostlyDeath (ghostlydeath@remood.org)" >> $DEBIANCONTROLFILE
# Installed-Size
echo "Depends: libc6 (>= `dpkg-query -W libc6 | sed 's/^[^\ \t]*[\ \t]*\(.*\)$/\1/g'`), libsdl1.2debian (>= `dpkg-query -W libsdl1.2debian | sed 's/^[^\ \t]*[\ \t]*\(.*\)$/\1/g'`)" >> $DEBIANCONTROLFILE
echo "Provides: doom-engine, boom-engine, heretic-engine" >> $DEBIANCONTROLFILE
echo "Recommends: doom-wad | boom-wad | heretic-wad" >> $DEBIANCONTROLFILE
echo "Section: games" >> $DEBIANCONTROLFILE
echo "Priority: optional" >> $DEBIANCONTROLFILE
echo "Homepage: http://remood.org/" >> $DEBIANCONTROLFILE
echo "Description: `cat "$BBREMOOD/sys/debinfo"`" >> $DEBIANCONTROLFILE
echo "$COOLPREFIX Compiling package" 1>&2
dpkg-deb -b debian "$REMOODDEBIANNAME.deb"
;;
###############################################################################
### Debian package
###############################################################################
debian)
TARGETNAME="$REMOODDEBIANNAME.deb"
echo "$COOLPREFIX Building $TARGETNAME" 1>&2
;;
###############################################################################
### Win32 Compiler
###############################################################################
win32_findcc)
# Which prefix works?
# Win64 name last (Win64 does not work on 98)
for PREFIX in i686-pc-mingw32 i686-mingw32 i586-mingw32msvc i586-pc-mingw32msvc i686-w64-mingw32
do
if which "${PREFIX}-gcc" > /dev/null 2> /dev/null
then
echo "${PREFIX}-"
exit 0
fi
done
# Fallback
echo ""
;;
###############################################################################
### Win64 Compiler
###############################################################################
win64_findcc)
# Which prefix works?
# These are all the same CCs, second is comp, last is Debian screwy name
for PREFIX in x86_64-w64-mingw32 x86_64-pc-mingw32 amd64-mingw32msvc
do
if which "${PREFIX}-gcc" > /dev/null 2> /dev/null
then
echo "${PREFIX}-"
exit 0
fi
done
# Fallback
echo ""
;;
###############################################################################
### Win64/SDL
###############################################################################
win64_sdl)
echo "$COOLPREFIX Building Win64 SDL Binary" 1>&2
WINGCC="`"$BBROOT/bb.sh" win64_findcc`"
echo "$COOLPREFIX Using $WINGCC" 1>&2
# See if the SDL library needs downloading
if [ ! -d SDL-1.2-20111107-win64 ]
then
if [ ! -f "SDL-1.2-20111107-win64.tar.gz" ]
then
wget http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/SDL/SDL-1.2-20111107-win64.tar.gz
fi
# Extract
if ! tar -xvvf "SDL-1.2-20111107-win64.tar.gz"
then
echo "$COOLPREFIX Failed to extract SDL/Win64" 1>&2
exit 1
fi
fi
# Compile
make clean USEINTERFACE=sdl TOOLPREFIX="$WINGCC"
if ! make $MAKEFLAGS USEINTERFACE=sdl TOOLPREFIX="$WINGCC" SDL_INCLUDE=SDL-1.2-20111107-win64/include/SDL SDL_LIB=SDL-1.2-20111107-win64/lib OPENGL_LDFLAGS="-lopengl32"
then
echo "$COOLPREFIX Failed" 1>&2
exit 1
fi
# Zip
mkdir -p "$$/"
cp -v "bin/remood.exe" "$$/"
cp -v "$BBREMOOD/bin/remood.wad" "$$/"
cp -v "SDL-1.2-20111107-win64/bin/SDL.dll" "$$/"
cp -v "$BBREMOOD/doc/manual.pdf" "$$/"
cp -v "$BBREMOOD/AUTHORS" "$$/"
cp -v "$BBREMOOD/LICENSE" "$$/"
cp -v "$BBREMOOD/version" "$$/"
# Go into dir
cd "$$/"
# Convert to DOS format
unix2dos -o AUTHORS LICENSE version
# Zip files into an archive
rm -f "../remood_${REMOODVERSIONSTRIP}_win64.zip"
zip "../remood_${REMOODVERSIONSTRIP}_win64.zip" *
# Get back out
cd "../"
rm -rf "$$"
;;
###############################################################################
### Win64/Default
###############################################################################
win64)
echo "$COOLPREFIX Building Win64 Default Binary" 1>&2
"$BBROOT/bb.sh" win64_sdl
;;
###############################################################################
### Win32/Allegro Binary
###############################################################################
win32_allegro)
echo "$COOLPREFIX Building Win32 Allegro Binary" 1>&2
WINGCC="`"$BBROOT/bb.sh" win32_findcc`"
echo "$COOLPREFIX Using $WINGCC" 1>&2
# Check if allegw32 needs to be extracted
if [ ! -d "allegw32" ]
then
# Download from remood.org
if [ ! -f "allegw32.tar.gz" ]
then
wget -c http://remood.org/downloads/allegw32.tar.gz -O allegw32.tar.gz
fi
# Extract
if ! tar -xvvf "allegw32.tar.gz"
then
echo "$COOLPREFIX Failed to extract Allegro/Win32" 1>&2
exit 1
fi
fi
# Compile
make clean USEINTERFACE=allegro TOOLPREFIX="$WINGCC"
if ! make $MAKEFLAGS USEINTERFACE=allegro TOOLPREFIX="$WINGCC" ALLEGRO_INCLUDE=allegw32/include ALLEGRO_LIB=allegw32/lib
then
echo "$COOLPREFIX Failed" 1>&2
exit 1
fi
# Zip
mkdir -p "$$/"
cp -v "bin/remood.exe" "$$/"
cp -v "$BBREMOOD/bin/remood.wad" "$$/"
cp -v "allegw32/bin/alleg42.dll" "$$/"
cp -v "$BBREMOOD/doc/manual.pdf" "$$/"
cp -v "$BBREMOOD/AUTHORS" "$$/"
cp -v "$BBREMOOD/LICENSE" "$$/"
cp -v "$BBREMOOD/version" "$$/"
# Go into dir
cd "$$/"
# Convert to DOS format
unix2dos -o AUTHORS LICENSE version
# Zip files into an archive
rm -f "../remood_${REMOODVERSIONSTRIP}_win32.zip"
zip "../remood_${REMOODVERSIONSTRIP}_win32.zip" *
# Get back out
cd "../"
rm -rf "$$"
;;
###############################################################################
### Win32/SDL Binary
###############################################################################
win32_sdl)
echo "$COOLPREFIX Building Win32 SDL Binary" 1>&2
# Find GCC
WINGCC="`"$BBROOT/bb.sh" win32_findcc`"
echo "$COOLPREFIX Using $WINGCC" 1>&2
# Check if sdlw32 needs to be extracted
if [ ! -d "SDL-1.2.15" ]
then
# Download from remood.org
if [ ! -f "SDL-devel-1.2.15-mingw32.tar.gz" ]
then
wget -c http://remood.org/downloads/SDL-devel-1.2.15-mingw32.tar.gz -O SDL-devel-1.2.15-mingw32.tar.gz
fi
# Extract
if ! tar -xvvf "SDL-devel-1.2.15-mingw32.tar.gz"
then
echo "$COOLPREFIX Failed to extract SDL/Win32" 1>&2
exit 1
fi
fi
# Compile
make clean USEINTERFACE=sdl TOOLPREFIX="$WINGCC"
if ! make $MAKEFLAGS USEINTERFACE=sdl TOOLPREFIX="$WINGCC" SDL_INCLUDE=SDL-1.2.15/include/SDL SDL_LIB=SDL-1.2.15/lib OPENGL_LDFLAGS="-lopengl32"
then
echo "$COOLPREFIX Failed" 1>&2
exit 1
fi
# Zip
mkdir -p "$$/"
cp -v "bin/remood.exe" "$$/"
cp -v "$BBREMOOD/bin/remood.wad" "$$/"
cp -v "SDL-1.2.15/bin/SDL.dll" "$$/"
cp -v "$BBREMOOD/doc/manual.pdf" "$$/"
cp -v "$BBREMOOD/AUTHORS" "$$/"
cp -v "$BBREMOOD/LICENSE" "$$/"
cp -v "$BBREMOOD/version" "$$/"
# Go into dir
cd "$$/"
# Convert to DOS format
unix2dos -o AUTHORS LICENSE version
# Zip files into an archive
rm -f "../remood_${REMOODVERSIONSTRIP}_win32.zip"
zip "../remood_${REMOODVERSIONSTRIP}_win32.zip" *
# Get back out
cd "../"
rm -rf "$$"
;;
###############################################################################
### Default Win32 Binary
###############################################################################
win32)
echo "$COOLPREFIX Building Win32 Default Binary" 1>&2
"$BBROOT/bb.sh" win32_allegro
;;
###############################################################################
### Nintendo Wii
###############################################################################
wii)
# Message
echo "$COOLPREFIX Building Wii Package" 1>&2
# Devkitpro Root
if [ "$DEVKITPPC" = "" ]
then
DEVKITPPC="/opt/devkitppc/devkitPPC"
fi
# Compile
if ! make $MAKEFLAGS CDEFFLAGS="-D__REMOOD_WII" CC="$DEVKITPPC/bin/powerpc-eabi-gcc" OPENGL_LDFLAGS="-D__REMOOD_OPENGL_CANCEL" EXESUFFIX=".elf"
then
echo "$COOLPREFIX Build failed" 1>&2
exit 1
fi
# Convert ELF to DOL
;;
###############################################################################
### GCW Zero
###############################################################################
gcw)
echo "$COOLPREFIX Building GCW Default Binary" 1>&2
DEBUGOPT="BLAHBLAH=1" "$BBROOT/bb.sh" gcw-core
;;
gcw-debug)
echo "$COOLPREFIX Building GCW DEBUG Binary" 1>&2
DEBUGOPT="DEBUG=1" "$BBROOT/bb.sh" gcw-core
;;
gcw-core)
# Message
echo "$COOLPREFIX Building GCW Package" 1>&2
# Basic Root
${GCWTCROOT:="/opt/gcw0-toolchain/"}
# Sanity Checks
# SquashFS
if ! which mksquashfs 2> /dev/null > /dev/null
then
echo "$COOLPREFIX You need mksquashfs" 1>&2
exit 1
fi
# GCW Root
if [ ! -d "$GCWTCROOT" ]
then
echo "$COOLPREFIX You need the GCW chain, set GCWTCROOT to where it exists (default /opt/gcw0-toolchain/)" 1>&2
exit 1
fi
# Build
if ! make $MAKEFLAGS $DEBUGOPT CC="$GCWTCROOT/usr/bin/mipsel-gcw0-linux-uclibc-gcc" USEINTERFACE=sdl CFLAGS="-I$GCWTCROOT/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL -D__REMOOD_OPENGL_CANCEL -D__REMOOD_MODEL=1 -D__REMOOD_NOALSAMIDI" OPENGL_LDFLAGS="-D__REMOOD_OPENGL_CANCEL" EXESUFFIX=".elf" CONFIGPREFIX="I$GCWTCROOT/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/"
then
echo "$COOLPREFIX Build failed" 1>&2
exit 1
fi
# Setup OPK
mkdir -p $$/
cd $$/
# Copy Files we want
cp ../sys/gcw.dsk default.gcw0.desktop
cp ../sys/gcw.png remood.png
if [ -f ../bin/remood-dbg.elf ]
then
cp ../bin/remood-dbg.elf remood.elf
sed 's/\(Name=.*\)/\1 Debug/' < default.gcw0.desktop > /tmp/xx$$
mv /tmp/xx$$ default.gcw0.desktop
else
cp ../bin/remood.elf remood.elf
fi
cp ../bin/remood.wad remood.wad
cp ../doc/AUTHORS AUTHORS
cp ../doc/LICENSE LICENSE
cp ../doc/manual.pdf manual.pdf
cp ../sys/gcw.txt remood.txt
# version
echo "Version=$REMOODVERSION" >> default.gcw0.desktop
# Make sure everything is readable
chmod uog+r *
chmod uog+x remood.elf
cd ..
# Squash It
rm -f remood_${REMOODVERSIONSTRIP}_gcw.opk
mksquashfs $$ remood_${REMOODVERSIONSTRIP}_gcw.opk -force-uid 1000 -force-gid 1000
# Done
rm -rf "$$"
;;
###############################################################################
### Palm OS
###############################################################################
palmos)
echo "$COOLPREFIX Building Palm OS PRC" 1>&2
# Download Floating Point Object
echo "$COOLPREFIX Checking for GCCs floatlib" 1>&2
if [ ! -f "arm-palmos-gcc-floatlib.o" ]
then
# Download from remood.org
wget -c http://remood.org/downloads/arm-palmos-gcc-floatlib.o -O arm-palmos-gcc-floatlib.o
fi
# Download Boot Lib
echo "$COOLPREFIX Checking for libarmboot.a" 1>&2
if [ ! -f "libarmboot.a" ]
then
# Download from remood.org and gunzip
wget -c http://remood.org/downloads/libarmboot.a.gz -O libarmboot.a.gz
gunzip libarmboot.a.gz
fi
# Check if peal needs to be extracted
echo "$COOLPREFIX Checking for PEAL" 1>&2
if [ ! -d "peal-2005_4_14" ]
then
# Download from remood.org
if [ ! -f "peal-2005_4_14.tar.gz" ]
then
wget -c http://remood.org/downloads/peal-2005_4_14.tar.gz -O peal-2005_4_14.tar.gz
fi
# Extract
if ! tar -xvvf "peal-2005_4_14.tar.gz"
then
echo "$COOLPREFIX Failed to extract PEAL" 1>&2
exit 1
fi
# Fix Compilation Problems
# Extra Qualifier
sed 's/Relocation::asElf/asElf/' < peal-2005_4_14/postlink/relocation.h > $$
mv $$ peal-2005_4_14/postlink/relocation.h
# Callocs and Mallocs Missing
sed 's/#include <stdint.h>/#include <stdlib.h>\n#include <stdint.h>/' < peal-2005_4_14/postlink/got.h > $$
mv $$ peal-2005_4_14/postlink/got.h
sed 's/#include <string.h>/#include <stdlib.h>\n#include <string.h>/' < peal-2005_4_14/postlink/stringtable.h > $$
mv $$ peal-2005_4_14/postlink/stringtable.h
# perror
sed 's/#include <unistd.h>/#include <stdio.h>\n#include <unistd.h>/' < peal-2005_4_14/postlink/image.cc > $$
mv $$ peal-2005_4_14/postlink/image.cc
# find (which is in <algorithm>
sed 's/#include <string>/#include <algorithm>\n#include <string>/' < peal-2005_4_14/postlink/symbol.cc > $$
mv $$ peal-2005_4_14/postlink/symbol.cc
sed 's/#include <string>/#include <algorithm>\n#include <string>/' < peal-2005_4_14/postlink/section.cc > $$
mv $$ peal-2005_4_14/postlink/section.cc
fi
# Check if PARM needs to be extracted
echo "$COOLPREFIX Checking for PARM" 1>&2
if [ ! -d "parm" ]
then
# Download from remood.org
if [ ! -f "parm.zip" ]
then
wget -c http://remood.org/downloads/parm.zip -O parm.zip
fi
# Extract
if ! unzip parm.zip
then
echo "$COOLPREFIX Failed to extract PARM" 1>&2
exit 1
else
# Lowercase it
mv PARM parm
fi
fi
# Compile PEAL
echo "$COOLPREFIX Compiling PEAL" 1>&2
cd peal-2005_4_14
cd postlink
make clean
make
# Test it
./peal-postlink
# Get out of the directory
cd ..
cd ..
# Compile ReMooD Now
echo "$COOLPREFIX Now Compiling..." 1>&2
make clean USEINTERFACE=palmos TOOLPREFIX="arm-palmos-"
if ! make $MAKEFLAGS USEINTERFACE=palmos TOOLPREFIX="arm-palmos-" CFLAGS="-Iparm -Ipeal-2005_4_14/arm" LDFLAGS="-lc libarmboot.a"
then
echo "$COOLPREFIX Failed" 1>&2
exit 1
fi
;;
###############################################################################
### Test Suite
###############################################################################
test)
echo "$COOLPREFIX Prepare test with build" 1>&2
make clean USEINTERFACE=headless DEBUG=1 > /dev/null 2> /dev/null
if ! make USEINTERFACE=headless DEBUG=1 2> /dev/null
then
echo "$COOLPREFIX Make failed..." 1>&2
exit 1
fi
echo "$COOLPREFIX Running tests..." 1>&2
# Start and quite test
echo -n "$COOLPREFIX TEST: START AND QUIT: " 1>&2
if ! bin/remood-dbg -devparm ++quit > /dev/null 2> /dev/null
then
echo "FAILED ($?)" 1>&2
else
echo "PASSED ($?)" 1>&2
fi
;;
esac
# Shift arguments over
shift
done
exit 0