-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcompile.sh
executable file
·132 lines (132 loc) · 4 KB
/
compile.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
# Note: this script requires ez80-clang to be accessible in PATH
#
set -x
ORIGDIR=$PWD
BASEDIR=$PWD/_temp
GITHUB=$PWD/_temp/github
CEDEV_VER=v11.2
#
if [ ! -d $BASEDIR ]; then
mkdir $BASEDIR;
fi
cd $BASEDIR
#
if [ ! -d $BASEDIR/CEdev_zip ]; then
wget https://github.com/CE-Programming/toolchain/releases/download/$CEDEV_VER/CEdev-Linux.tar.gz
tar -zxvf $BASEDIR/CEdev-Linux.tar.gz;
find . -type d -exec chmod 755 {} \; # no clue why this is required.
mv CEdev CEdev_zip;
fi
#
# Get AgDev code
cd $BASEDIR
mkdir $GITHUB
cd $GITHUB
#
if [ -d $GITHUB/AgDev_git ]; then
rm -r -f $GITHUB/AgDev_git;
fi
mkdir $GITHUB/AgDev_git;
AGDEV_GIT=$GITHUB/AgDev_git
# was a local location for AgDev code passed to us?
if [ ! -z "$1" ]; then
cd $GITHUB
cp -r $1/* $AGDEV_GIT;
else
cd $GITHUB
git clone https://github.com/pcawte/AgDev.git AgDev_git;
fi
#
# get CEdev code - using a recent stable release
cd $GITHUB
CEDEV_GIT=$GITHUB/CEdev_git
if [ ! -d $CEDEV_GIT ]; then
mkdir $CEDEV_GIT;
git clone https://github.com/CE-Programming/toolchain.git CEdev_git --branch $CEDEV_VER;
cd $CEDEV_GIT;
git switch -c tmp;
git switch master;
git merge tmp;
git submodule update --init --recursive;
fi
#
# Duplicate CEdev repo - this will become the basis for the final build
if [ -d $BASEDIR/CEDEV_PLUS_AGDEV ]; then
rm -r -f $BASEDIR/CEDEV_PLUS_AGDEV;
fi
mkdir $BASEDIR/CEDEV_PLUS_AGDEV
CEDEV_PLUS_AGDEV=$BASEDIR/CEDEV_PLUS_AGDEV
cp -r $CEDEV_GIT/. ./ $CEDEV_PLUS_AGDEV
#
# move some stuff around in src
# the /agon folder in AgDev is based on the /ce folder in CEdev, but with CE-specific stuff removed and Agon-specific stuff added
mkdir $CEDEV_PLUS_AGDEV/src/agon
cp -r $CEDEV_PLUS_AGDEV/src/ce/* $CEDEV_PLUS_AGDEV/src/agon/
mkdir $CEDEV_PLUS_AGDEV/src/agon/include
cp -r $CEDEV_PLUS_AGDEV/src/ce/include* $CEDEV_PLUS_AGDEV/src/agon/
cd $CEDEV_PLUS_AGDEV/src/agon
rm -f eval.src
rm -f getstringinput.src
rm -f gettokeninput.src
rm -f intce.src
rm -f tice.src
rm -f os_textbuffer.src
rm -f runprgm.src
#
# now that we've copied its contents, we don't need /ce anymore
rm -r -f $CEDEV_PLUS_AGDEV/src/ce
#
# delete CEdev allocator code, since AgDev uses its own
rm -r -f $CEDEV_PLUS_AGDEV/src/libc/allocator.src
rm -r -f $CEDEV_PLUS_AGDEV/src/libc/allocator_simple.src
rm -r -f $CEDEV_PLUS_AGDEV/src/libc/allocator_standard.c
#
# delete misc .c files which had handmade asm edits made for AgDev - we will copy over these prebuilt .src files in the next step
rm -r -f $CEDEV_PLUS_AGDEV/src/libc/time.c
rm -r -f $CEDEV_PLUS_AGDEV/src/libc/strftime.c
#
# copy over AgDev source files and build instructions
cp -r $AGDEV_GIT/makefile $CEDEV_PLUS_AGDEV
cp -r $AGDEV_GIT/src/. $CEDEV_PLUS_AGDEV/src/
#
# vdp headers need to be in 2 places for some reason
cp -r $AGDEV_GIT/src/agon/include/agon $CEDEV_PLUS_AGDEV/src/include/
#
# Remove the previous build directory and make
cd $CEDEV_PLUS_AGDEV
if [ $CEDEV_PLUS_AGDEV/CEdev ]; then
rm -r -f $CEDEV_PLUS_AGDEV/CEdev;
fi
mkdir $CEDEV_PLUS_AGDEV/CEdev
PATH=$PATH:$BASEDIR/CEdev_zip/bin
#
make V=1
make install V=1 DESTDIR=$CEDEV_PLUS_AGDEV/ --debug=j,m
#
# copy over .exe's from CEdev release - CEdev GitHub actions pull each .exe's repo and build, but we shouldn't need to do that.
mkdir $CEDEV_PLUS_AGDEV/CEdev/bin/
cp -r $BASEDIR/CEdev_zip/bin/. $CEDEV_PLUS_AGDEV/CEdev/bin/
#
# copy over AgDev example folders
mkdir $CEDEV_PLUS_AGDEV/CEdev/AgExamples/
cp -r $AGDEV_GIT/AgExamples/* $CEDEV_PLUS_AGDEV/CEdev/AgExamples/
mkdir $CEDEV_PLUS_AGDEV/CEdev/sprite-demos/
cp -r $AGDEV_GIT/sprite-demos/* $CEDEV_PLUS_AGDEV/CEdev/sprite-demos/
mkdir $CEDEV_PLUS_AGDEV/CEdev/tests/
cp -r $AGDEV_GIT/tests/* $CEDEV_PLUS_AGDEV/CEdev/tests/
#
# copy resulting build to base directory
if [ -d $ORIGDIR/AgDev_build/ ]; then
rm -r -f $ORIGDIR/AgDev_build/;
fi
mkdir $ORIGDIR/AgDev_build/
cp -r $CEDEV_PLUS_AGDEV/CEdev/* $ORIGDIR/AgDev_build/
#
# Set file permissions
chmod +x $ORIGDIR/AgDev_build/bin/*
#
# clean folders up at the end - TODO make optional
cd "$ORIGDIR"
rm -r -f "$BASEDIR"
#
exit