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