1 | #! /bin/sh |
---|
2 | # |
---|
3 | # Script to help build RTEMS Graphics Toolkit |
---|
4 | # |
---|
5 | |
---|
6 | BASEDIR=`dirname $0` |
---|
7 | |
---|
8 | vfile=`dirname $0`/VERSIONS |
---|
9 | if [ ! -r ${vfile} ] ; then |
---|
10 | echo VERSIONS file not found |
---|
11 | exit 1 |
---|
12 | fi |
---|
13 | |
---|
14 | . ./${vfile} |
---|
15 | |
---|
16 | if [ X${LIBJPEG} = X ] ; then |
---|
17 | echo VERSION FILE NOT CORRECT |
---|
18 | exit 1 |
---|
19 | fi |
---|
20 | |
---|
21 | ######################## Set defaults ############################# |
---|
22 | # Do we clean after build and install |
---|
23 | do_clean="no" |
---|
24 | # Do we build jpeg support? |
---|
25 | do_jpeg="no" |
---|
26 | # Do we build png support? |
---|
27 | do_png="no" |
---|
28 | # Do we build tiff support? |
---|
29 | do_tiff="no" |
---|
30 | # Do we build Adobe Type 1 Font support? |
---|
31 | do_t1="no" |
---|
32 | # Do we build Truetype Font support? |
---|
33 | do_ttf="no" |
---|
34 | |
---|
35 | # Do we build Microwindows/Nano-X support? |
---|
36 | do_nanox="no" |
---|
37 | # Do we build Microwindows/Nano-X NXLib support? |
---|
38 | do_nxlib="no" |
---|
39 | |
---|
40 | # Do we build FLTK support? |
---|
41 | do_fltk="no" |
---|
42 | |
---|
43 | # Do we need sudo to install? |
---|
44 | use_sudo="no" |
---|
45 | |
---|
46 | # Are we noisy when running? |
---|
47 | verbose="no" |
---|
48 | ######################## Parse arguments ########################### |
---|
49 | |
---|
50 | usage() |
---|
51 | { |
---|
52 | cat <<EOF |
---|
53 | do_it [options] |
---|
54 | -A - build and install all libraries |
---|
55 | -j - build JPEG support (default=no) |
---|
56 | -p - build PNG support (default=no) |
---|
57 | -t - build TIFF support (default=no) |
---|
58 | -1 - build Adobe Type 1 font support (default=no) |
---|
59 | -T - build Truetype font support (default=no) |
---|
60 | -n - build Microwindows/Nano-X support (default=no) |
---|
61 | -x - build Microwindows/Nano-X NXLib support (default=no) |
---|
62 | -f - build FLTK support (default=no) |
---|
63 | -c - clean after building (default=no) |
---|
64 | -s - use sudo for make install (default=no) |
---|
65 | -v - verbose |
---|
66 | |
---|
67 | NOTES: |
---|
68 | + Use of each option toggles the setting. For example, \"-v -v -A -1\" |
---|
69 | results in verbose=no and all steps done except Type 1 fonts and build only. |
---|
70 | + RTEMS_MAKEFILE_PATH must be set. |
---|
71 | + By default, nothing is built. |
---|
72 | EOF |
---|
73 | } |
---|
74 | |
---|
75 | fatal() |
---|
76 | { |
---|
77 | usage |
---|
78 | exit 1 |
---|
79 | } |
---|
80 | |
---|
81 | check_status() |
---|
82 | { |
---|
83 | if [ $1 -ne 0 ] ; then |
---|
84 | shift |
---|
85 | echo "ERROR: $*" >&2 |
---|
86 | exit 1 |
---|
87 | fi |
---|
88 | } |
---|
89 | |
---|
90 | toggle() |
---|
91 | { |
---|
92 | case $1 in |
---|
93 | no) echo "yes" ;; |
---|
94 | yes) echo "no" ;; |
---|
95 | *) fatal "Unknown value to toggle ($1)" ;; |
---|
96 | esac |
---|
97 | } |
---|
98 | |
---|
99 | while getopts Ajpt1Tnxfcsv OPT |
---|
100 | do |
---|
101 | case "$OPT" in |
---|
102 | A) do_jpeg="yes" |
---|
103 | do_png="yes" |
---|
104 | do_tiff="yes" |
---|
105 | do_t1="yes" |
---|
106 | do_ttf="yes" |
---|
107 | do_nanox="yes" |
---|
108 | do_nxlib="yes" |
---|
109 | do_fltk="yes" |
---|
110 | ;; |
---|
111 | j) do_jpeg=`toggle ${do_jpeg}` ;; |
---|
112 | p) do_png=`toggle ${do_png}` ;; |
---|
113 | t) do_tiff=`toggle ${do_tiff}` ;; |
---|
114 | 1) do_t1=`toggle ${do_t1}` ;; |
---|
115 | T) do_ttf=`toggle ${do_ttf}` ;; |
---|
116 | n) do_nanox=`toggle ${do_nanox}` ;; |
---|
117 | x) do_nxlib=`toggle ${do_nxlib}` ;; |
---|
118 | f) do_fltk=`toggle ${do_fltk}` ;; |
---|
119 | c) do_clean=`toggle ${do_clean}` ;; |
---|
120 | s) use_sudo=`toggle ${use_sudo}` ;; |
---|
121 | v) verbose=`toggle ${verbose}` ;; |
---|
122 | *) fatal;; |
---|
123 | esac |
---|
124 | done |
---|
125 | |
---|
126 | shiftcount=`expr $OPTIND - 1` |
---|
127 | shift $shiftcount |
---|
128 | |
---|
129 | if [ ${verbose} = yes ] ; then |
---|
130 | echo "JPEG Library : " ${LIBJPEG} |
---|
131 | echo "Build JPEG Library : " ${do_jpeg} |
---|
132 | echo "PNG Library : " ${LIBPNG} |
---|
133 | echo "Build PNG Library : " ${do_png} |
---|
134 | echo "TIFF Library : " ${TIFFLIB} |
---|
135 | echo "Build TIFF Library : " ${do_tiff} |
---|
136 | echo "" |
---|
137 | echo "Build TrueType Font Library : " ${do_ttf} |
---|
138 | echo "TrueType Font Library : " ${FREETYPE} |
---|
139 | echo "Build Adobe Type 1 Font Library : " ${do_t1} |
---|
140 | echo "Adobe Type 1 Font Library : " ${T1LIB} |
---|
141 | echo "" |
---|
142 | echo "Build Microwindows/Nano-X : " ${do_nanox} |
---|
143 | echo "Microwindows/Nano-X Source : " ${NANOX} |
---|
144 | echo "" |
---|
145 | echo "Build NXLib : " ${do_nxlib} |
---|
146 | echo "NXLib Source : " ${NXLIB} |
---|
147 | echo "" |
---|
148 | echo "Build FLTK : " ${do_fltk} |
---|
149 | echo "FLTK Source : " ${FLTK} |
---|
150 | echo "" |
---|
151 | echo "Clean after install : " ${do_clean} |
---|
152 | echo "" |
---|
153 | fi |
---|
154 | |
---|
155 | |
---|
156 | if [ ${use_sudo} = yes ] ; then |
---|
157 | sudo_cmd="sudo -E " |
---|
158 | else |
---|
159 | sudo_cmd="" |
---|
160 | fi |
---|
161 | |
---|
162 | ######### START OF Consistency checks |
---|
163 | |
---|
164 | if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then |
---|
165 | echo RTEMS_MAKEFILE_PATH not set |
---|
166 | exit 1 |
---|
167 | fi |
---|
168 | |
---|
169 | # Check if enabled before checking if present |
---|
170 | if [ ${do_jpeg} = "yes" ] ; then |
---|
171 | test -d ${LIBJPEG} |
---|
172 | check_status $? "${LIBJPEG} not present" |
---|
173 | fi |
---|
174 | |
---|
175 | if [ ${do_ttf} = "yes" ] ; then |
---|
176 | test -d ${FREETYPE} |
---|
177 | check_status $? "${FREETYPE} not present" |
---|
178 | fi |
---|
179 | |
---|
180 | if [ ${do_png} = "yes" ] ; then |
---|
181 | test -d ${LIBPNG} |
---|
182 | check_status $? "${LIBPNG} not present" |
---|
183 | fi |
---|
184 | |
---|
185 | if [ ${do_t1} = "yes" ] ; then |
---|
186 | test -d ${T1LIB} |
---|
187 | check_status $? "${T1LIB} not present" |
---|
188 | fi |
---|
189 | |
---|
190 | if [ ${do_tiff} = "yes" ] ; then |
---|
191 | test -d ${TIFFLIB} |
---|
192 | check_status $? "${TIFFLIB} not present" |
---|
193 | fi |
---|
194 | |
---|
195 | if [ ${do_nanox} = "yes" ] ; then |
---|
196 | test -d ${NANOX} |
---|
197 | check_status $? "${NANOX} not present" |
---|
198 | fi |
---|
199 | |
---|
200 | test -d ${RTEMS_MAKEFILE_PATH} |
---|
201 | check_status $? "${RTEMS_MAKEFILE_PATH} not present" |
---|
202 | |
---|
203 | ######### END OF Consistency checks |
---|
204 | |
---|
205 | echo "Generating RTEMS_SETTINGS file..." |
---|
206 | make -f Makefile.settings clean all |
---|
207 | check_status $? Could not generate RTEMS_SETTINGS |
---|
208 | |
---|
209 | . ./RTEMS_SETTINGS |
---|
210 | |
---|
211 | PREFIX=${BSPTOP} |
---|
212 | |
---|
213 | if [ ${verbose} = yes ] ; then |
---|
214 | echo "USING ${PREFIX} for install point!!!" |
---|
215 | fi |
---|
216 | |
---|
217 | case ${BSP} in |
---|
218 | pc386) ;; # can be used to turn on detect svgalib supportable on this BSP |
---|
219 | *) |
---|
220 | esac |
---|
221 | |
---|
222 | ######### Log Directory |
---|
223 | LOGDIR=${BASEDIR}/log |
---|
224 | if [ ! -d ${LOGDIR} ] ; then |
---|
225 | mkdir ${LOGDIR} |
---|
226 | fi |
---|
227 | ######### |
---|
228 | |
---|
229 | ######### Build Directory |
---|
230 | BUILDDIR=${BASEDIR}/build |
---|
231 | if [ ! -d ${BUILDDIR} ] ; then |
---|
232 | mkdir ${BUILDDIR} |
---|
233 | fi |
---|
234 | ######### |
---|
235 | |
---|
236 | ######### Build and install JPEG |
---|
237 | j_jpeg() |
---|
238 | { |
---|
239 | if [ ! -d ${BUILDDIR}/${LIBJPEG} ] ; then |
---|
240 | mkdir ${BUILDDIR}/${LIBJPEG} |
---|
241 | fi |
---|
242 | cd ${BUILDDIR}/${LIBJPEG} |
---|
243 | |
---|
244 | make distclean |
---|
245 | |
---|
246 | CFLAGS="${CPU_CFLAGS}" \ |
---|
247 | ../../${LIBJPEG}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
248 | --includedir=${PREFIX}/lib/include \ |
---|
249 | --disable-shared \ |
---|
250 | --disable-programs |
---|
251 | check_status $? Could not configure ${LIBJPEG} |
---|
252 | |
---|
253 | make |
---|
254 | check_status $? Could not make ${LIBJPEG} |
---|
255 | |
---|
256 | ${sudo_cmd} make install |
---|
257 | check_status $? Could not make install ${LIBJPEG} |
---|
258 | |
---|
259 | if [ ${do_clean} = yes ] ; then |
---|
260 | make distclean |
---|
261 | check_status $? Could not make distclean ${LIBJPEG} |
---|
262 | fi |
---|
263 | |
---|
264 | cd ../.. |
---|
265 | } |
---|
266 | |
---|
267 | if [ ${do_jpeg} = yes ] ; then |
---|
268 | echo "Building ${LIBJPEG} ..." |
---|
269 | j_jpeg # >${LOGDIR}/${TARGET}-${LIBJPEG}.log 2>&1 |
---|
270 | fi |
---|
271 | |
---|
272 | ######### Build and install PNG support |
---|
273 | j_png() |
---|
274 | { |
---|
275 | if [ ! -d ${BUILDDIR}/${LIBPNG} ] ; then |
---|
276 | mkdir ${BUILDDIR}/${LIBPNG} |
---|
277 | fi |
---|
278 | cd ${BUILDDIR}/${LIBPNG} |
---|
279 | |
---|
280 | make distclean |
---|
281 | |
---|
282 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
283 | ../../${LIBPNG}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
284 | --includedir=${PREFIX}/lib/include \ |
---|
285 | --libdir=${PREFIX}/lib \ |
---|
286 | --disable-shared |
---|
287 | check_status $? Could not configure ${LIBPNG} |
---|
288 | |
---|
289 | make |
---|
290 | check_status $? Could not make ${LIBPNG} |
---|
291 | |
---|
292 | ${sudo_cmd} make install |
---|
293 | check_status $? Could not make install ${LIBPNG} |
---|
294 | |
---|
295 | if [ ${do_clean} = yes ] ; then |
---|
296 | make distclean |
---|
297 | check_status $? Could not make distclean ${LIBPNG} |
---|
298 | fi |
---|
299 | |
---|
300 | cd ../.. |
---|
301 | } |
---|
302 | |
---|
303 | if [ ${do_png} = yes ] ; then |
---|
304 | echo "Building ${LIBPNG} ..." |
---|
305 | j_png # >${LOGDIR}/${TARGET}-${LIBPNG}.log 2>&1 |
---|
306 | fi |
---|
307 | |
---|
308 | ######### Build and install TIFF support |
---|
309 | j_tiff() |
---|
310 | { |
---|
311 | if [ ! -d ${BUILDDIR}/${TIFFLIB} ] ; then |
---|
312 | mkdir ${BUILDDIR}/${TIFFLIB} |
---|
313 | fi |
---|
314 | cd ${BUILDDIR}/${TIFFLIB} |
---|
315 | |
---|
316 | make distclean |
---|
317 | |
---|
318 | CFLAGS="${CPU_CFLAGS}" \ |
---|
319 | ../../${TIFFLIB}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
320 | --includedir=${PREFIX}/lib/include \ |
---|
321 | --disable-shared |
---|
322 | check_status $? Could not configure ${TIFFLIB} |
---|
323 | |
---|
324 | make |
---|
325 | check_status $? Could not make ${TIFFLIB} |
---|
326 | |
---|
327 | ${sudo_cmd} make install |
---|
328 | check_status $? Could not make install ${TIFFLIB} |
---|
329 | |
---|
330 | if [ ${do_clean} = yes ] ; then |
---|
331 | make distclean |
---|
332 | check_status $? Could not make distclean ${TIFFLIB} |
---|
333 | fi |
---|
334 | |
---|
335 | cd ../.. |
---|
336 | } |
---|
337 | |
---|
338 | if [ ${do_tiff} = yes ] ; then |
---|
339 | echo "Building ${TIFFLIB} ..." |
---|
340 | j_tiff # >${LOGDIR}/${TARGET}-${TIFFLIB}.log 2>&1 |
---|
341 | fi |
---|
342 | |
---|
343 | ######### Build and install Adobe Type 1 Font support |
---|
344 | j_t1() |
---|
345 | { |
---|
346 | if [ ! -d ${BUILDDIR}/${T1LIB} ] ; then |
---|
347 | mkdir ${BUILDDIR}/${T1LIB} |
---|
348 | else |
---|
349 | rm -r ${BUILDDIR}/${T1LIB} |
---|
350 | mkdir ${BUILDDIR}/${T1LIB} |
---|
351 | fi |
---|
352 | cd ${BUILDDIR}/${T1LIB} |
---|
353 | |
---|
354 | cp -r ../../${T1LIB}/* . |
---|
355 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
356 | ../../${T1LIB}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
357 | --includedir=${PREFIX}/lib/include \ |
---|
358 | --datadir=${PREFIX}/share \ |
---|
359 | --disable-shared \ |
---|
360 | --without-athena --without-x |
---|
361 | check_status $? Could not configure ${T1LIB} |
---|
362 | |
---|
363 | make without_doc |
---|
364 | check_status $? Could not make ${T1LIB} |
---|
365 | |
---|
366 | ${sudo_cmd} make install |
---|
367 | check_status $? Could not make install ${T1LIB} |
---|
368 | |
---|
369 | if [ ${do_clean} = yes ] ; then |
---|
370 | make distclean |
---|
371 | check_status $? Could not make distclean ${T1LIB} |
---|
372 | fi |
---|
373 | |
---|
374 | cd ../.. |
---|
375 | } |
---|
376 | |
---|
377 | if [ ${do_t1} = yes ] ; then |
---|
378 | echo "Building ${T1LIB}..." |
---|
379 | j_t1 # >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1 |
---|
380 | fi |
---|
381 | |
---|
382 | ######### Build and install Truetype Font support |
---|
383 | j_ttf() |
---|
384 | { |
---|
385 | if [ ! -d ${BUILDDIR}/${FREETYPE} ] ; then |
---|
386 | mkdir ${BUILDDIR}/${FREETYPE} |
---|
387 | fi |
---|
388 | cd ${BUILDDIR}/${FREETYPE} |
---|
389 | |
---|
390 | make distclean |
---|
391 | |
---|
392 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
393 | ../../${FREETYPE}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
394 | --includedir=${PREFIX}/lib/include \ |
---|
395 | --disable-shared |
---|
396 | check_status $? Could not configure ${FREETYPE} |
---|
397 | |
---|
398 | make |
---|
399 | check_status $? Could not make ${FREETYPE} |
---|
400 | |
---|
401 | ${sudo_cmd} make install |
---|
402 | check_status $? Could not make install ${FREETYPE} |
---|
403 | |
---|
404 | if [ ${do_clean} = yes ] ; then |
---|
405 | make distclean |
---|
406 | check_status $? Could not make distclean ${FREETYPE} |
---|
407 | fi |
---|
408 | |
---|
409 | cd ../.. |
---|
410 | } |
---|
411 | |
---|
412 | if [ ${do_ttf} = yes ] ; then |
---|
413 | echo "Building ${FREETYPE} ..." |
---|
414 | j_ttf # >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1 |
---|
415 | fi |
---|
416 | |
---|
417 | ######### Build and install Nano-X support |
---|
418 | j_nanox() |
---|
419 | { |
---|
420 | if [ ! -d ${BUILDDIR}/${NANOX}/src ] ; then |
---|
421 | mkdir -p ${BUILDDIR}/${NANOX}/src |
---|
422 | else |
---|
423 | rm -r ${BUILDDIR}/${NANOX}/src |
---|
424 | mkdir -p ${BUILDDIR}/${NANOX}/src |
---|
425 | fi |
---|
426 | cd ${BUILDDIR}/${NANOX}/src |
---|
427 | |
---|
428 | cp -r ../../../${NANOX}/src/* . |
---|
429 | |
---|
430 | # RTEMS_MAKEFILE_PATH inherited |
---|
431 | export RTEMS_MAKEFILE_PATH |
---|
432 | |
---|
433 | make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems -k all |
---|
434 | check_status $? Could not make ${NANOX} |
---|
435 | |
---|
436 | ${sudo_cmd} make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems install |
---|
437 | check_status $? Could not make install ${NANOX} |
---|
438 | |
---|
439 | if [ ${do_clean} = yes ] ; then |
---|
440 | make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems clean |
---|
441 | check_status $? Could not make distclean ${NANOX} |
---|
442 | fi |
---|
443 | |
---|
444 | cd ../../.. |
---|
445 | } |
---|
446 | |
---|
447 | if [ ${do_nanox} = yes ] ; then |
---|
448 | echo "Building ${NANOX} ..." |
---|
449 | j_nanox # >${LOGDIR}/${TARGET}-${NANOX}.log 2>&1 |
---|
450 | fi |
---|
451 | |
---|
452 | |
---|
453 | ######### Build and install NXLIB support |
---|
454 | j_nxlib() |
---|
455 | { |
---|
456 | if [ ! -d ${BUILDDIR}/${NXLIB} ] ; then |
---|
457 | mkdir ${BUILDDIR}/${NXLIB} |
---|
458 | else |
---|
459 | rm -r ${BUILDDIR}/${NXLIB} |
---|
460 | mkdir ${BUILDDIR}/${NXLIB} |
---|
461 | fi |
---|
462 | cd ${BUILDDIR}/${NXLIB} |
---|
463 | |
---|
464 | cp -r ../../${NXLIB}/* . |
---|
465 | |
---|
466 | # RTEMS_MAKEFILE_PATH inherited |
---|
467 | export RTEMS_MAKEFILE_PATH |
---|
468 | |
---|
469 | make -f Makefile.rtems distclean |
---|
470 | |
---|
471 | make -f Makefile.rtems |
---|
472 | check_status $? Could not make ${NXLIB} |
---|
473 | |
---|
474 | ${sudo_cmd} make -f Makefile.rtems install |
---|
475 | check_status $? Could not make install ${NXLIB} |
---|
476 | |
---|
477 | if [ ${do_clean} = yes ] ; then |
---|
478 | make -f Makefile.rtems distclean |
---|
479 | check_status $? Could not make distclean ${NXLIB} |
---|
480 | fi |
---|
481 | |
---|
482 | cd ../.. |
---|
483 | } |
---|
484 | |
---|
485 | if [ ${do_nxlib} = yes ] ; then |
---|
486 | echo "Building ${NXLIB} ..." |
---|
487 | j_nxlib # >${LOGDIR}/${TARGET}-${NXLIB}.log 2>&1 |
---|
488 | fi |
---|
489 | |
---|
490 | |
---|
491 | ######### Build and install FLTK support |
---|
492 | j_fltk() |
---|
493 | { |
---|
494 | if [ ! -d ${BUILDDIR}/${FLTK} ] ; then |
---|
495 | mkdir ${BUILDDIR}/${FLTK} |
---|
496 | else |
---|
497 | rm -r ${BUILDDIR}/${FLTK} |
---|
498 | mkdir ${BUILDDIR}/${FLTK} |
---|
499 | fi |
---|
500 | cd ${BUILDDIR}/${FLTK} |
---|
501 | |
---|
502 | cp -r ../../${FLTK}/* . |
---|
503 | |
---|
504 | make distclean |
---|
505 | |
---|
506 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
507 | ../../${FLTK}/configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
508 | --includedir="${BSPTOP}/lib/include" --libdir="${BSPTOP}/lib"\ |
---|
509 | --x-includes="${BSPTOP}/lib/include" --x-libraries="${BSPTOP}/lib" \ |
---|
510 | --disable-xft --disable-xinerama --disable-xdbe \ |
---|
511 | --disable-shared --disable-gl |
---|
512 | |
---|
513 | check_status $? Could not configure ${FLTK} |
---|
514 | |
---|
515 | make -k |
---|
516 | check_status $? Could not make ${FLTK} |
---|
517 | |
---|
518 | ${sudo_cmd} make install |
---|
519 | check_status $? Could not make install ${FLTK} |
---|
520 | |
---|
521 | if [ ${do_clean} = yes ] ; then |
---|
522 | make distclean |
---|
523 | check_status $? Could not make distclean ${FLTK} |
---|
524 | fi |
---|
525 | |
---|
526 | cd .. |
---|
527 | } |
---|
528 | |
---|
529 | if [ ${do_fltk} = yes ] ; then |
---|
530 | echo "Building ${FLTK} ..." |
---|
531 | j_fltk # >${LOGDIR}/${TARGET}-${FLTK}.log 2>&1 |
---|
532 | fi |
---|
533 | |
---|
534 | exit 0 |
---|