source: rtems-graphics-toolkit/do_it @ ea5988b

Last change on this file since ea5988b was ea5988b, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 07/12/12 at 14:53:05

Added option for sudo make install to do_it

  • Property mode set to 100755
File size: 10.0 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  CFLAGS="${CPU_CFLAGS}" \
221     ./configure --host=${TARGET} --prefix=${PREFIX} \
222     --includedir=${PREFIX}/lib/include \
223     --disable-shared \
224     --disable-programs
225  check_status $? Could not configure ${LIBJPEG}
226
227  make
228  check_status $? Could not make ${LIBJPEG}
229
230  ${sudo_cmd}  make install
231  check_status $? Could not make install ${LIBJPEG}
232
233  if [ ${do_clean} = yes ] ; then
234    make distclean
235    check_status $? Could not make distclean ${LIBJPEG}
236  fi
237
238  cd ..
239}
240
241if [ ${do_jpeg} = yes ] ; then
242  echo "Building ${LIBJPEG} ..."
243  j_jpeg
244fi
245
246######### Build and install PNG support
247j_png()
248{
249  cd ${LIBPNG}
250  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
251     ./configure --host=${TARGET} --prefix=${PREFIX} \
252     --includedir=${PREFIX}/lib/include \
253     --libdir=${PREFIX}/lib \
254     --disable-shared
255  check_status $? Could not configure ${LIBPNG}
256
257  make
258  check_status $? Could not make ${LIBPNG}
259
260  ${sudo_cmd}  make install
261  check_status $? Could not make install ${LIBPNG}
262
263  if [ ${do_clean} = yes ] ; then
264    make distclean
265    check_status $? Could not make distclean ${LIBPNG}
266  fi
267
268  cd ..
269}
270
271if [ ${do_png} = yes ] ; then
272  echo "Building ${LIBPNG} ..."
273  j_png
274fi
275
276######### Build and install TIFF support
277j_tiff()
278{
279  cd ${TIFFLIB}
280  CFLAGS="${CPU_CFLAGS}" \
281     ./configure --host=${TARGET} --prefix=${PREFIX} \
282     --includedir=${PREFIX}/lib/include \
283     --disable-shared
284  check_status $? Could not configure ${TIFFLIB}
285
286  make
287  check_status $? Could not make ${TIFFLIB}
288
289  ${sudo_cmd}  make install
290  check_status $? Could not make install ${TIFFLIB}
291
292  if [ ${do_clean} = yes ] ; then
293    make distclean
294    check_status $? Could not make distclean ${TIFFLIB}
295  fi
296
297  cd ..
298}
299
300if [ ${do_tiff} = yes ] ; then
301  echo "Building ${TIFFLIB} ..."
302  j_tiff
303fi
304
305######### Build and install Adobe Type 1 Font support
306j_t1()
307{
308  cd ${T1LIB}
309  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
310     ./configure --host=${TARGET} --prefix=${PREFIX} \
311     --includedir=${PREFIX}/lib/include \
312     --datadir=${PREFIX}/share \
313     --disable-shared \
314     --without-athena --without-x
315  check_status $? Could not configure ${T1LIB}
316
317  make
318  check_status $? Could not make ${T1LIB}
319
320  ${sudo_cmd}  make install
321  check_status $? Could not make install ${T1LIB}
322
323  if [ ${do_clean} = yes ] ; then
324    make distclean
325    check_status $? Could not make distclean ${T1LIB}
326  fi
327
328  cd ..
329}
330
331if [ ${do_t1} = yes ] ; then
332  echo "Building ${T1LIB}..."
333  j_t1 >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1
334fi
335
336######### Build and install Truetype Font support
337j_ttf()
338{
339  cd ${FREETYPE}
340  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
341     ./configure --host=${TARGET} --prefix=${PREFIX} \
342     --includedir=${PREFIX}/lib/include \
343     --disable-shared
344  check_status $? Could not configure ${FREETYPE}
345
346  make
347  check_status $? Could not make ${FREETYPE}
348
349  ${sudo_cmd}  make install
350  check_status $? Could not make install ${FREETYPE}
351
352  if [ ${do_clean} = yes ] ; then
353    make distclean
354    check_status $? Could not make distclean ${FREETYPE}
355  fi
356
357  cd ..
358}
359
360if [ ${do_ttf} = yes ] ; then
361  echo "Building ${FREETYPE} ..."
362  j_ttf #>${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1
363fi
364
365######### Build and install Nano-X support
366j_nanox()
367{
368  cd ${NANOX}/src
369
370  # RTEMS_MAKEFILE_PATH inherited
371  export RTEMS_MAKEFILE_PATH
372
373  make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems
374  check_status $? Could not make ${NANOX}
375
376  ${sudo_cmd}  make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems install
377  check_status $? Could not make install ${NANOX}
378
379  if [ ${do_clean} = yes ] ; then
380    make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems clean
381    check_status $? Could not make distclean ${NANOX}
382  fi
383
384  cd ../..
385}
386
387if [ ${do_nanox} = yes ] ; then
388  echo "Building ${NANOX} ..."
389  j_nanox #>${LOGDIR}/${TARGET}-${NANOX}.log 2>&1
390fi
391
392
393######### Build and install NXLIB support
394j_nxlib()
395{
396  cd ${NXLIB}
397
398  # RTEMS_MAKEFILE_PATH inherited
399  export RTEMS_MAKEFILE_PATH
400
401  make -f Makefile.rtems
402  check_status $? Could not make ${NXLIB}
403
404  ${sudo_cmd}  make -f Makefile.rtems install
405  check_status $? Could not make install ${NXLIB}
406
407  if [ ${do_clean} = yes ] ; then
408    make -f Makefile.rtems clean
409    check_status $? Could not make distclean ${NXLIB}
410  fi
411
412  cd ../..
413}
414
415if [ ${do_nxlib} = yes ] ; then
416  echo "Building ${NXLIB} ..."
417  j_nxlib #>${LOGDIR}/${TARGET}-${NXLIB}.log 2>&1
418fi
419
420
421######### Build and install FLTK support
422j_fltk()
423{
424  cd ${FLTK}
425  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
426     ./configure --host=${TARGET} --prefix=${PREFIX} \
427     --x-includes="${BSPTOP}/lib/include" --x-libraries="${BSPTOP}/lib" \
428     --disable-xft --disable-xinerama --disable-xdbe \
429     --disable-shared
430  check_status $? Could not configure ${FLTK}
431
432  make -k
433  check_status $? Could not make ${FLTK}
434
435  ${sudo_cmd}  make install
436  check_status $? Could not make install ${FLTK}
437
438  if [ ${do_clean} = yes ] ; then
439    make distclean
440    check_status $? Could not make distclean ${FLTK}
441  fi
442
443  cd ..
444}
445
446if [ ${do_fltk} = yes ] ; then
447  echo "Building ${FLTK} ..."
448  echo "SKIPPING ${FLTK} ..."
449  j_fltk # >${LOGDIR}/${TARGET}-${FLTK}.log 2>&1
450fi
451
452exit 0
Note: See TracBrowser for help on using the repository browser.