| 1 |
#! /bin/bash |
|---|
| 2 |
#! -------------------------------------------------------------- |
|---|
| 3 |
#! Retro Development Kit |
|---|
| 4 |
#! |
|---|
| 5 |
#! This is the build script for RDEV. It is currently being |
|---|
| 6 |
#! updated to be a bit more modular and easier to extend in the |
|---|
| 7 |
#! future. |
|---|
| 8 |
#! -------------------------------------------------------------- |
|---|
| 9 |
|
|---|
| 10 |
SDL="no" |
|---|
| 11 |
THIS=`pwd` |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
#! -------------------------------------------------------------- |
|---|
| 15 |
#! Read input from the user |
|---|
| 16 |
#! -------------------------------------------------------------- |
|---|
| 17 |
input() |
|---|
| 18 |
{ |
|---|
| 19 |
read response |
|---|
| 20 |
echo $response |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#! -------------------------------------------------------------- |
|---|
| 25 |
#! Display menu of build options |
|---|
| 26 |
#! -------------------------------------------------------------- |
|---|
| 27 |
function options |
|---|
| 28 |
{ |
|---|
| 29 |
clear |
|---|
| 30 |
echo Retro Development Kit |
|---|
| 31 |
echo -------------------------------------------------------------- |
|---|
| 32 |
echo Please select the target you wish to build from the list |
|---|
| 33 |
echo below. |
|---|
| 34 |
echo |
|---|
| 35 |
echo 1. SDL Build \(crc\'s Ngaro w/SDL, Retro image\) |
|---|
| 36 |
echo 2. Console Build \(crc\'s Ngaro, Retro image\) |
|---|
| 37 |
echo 3. Console w/Threaded VM \(mat\'s Ngaro, Retro image\) |
|---|
| 38 |
echo 4. JavaScript Web Build \(Retro image for Ngaro JS\) |
|---|
| 39 |
echo 5. Java Web Build \(Ngaro + Integrated image\) |
|---|
| 40 |
echo 6. J2ME \(Ngaro + Integrated image\) \(EXPERIMENTAL\) |
|---|
| 41 |
echo |
|---|
| 42 |
echo Choice: |
|---|
| 43 |
|
|---|
| 44 |
option=`input`; |
|---|
| 45 |
case $option in |
|---|
| 46 |
[1]) |
|---|
| 47 |
toka |
|---|
| 48 |
image |
|---|
| 49 |
ngaro_crc_sdl |
|---|
| 50 |
cont=0 |
|---|
| 51 |
;; |
|---|
| 52 |
[2]) |
|---|
| 53 |
toka |
|---|
| 54 |
image |
|---|
| 55 |
ngaro_crc_tty |
|---|
| 56 |
cont=0 |
|---|
| 57 |
;; |
|---|
| 58 |
[3]) |
|---|
| 59 |
toka |
|---|
| 60 |
image |
|---|
| 61 |
ngaro_mat_tty |
|---|
| 62 |
cont=0 |
|---|
| 63 |
;; |
|---|
| 64 |
[4]) |
|---|
| 65 |
toka |
|---|
| 66 |
image |
|---|
| 67 |
image_js |
|---|
| 68 |
cont=0 |
|---|
| 69 |
;; |
|---|
| 70 |
[5]) |
|---|
| 71 |
toka |
|---|
| 72 |
image |
|---|
| 73 |
image_java |
|---|
| 74 |
cont=0 |
|---|
| 75 |
;; |
|---|
| 76 |
[6]) |
|---|
| 77 |
toka |
|---|
| 78 |
image |
|---|
| 79 |
image_j2me |
|---|
| 80 |
cont=0 |
|---|
| 81 |
;; |
|---|
| 82 |
esac |
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
#! -------------------------------------------------------------- |
|---|
| 87 |
#! Build Toka |
|---|
| 88 |
#! -------------------------------------------------------------- |
|---|
| 89 |
function toka |
|---|
| 90 |
{ |
|---|
| 91 |
cd $THIS/toka |
|---|
| 92 |
gcc *.c -o toka |
|---|
| 93 |
cd $THIS |
|---|
| 94 |
mv toka/toka bin |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
#! -------------------------------------------------------------- |
|---|
| 100 |
#! Build Ngaro (C, with SDL) |
|---|
| 101 |
#! -------------------------------------------------------------- |
|---|
| 102 |
function ngaro_crc_sdl |
|---|
| 103 |
{ |
|---|
| 104 |
cd $THIS/ngaro/c-crc/sdl |
|---|
| 105 |
gcc -Wall -O3 -fomit-frame-pointer disassemble.c endian.c loader.c ngaro.c devices.c vm.c -DUSE_SDL -Wall `sdl-config --cflags --libs` -o ngaro |
|---|
| 106 |
cd $THIS |
|---|
| 107 |
mv ngaro/c-crc/sdl/ngaro bin |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
#! -------------------------------------------------------------- |
|---|
| 113 |
#! Build Ngaro (C, text only) |
|---|
| 114 |
#! -------------------------------------------------------------- |
|---|
| 115 |
function ngaro_crc_tty |
|---|
| 116 |
{ |
|---|
| 117 |
cd $THIS/ngaro/c-crc/console |
|---|
| 118 |
gcc -Wall -O3 -fomit-frame-pointer disassemble.c endian.c loader.c ngaro.c vm.c -o ngaro |
|---|
| 119 |
cd $THIS |
|---|
| 120 |
mv ngaro/c-crc/console/ngaro bin |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|
| 123 |
function ngaro_mat_tty |
|---|
| 124 |
{ |
|---|
| 125 |
cd $THIS/ngaro/c-mat |
|---|
| 126 |
gcc -Wall -O3 -fomit-frame-pointer endian.c loader.c ngaro.c tty_devices.c vm.c -o ngaro |
|---|
| 127 |
cd $THIS |
|---|
| 128 |
mv ngaro/c-mat/ngaro bin |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
#! -------------------------------------------------------------- |
|---|
| 134 |
#! Build the RETRO image. |
|---|
| 135 |
#! -------------------------------------------------------------- |
|---|
| 136 |
function image |
|---|
| 137 |
{ |
|---|
| 138 |
cd $THIS/retro |
|---|
| 139 |
ln -s $THIS/bin/bootstrap.toka |
|---|
| 140 |
$THIS/bin/toka retro.toka |
|---|
| 141 |
rm bootstrap.toka |
|---|
| 142 |
cd $THIS |
|---|
| 143 |
mv retro/forth.image bin |
|---|
| 144 |
mv retro/forth.image.map bin |
|---|
| 145 |
|
|---|
| 146 |
gcc _build/fix-image.c -o bin/fix-image |
|---|
| 147 |
cd $THIS/bin |
|---|
| 148 |
./fix-image forth.image |
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
function image_js |
|---|
| 153 |
{ |
|---|
| 154 |
cd $THIS/bin |
|---|
| 155 |
$THIS/bin/toka $THIS/_build/image2js.toka forth.image >image.js |
|---|
| 156 |
} |
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
function image_java |
|---|
| 160 |
{ |
|---|
| 161 |
cd $THIS/bin |
|---|
| 162 |
$THIS/bin/toka $THIS/_build/image2java.toka forth.image >$THIS/ngaro/java/image.java |
|---|
| 163 |
cd $THIS/ngaro/java |
|---|
| 164 |
cat Ngaro.top image.java Ngaro.bottom >NgaroVM.java |
|---|
| 165 |
javac NgaroVM.java |
|---|
| 166 |
rm image.java |
|---|
| 167 |
mv NgaroVM.class $THIS/bin |
|---|
| 168 |
rm NgaroVM.java |
|---|
| 169 |
} |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
function image_j2me |
|---|
| 173 |
{ |
|---|
| 174 |
cd $THIS/bin |
|---|
| 175 |
$THIS/bin/toka $THIS/_build/image2j2me.toka forth.image >$THIS/ngaro/j2me/src/Retro/Img.java.middle |
|---|
| 176 |
cd $THIS/ngaro/j2me/src/Retro |
|---|
| 177 |
cat Img.java.top Img.java.middle Img.java.bottom >Img.java |
|---|
| 178 |
cd $THIS/ngaro/j2me |
|---|
| 179 |
ant |
|---|
| 180 |
rm src/Retro/Img.java.middle src/Retro/Img.java |
|---|
| 181 |
cp bin/* $THIS/bin |
|---|
| 182 |
rm bin/*.jar |
|---|
| 183 |
} |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
options |
|---|