forked from ghaerr/elks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildext.sh
More file actions
executable file
·364 lines (334 loc) · 7.98 KB
/
buildext.sh
File metadata and controls
executable file
·364 lines (334 loc) · 7.98 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
#!/usr/bin/env bash
#
# buildext.sh - build application repositories and internal OWC/C86 apps and libraries
# External repositories are cloned into extapps/.
# If OpenWatcom C installed and WATCOM= present, external OWC apps are built,
# The ELKS C Library is also built for OpenWatcom and C86, along with sample apps.
#
# This build script is called by build.sh in main.yml by GitHub Continuous Integration
#
# Usage: ./buildext.sh [all | <project ...> ]
# Currently supported projects are:
# Name Compiler Desc
# microwindows ia16-elf-gcc Nano-X Graphical Windowing Environment
# microwindows_pc98 ia16-elf-gcc Nano-X Graphical Windowing Environment for PC-98
# dcc ia6-elf-gcc DCC self-compiling C compiler for ELKS
# dflat ia16-elf-gcc D-Flat TUI memopad/library
# elkirc ia16-elf-gcc IRC for ELKS
# owc_libc OpenWatcom ELKS C Library compiled by OWC
# owc_elkscmd OpenWatcom Some elkscmd/ programs compiled by OWC
# c86_toolchain OpenWatcom/C86 C86 Toolchain, header files and examples
# c86_elkscmd C86 Some elkscmd/ programs compiled by C86
# elksdoom OpenWatcom Doom for ELKS
# ngircd_elks OpenWatcom IRC daemon for ELKS
# elks_viewer OpenWatcom Image viewers (BMP, PPM, JPG) for ELKS
# gzip OpenWatcom gzip compression utility
# lua OpenWatcom Lua 5.5 interpreter
# bobcat OpenWatcom Bobcat web browser (Lynx fork)
# kilomacs OpenWatcom Kilo-based editor with Emacs-style keybindings
# elksmoria OpenWatcom Roguelike game
#
# Some projects may require prerequisites.
# To only build the C86 toolchain, use './buildext.sh owc_libc c86_toolchain'
#
# 17 Jan 2026 Greg Haerr
set -e
doexit()
{
E="$1"
test -z $1 && E=0
if [ $E -eq 0 ]
then echo "Buildext.sh has completed successfully."
else echo "Buildext.sh has terminated with error $E"
fi
exit $E
}
# Environment setup
add_path()
{
if [[ ":$PATH:" != *":$1:"* ]]; then
export PATH="$1:$PATH"
fi
}
elks_environ()
{
SCRIPTDIR="$(dirname "$0")"
. "$SCRIPTDIR/env.sh"
[ $? -ne 0 ] && doexit 1
mkdir -p extapps
}
owc_environ()
{
# OWC should be setup outside this script!
#export WATCOM=/Users/greg/net/open-watcom-v2/rel
#add_path "$WATCOM/binl" # for Linux-32
#add_path "$WATCOM/binl64" # for Linux-64
#add_path "$WATCOM/bino64" # for macOS
return 0
}
c86_environ()
{
export C86=$TOPDIR/extapps/8086-toolchain
add_path "$C86/host-bin"
return 0
}
owc_libc()
{
cd $TOPDIR
make owclean
make owlibc
}
c86_libc()
{
c86_environ
cd $TOPDIR
make c86clean
make c86libc
}
c86_toolchain()
{
echo "Building 8086-toolchain..."
cd $TOPDIR/extapps
if [ ! -d 8086-toolchain ] ; then
git clone https://github.com/ghaerr/8086-toolchain
fi
cd 8086-toolchain
git pull
make clean
make host
make elks
c86_libc
cd $C86/examples
make
echo "8086-toolchain build complete"
}
# build OWC apps in elkscmd/
owc_elkscmd()
{
echo "Building OWC apps in elkscmd/"
cd $TOPDIR
make -C elkscmd owclean
make -C elkscmd owc
echo "OWC apps in elkscmd/ build complete"
}
# build C86 apps in elkscmd/
c86_elkscmd()
{
echo "Building C86 apps in elkscmd/"
cd $TOPDIR
make -C elkscmd c86clean
make -C elkscmd c86
echo "C86 apps in elkscmd/ build complete"
}
# external repositories
microwindows()
{
echo "Building Nano-X..."
cd $TOPDIR/extapps
if [ ! -d microwindows ] ; then
git clone https://github.com/ghaerr/microwindows.git
fi
cd microwindows/src
git pull
make -f Makefile.elks clean
make -f Makefile.elks
echo "Nano-X build complete"
}
microwindows_pc98()
{
echo "Building Nano-X for PC-98..."
cd $TOPDIR/extapps
if [ ! -d microwindows ] ; then
git clone https://github.com/ghaerr/microwindows.git
fi
cd microwindows/src
git pull
make -f Makefile.elks clean
CONFIG_ARCH_PC98=y make -f Makefile.elks
echo "Nano-X for PC-98 build complete"
}
dcc()
{
echo "Building DeSmet C Compiler (DCC)..."
cd $TOPDIR/extapps
if [ ! -d dcc ] ; then
git clone https://github.com/ghaerr/dcc
fi
cd dcc/src
git pull
make clean
make
echo "DCC build complete"
}
dflat()
{
echo "Building D-Flat..."
cd $TOPDIR/extapps
if [ ! -d dflat ] ; then
git clone https://github.com/ghaerr/dflat.git
fi
cd dflat
git pull
make -f Makefile.elks clean
make -f Makefile.elks
echo "D-Flat build complete"
}
elksdoom()
{
echo "Building Doom..."
cd $TOPDIR/extapps
if [ ! -d elksdoom ] ; then
git clone https://github.com/FrenkelS/elksdoom
fi
cd elksdoom
git pull
rm -f *.obj
INCLUDE="$TOPDIR/libc/include:$TOPDIR/include:$TOPDIR/elks/include:$WATCOM/h" \
LIBC=$TOPDIR/libc/libcm.lib \
./compelks.sh
echo "Doom build complete"
}
ngircd_elks()
{
echo "Building ngircd-elks..."
cd $TOPDIR/extapps
if [ ! -d ngircd-elks ] ; then
git clone https://github.com/parabyte/ngircd-elks
fi
cd ngircd-elks
rm -f src/*/*.obj ngircd.os2
git pull
NGIRCD_DIR=$TOPDIR/extapps/ngircd-elks make -e -f Makefile.owc clean
NGIRCD_DIR=$TOPDIR/extapps/ngircd-elks make -e -f Makefile.owc
echo "ngircd-elks build complete"
}
elkirc()
{
echo "Building elkirc..."
cd $TOPDIR/extapps
if [ ! -d elkirc ] ; then
git clone https://github.com/sepen/elkirc
fi
cd elkirc
git pull
make clean
make ELKS=1
echo "elkirc build complete"
}
elks_viewer()
{
echo "Building elks-viewer..."
cd $TOPDIR/extapps
if [ ! -d elks-viewer ] ; then
git clone https://github.com/rafael2k/elks-viewer
fi
cd elks-viewer
git pull
make -f Makefile.owc clean
make -f Makefile.owc
echo "elks-viewer build complete"
}
gzip()
{
echo "Building gzip..."
cd $TOPDIR/extapps
if [ ! -d zlib ] ; then
git clone https://github.com/rafael2k/zlib zlib
fi
cd zlib
git pull
make -f elks/Makefile.elks clean
make -f elks/Makefile.elks
echo "gzip build complete"
}
lua()
{
echo "Building Lua 5.5..."
cd $TOPDIR/extapps
if [ ! -d lua ] ; then
git clone https://github.com/rafael2k/lua lua
fi
cd lua
git pull
make -f Makefile.elks clean
make -f Makefile.elks
echo "Lua 5.5 build complete"
}
bobcat()
{
echo "Building Bobcat web browser..."
cd $TOPDIR/extapps
if [ ! -d bobcat ] ; then
git clone https://github.com/rafael2k/bobcat bobcat
fi
cd bobcat
git pull
cd src
make -f Makefile.elks clean
make -f Makefile.elks
echo "Bobcat build complete"
}
kilomacs()
{
echo "Building kilomacs editor..."
cd $TOPDIR/extapps
if [ ! -d kilomacs ] ; then
git clone https://github.com/rafael2k/kilomacs.git kilomacs
fi
cd kilomacs
git pull
make clean
make
echo "Kilomacs build complete"
}
elksmoria()
{
echo "Building ELKSmoria..."
cd $TOPDIR/extapps
if [ ! -d elksmoria ] ; then
git clone https://github.com/tyama501/ELKSmoria.git elksmoria
fi
cd elksmoria
git pull
make clean
make
echo "ELKSmoria build complete"
}
# build all extapps repos
make_all()
{
microwindows
dcc
dflat
elkirc
if [ -n "$WATCOM" ] ; then
owc_libc
owc_elkscmd
c86_toolchain
c86_elkscmd
elksdoom
ngircd_elks
elks_viewer
gzip
lua
#bobcat
kilomacs
elksmoria
fi
}
# script starts here
if [ "$1" = "" ] ; then
echo "Usage: $0 [all | <project ...>]"
doexit 1
fi
elks_environ
#owc_environ
#c86_environ
if [ "$1" = "all" ] ; then
make_all
else
for repo in $@ ; do
$repo
done
fi
doexit 0