This repository has been archived by the owner on Jun 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
do_it
executable file
·567 lines (461 loc) · 12.6 KB
/
do_it
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
#! /bin/sh
#
# Script to help build RTEMS Graphics Toolkit
#
BASEDIR=`dirname $0`
vfile=`dirname $0`/VERSIONS
if [ ! -r ${vfile} ] ; then
echo VERSIONS file not found
exit 1
fi
. ./${vfile}
if [ X${LIBJPEG} = X ] ; then
echo VERSION FILE NOT CORRECT
exit 1
fi
######################## Set defaults #############################
# Do we clean after build and install
do_clean="no"
# Do we build jpeg support?
do_jpeg="no"
# Do we build png support?
do_png="no"
# Do we build tiff support?
do_tiff="no"
# Do we build Adobe Type 1 Font support?
do_t1="no"
# Do we build Truetype Font support?
do_ttf="no"
# Do we build Microwindows/Nano-X support?
do_nanox="no"
# Do we build Microwindows/Nano-X NXLib support?
do_nxlib="no"
# Do we build FLTK support?
do_fltk="no"
# Do we need sudo to install?
use_sudo="no"
# Are we noisy when running?
verbose="no"
# Do we install what we built?
do_install=true
######################## Parse arguments ###########################
usage()
{
cat <<EOF
do_it [options]
-A - build and install all libraries
-a - build all libraries
-j - build JPEG support (default=no)
-p - build PNG support (default=no)
-t - build TIFF support (default=no)
-1 - build Adobe Type 1 font support (default=no)
-T - build Truetype font support (default=no)
-n - build Microwindows/Nano-X support (default=no)
-x - build Microwindows/Nano-X NXLib support (default=no)
-f - build FLTK support (default=no)
-c - clean after building (default=no)
-b - build only, do not install libraries (default=no)
-s - use sudo for make install (default=no)
-v - verbose
NOTES:
+ Use of each option toggles the setting. For example, \"-v -v -A -1\"
results in verbose=no and all steps done except Type 1 fonts and build only.
+ RTEMS_MAKEFILE_PATH must be set.
+ By default, nothing is built.
EOF
}
fatal()
{
usage
exit 1
}
check_status()
{
if [ $1 -ne 0 ] ; then
shift
echo "ERROR: $*" >&2
exit 1
fi
}
toggle()
{
case $1 in
no) echo "yes" ;;
yes) echo "no" ;;
*) fatal "Unknown value to toggle ($1)" ;;
esac
}
while getopts Aajpt1Tnxfbcsv OPT
do
case "$OPT" in
A) do_jpeg="yes"
do_png="yes"
do_tiff="yes"
do_t1="yes"
do_ttf="yes"
do_nanox="yes"
do_nxlib="yes"
do_fltk="yes"
;;
a) do_jpeg="yes"
do_png="yes"
do_tiff="yes"
do_t1="yes"
do_ttf="yes"
do_nanox="yes"
do_nxlib="yes"
do_fltk="yes"
do_install=false
;;
j) do_jpeg=`toggle ${do_jpeg}` ;;
p) do_png=`toggle ${do_png}` ;;
t) do_tiff=`toggle ${do_tiff}` ;;
1) do_t1=`toggle ${do_t1}` ;;
T) do_ttf=`toggle ${do_ttf}` ;;
n) do_nanox=`toggle ${do_nanox}` ;;
x) do_nxlib=`toggle ${do_nxlib}` ;;
f) do_fltk=`toggle ${do_fltk}` ;;
b) do_install=false ;;
c) do_clean=`toggle ${do_clean}` ;;
s) use_sudo=`toggle ${use_sudo}` ;;
v) verbose=`toggle ${verbose}` ;;
*) fatal;;
esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount
if [ ${verbose} = yes ] ; then
echo "JPEG Library : " ${LIBJPEG}
echo "Build JPEG Library : " ${do_jpeg}
echo "PNG Library : " ${LIBPNG}
echo "Build PNG Library : " ${do_png}
echo "TIFF Library : " ${TIFFLIB}
echo "Build TIFF Library : " ${do_tiff}
echo ""
echo "Build TrueType Font Library : " ${do_ttf}
echo "TrueType Font Library : " ${FREETYPE}
echo "Build Adobe Type 1 Font Library : " ${do_t1}
echo "Adobe Type 1 Font Library : " ${T1LIB}
echo ""
echo "Build Microwindows/Nano-X : " ${do_nanox}
echo "Microwindows/Nano-X Source : " ${NANOX}
echo ""
echo "Build NXLib : " ${do_nxlib}
echo "NXLib Source : " ${NXLIB}
echo ""
echo "Build FLTK : " ${do_fltk}
echo "FLTK Source : " ${FLTK}
echo ""
echo "Clean after install : " ${do_clean}
echo "Install : " ${do_install}
echo ""
fi
if [ ${use_sudo} = yes ] ; then
sudo_cmd="sudo -E "
else
sudo_cmd=""
fi
######### START OF Consistency checks
if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then
echo RTEMS_MAKEFILE_PATH not set
exit 1
fi
# Check if enabled before checking if present
if [ ${do_jpeg} = "yes" ] ; then
test -d ${LIBJPEG}
check_status $? "${LIBJPEG} not present"
fi
if [ ${do_ttf} = "yes" ] ; then
test -d ${FREETYPE}
check_status $? "${FREETYPE} not present"
fi
if [ ${do_png} = "yes" ] ; then
test -d ${LIBPNG}
check_status $? "${LIBPNG} not present"
fi
if [ ${do_t1} = "yes" ] ; then
test -d ${T1LIB}
check_status $? "${T1LIB} not present"
fi
if [ ${do_tiff} = "yes" ] ; then
test -d ${TIFFLIB}
check_status $? "${TIFFLIB} not present"
fi
if [ ${do_nanox} = "yes" ] ; then
test -d ${NANOX}
check_status $? "${NANOX} not present"
fi
test -d ${RTEMS_MAKEFILE_PATH}
check_status $? "${RTEMS_MAKEFILE_PATH} not present"
######### END OF Consistency checks
echo "Generating RTEMS_SETTINGS file..."
make -f Makefile.settings clean all
check_status $? Could not generate RTEMS_SETTINGS
. ./RTEMS_SETTINGS
PREFIX=${BSPTOP}
if [ ${verbose} = yes ] && $do_install ; then
echo "USING ${PREFIX} for install point!!!"
fi
case ${BSP} in
pc386) ;; # can be used to turn on detect svgalib supportable on this BSP
*)
esac
######### Log Directory
LOGDIR=${BASEDIR}/log
if [ ! -d ${LOGDIR} ] ; then
mkdir ${LOGDIR}
fi
#########
######### Build Directory
BUILDDIR=${BASEDIR}/build
if [ ! -d ${BUILDDIR} ] ; then
mkdir ${BUILDDIR}
fi
#########
######### Build and install JPEG
j_jpeg()
{
if [ ! -d ${BUILDDIR}/${LIBJPEG} ] ; then
mkdir ${BUILDDIR}/${LIBJPEG}
fi
cd ${BUILDDIR}/${LIBJPEG}
make distclean
CFLAGS="${CPU_CFLAGS}" \
../../${LIBJPEG}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir=${PREFIX}/lib/include \
--disable-shared \
--disable-programs
check_status $? Could not configure ${LIBJPEG}
make
check_status $? Could not make ${LIBJPEG}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${LIBJPEG}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${LIBJPEG}
fi
cd ../..
}
if [ ${do_jpeg} = yes ] ; then
echo "Building ${LIBJPEG} ..."
j_jpeg # >${LOGDIR}/${TARGET}-${LIBJPEG}.log 2>&1
fi
######### Build and install PNG support
j_png()
{
if [ ! -d ${BUILDDIR}/${LIBPNG} ] ; then
mkdir ${BUILDDIR}/${LIBPNG}
fi
cd ${BUILDDIR}/${LIBPNG}
make distclean
CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
../../${LIBPNG}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir=${PREFIX}/lib/include \
--libdir=${PREFIX}/lib \
--disable-shared
check_status $? Could not configure ${LIBPNG}
make
check_status $? Could not make ${LIBPNG}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${LIBPNG}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${LIBPNG}
fi
cd ../..
}
if [ ${do_png} = yes ] ; then
echo "Building ${LIBPNG} ..."
j_png # >${LOGDIR}/${TARGET}-${LIBPNG}.log 2>&1
fi
######### Build and install TIFF support
j_tiff()
{
if [ ! -d ${BUILDDIR}/${TIFFLIB} ] ; then
mkdir ${BUILDDIR}/${TIFFLIB}
fi
cd ${BUILDDIR}/${TIFFLIB}
make distclean
CFLAGS="${CPU_CFLAGS}" \
../../${TIFFLIB}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir=${PREFIX}/lib/include \
--disable-shared
check_status $? Could not configure ${TIFFLIB}
make
check_status $? Could not make ${TIFFLIB}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${TIFFLIB}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${TIFFLIB}
fi
cd ../..
}
if [ ${do_tiff} = yes ] ; then
echo "Building ${TIFFLIB} ..."
j_tiff # >${LOGDIR}/${TARGET}-${TIFFLIB}.log 2>&1
fi
######### Build and install Adobe Type 1 Font support
j_t1()
{
if [ ! -d ${BUILDDIR}/${T1LIB} ] ; then
mkdir ${BUILDDIR}/${T1LIB}
else
rm -r ${BUILDDIR}/${T1LIB}
mkdir ${BUILDDIR}/${T1LIB}
fi
cd ${BUILDDIR}/${T1LIB}
cp -r ../../${T1LIB}/* .
CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
../../${T1LIB}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir=${PREFIX}/lib/include \
--datadir=${PREFIX}/share \
--disable-shared \
--without-athena --without-x
check_status $? Could not configure ${T1LIB}
make without_doc
check_status $? Could not make ${T1LIB}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${T1LIB}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${T1LIB}
fi
cd ../..
}
if [ ${do_t1} = yes ] ; then
echo "Building ${T1LIB}..."
j_t1 # >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1
fi
######### Build and install Truetype Font support
j_ttf()
{
if [ ! -d ${BUILDDIR}/${FREETYPE} ] ; then
mkdir ${BUILDDIR}/${FREETYPE}
fi
cd ${BUILDDIR}/${FREETYPE}
make distclean
CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
../../${FREETYPE}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir=${PREFIX}/lib/include \
--disable-shared
check_status $? Could not configure ${FREETYPE}
make
check_status $? Could not make ${FREETYPE}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${FREETYPE}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${FREETYPE}
fi
cd ../..
}
if [ ${do_ttf} = yes ] ; then
echo "Building ${FREETYPE} ..."
j_ttf # >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1
fi
######### Build and install Nano-X support
j_nanox()
{
if [ ! -d ${BUILDDIR}/${NANOX}/src ] ; then
mkdir -p ${BUILDDIR}/${NANOX}/src
else
rm -r ${BUILDDIR}/${NANOX}/src
mkdir -p ${BUILDDIR}/${NANOX}/src
fi
cd ${BUILDDIR}/${NANOX}/src
cp -r ../../../${NANOX}/src/* .
# RTEMS_MAKEFILE_PATH inherited
export RTEMS_MAKEFILE_PATH
make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems -k all
check_status $? Could not make ${NANOX}
if ${do_install} ; then
${sudo_cmd} make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems install
check_status $? Could not make install ${NANOX}
fi
if [ ${do_clean} = yes ] ; then
make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems clean
check_status $? Could not make distclean ${NANOX}
fi
cd ../../..
}
if [ ${do_nanox} = yes ] ; then
echo "Building ${NANOX} ..."
j_nanox # >${LOGDIR}/${TARGET}-${NANOX}.log 2>&1
fi
######### Build and install NXLIB support
j_nxlib()
{
if [ ! -d ${BUILDDIR}/${NXLIB} ] ; then
mkdir ${BUILDDIR}/${NXLIB}
else
rm -r ${BUILDDIR}/${NXLIB}
mkdir ${BUILDDIR}/${NXLIB}
fi
cd ${BUILDDIR}/${NXLIB}
cp -r ../../${NXLIB}/* .
# RTEMS_MAKEFILE_PATH inherited
export RTEMS_MAKEFILE_PATH
make -f Makefile.rtems distclean
make -f Makefile.rtems
check_status $? Could not make ${NXLIB}
if ${do_install} ; then
${sudo_cmd} make -f Makefile.rtems install
check_status $? Could not make install ${NXLIB}
fi
if [ ${do_clean} = yes ] ; then
make -f Makefile.rtems distclean
check_status $? Could not make distclean ${NXLIB}
fi
cd ../..
}
if [ ${do_nxlib} = yes ] ; then
echo "Building ${NXLIB} ..."
j_nxlib # >${LOGDIR}/${TARGET}-${NXLIB}.log 2>&1
fi
######### Build and install FLTK support
j_fltk()
{
if [ ! -d ${BUILDDIR}/${FLTK} ] ; then
mkdir ${BUILDDIR}/${FLTK}
else
rm -r ${BUILDDIR}/${FLTK}
mkdir ${BUILDDIR}/${FLTK}
fi
cd ${BUILDDIR}/${FLTK}
cp -r ../../${FLTK}/* .
make distclean
CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
../../${FLTK}/configure --host=${TARGET} --prefix=${PREFIX} \
--includedir="${BSPTOP}/lib/include" --libdir="${BSPTOP}/lib"\
--x-includes="${BSPTOP}/lib/include" --x-libraries="${BSPTOP}/lib" \
--disable-xft --disable-xinerama --disable-xdbe \
--disable-shared --disable-gl
check_status $? Could not configure ${FLTK}
make -k
check_status $? Could not make ${FLTK}
if ${do_install} ; then
${sudo_cmd} make install
check_status $? Could not make install ${FLTK}
fi
if [ ${do_clean} = yes ] ; then
make distclean
check_status $? Could not make distclean ${FLTK}
fi
cd ..
}
if [ ${do_fltk} = yes ] ; then
echo "Building ${FLTK} ..."
j_fltk # >${LOGDIR}/${TARGET}-${FLTK}.log 2>&1
fi
exit 0