source: rtems-graphics-toolkit/do_it @ 9183239

Last change on this file since 9183239 was 9183239, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 08/20/12 at 19:01:48

Minor script problem

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