-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
install-jit-debian.sh
executable file
·275 lines (236 loc) · 5.53 KB
/
install-jit-debian.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
#!/bin/bash
# changed: install to /home/foo/bin instead to /usr/local/bin!
export PATH="$HOME/l1vm/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/l1vm/bin:$LD_LIBRARY_PATH"
if ! dpkg -s libsdl2-dev &> /dev/null; then
echo "try to install libsdl2-dev..."
if ! sudo apt-get install libsdl2-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libsdl2-gfx-dev &> /dev/null; then
echo "try to install libsdl2-gfx-dev..."
if ! sudo apt-get install libsdl2-gfx-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libsdl2-image-dev &> /dev/null; then
echo "try to install libsdl2-image-dev..."
if ! sudo apt-get install libsdl2-image-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libsdl2-ttf-dev &> /dev/null; then
echo "try to install libsdl2-ttf-dev..."
if ! sudo apt-get install libsdl2-ttf-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libsdl2-mixer-dev &> /dev/null; then
echo "try to install libsdl2-mixer-dev..."
if ! sudo apt-get install libsdl2-mixer-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libfann-dev &> /dev/null; then
echo "try to install libfann-dev..."
if ! sudo apt-get install libfann-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libmpfrc++-dev &> /dev/null; then
echo "try to install libmpfrc++-dev..."
if ! sudo apt-get install libmpfrc++-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libsodium-dev &> /dev/null; then
echo "try to install libsodium-dev..."
if ! sudo apt-get install libsodium-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libserialport-dev &> /dev/null; then
echo "try to install libsodium-dev..."
if ! sudo apt-get install libsodium-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libssl-dev &> /dev/null; then
echo "try to install libssl-dev..."
if ! sudo apt-get install libssl-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s libcrypto++-dev &> /dev/null; then
echo "try to install licbcrypto++-dev..."
if ! sudo apt-get install libcrypto++-dev; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s cmake &> /dev/null; then
echo "try to install cmake..."
if ! sudo apt-get install cmake; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s make &> /dev/null; then
echo "try to install make..."
if ! sudo apt-get install make; then
echo "installation failed!"
exit 1
fi
fi
if ! dpkg -s git &> /dev/null; then
echo "try to install git..."
if ! sudo apt-get install git; then
echo "installation failed!"
exit 1
fi
fi
echo "libraries installed! building compiler, assembler and VM..."
export CC=clang-15
export CCPP=clang++-15
# check if clang C compiler is installed
if ! dpkg -s clang-15 &> /dev/null; then
echo "try to install clang..."
if ! sudo apt-get install clang-15; then
echo "installation failed!"
exit 1
fi
fi
# check if ~/bin exists
DIR="~/l1vm/bin"
if [ -d "$DIR" ]; then
### Take action if $DIR exists ###
echo "${DIR} already exists!"
else
### Control will jump here if $DIR does NOT exists ###
echo "${DIR} will be created now..."
mkdir ~/l1vm
mkdir ~/l1vm/bin
fi
# check if zerobuild installed into ~/bin
FILE=~/l1vm/bin/zerobuild
if test -f "$FILE"; then
echo "$FILE exists!"
else
echo "zerobuild not installed into $FILE!"
echo "cloning and building it now..."
git clone https://github.com/koder77/zerobuild.git
cd zerobuild
./make-clang-15.sh
cp zerobuild ~/l1vm/bin/
cd ..
fi
# install mpreal.h include
echo "installing mpreal.h include file now..."
git clone https://github.com/advanpix/mpreal.git
sudo cp vm/modules/mpfr-c++/mpreal.h /usr/include
# check if libasmjit is installed
FILE=/usr/local/lib/libasmjit.so
if test -f "$FILE"; then
echo "$FILE exists!"
else
echo "libasmjit not installed into $FILE!"
echo "cloning and building it now..."
git clone https://github.com/asmjit/asmjit
cd asmjit
mkdir build
cd build
cmake ../
make
sudo make install
sudo cp libasmjit.so /usr/local/lib
cd ..
cd ..
fi
cd assemb
if zerobuild force; then
echo "l1asm build ok!"
else
echo "l1asm build error!"
exit 1
fi
cd ../comp
if zerobuild force; then
echo "l1com build ok!"
else
echo "l1com build error!"
exit 1
fi
cd ../prepro
if zerobuild force; then
echo "l1pre build ok!"
else
echo "l1pre build error!"
exit 1
fi
cd ../vm
if zerobuild force; then
echo "l1vm JIT build ok!"
else
echo "l1vm JIT build error!"
exit 1
fi
cd ..
cp assemb/l1asm ~/l1vm/bin
cp comp/l1com ~/l1vm/bin
cp prepro/l1pre ~/l1vm/bin
cp vm/l1v* ~/l1vm/bin
echo "VM binaries installed into ~/bin"
cd modules
echo "installing modules..."
chmod +x *.sh
./build.sh
if ./install.sh; then
echo "modules build ok!"
else
echo "modules build FAILED!"
exit 1
fi
cd ../
echo "all modules installed. building programs..."
chmod +x *.sh
if ./build-all.sh; then
echo "building programs successfully!"
else
echo "building programs FAILED!"
fi
echo "checking for ~/l1vm directory..."
# check if ~/l1vm exists
DIR="~/l1vm"
if [ -d "$DIR" ]; then
### Take action if $DIR exists ###
echo "${DIR} already exists!"
else
### Control will jump here if $DIR does NOT exists ###
echo "${DIR} will be created now..."
mkdir ~/l1vm
fi
echo "installing programs to ~/l1vm"
cp prog/ ~/l1vm -r
cp lib/sdl-lib* ~/l1vm/prog
echo "installing lib to ~/lib"
cp lib/ ~/l1vm -r
echo "installing fonts to ~/l1vm"
cp fonts/ ~/l1vm -r
mkdir ~/l1vm/include
cp include-lib/* ~/l1vm/include/
mkdir ~/l1vm/man
echo "copy fann demo neural networks"
cp -R fann ~/l1vm
echo "installation finished!"
exit 0