source: rtems-graphics-toolkit/do_it @ 0d32a9c

Last change on this file since 0d32a9c was 0d32a9c, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 07/08/12 at 12:58:18

Added NXLib and fltk to script (some debug info remains in script)

  • Property mode set to 100755
File size: 9.7 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# Are we noisy when running?
46verbose="no"
47######################## Parse arguments ###########################
48
49usage()
50{
51cat <<EOF
52do_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
65NOTES:
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.
70EOF
71}
72
73fatal()
74{
75  usage
76  exit 1
77}
78
79check_status()
80{
81  if [ $1 -ne 0 ] ; then
82    shift
83    echo "ERROR: $*" >&2
84    exit 1
85  fi
86}
87
88toggle()
89{
90  case $1 in
91    no)  echo "yes" ;;
92    yes) echo "no" ;;
93    *)   fatal "Unknown value to toggle ($1)" ;;
94  esac
95}
96
97while getopts Ajpt1Tnfcv OPT
98do
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
121done
122
123shiftcount=`expr $OPTIND - 1`
124shift $shiftcount
125
126if [ ${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 ""
150fi
151
152######### START OF Consistency checks
153
154if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then
155  echo RTEMS_MAKEFILE_PATH not set
156  exit 1
157fi
158
159# XXX TBD check if enabled before checking if present?
160test -d ${LIBJPEG}
161check_status $? "${LIBJPEG} not present"
162test -d ${FREETYPE}
163check_status $? "${FREETYPE} not present"
164test -d ${LIBPNG}
165check_status $? "${LIBPNG} not present"
166test -d ${T1LIB}
167check_status $? "${T1LIB} not present"
168test -d ${TIFFLIB}
169check_status $? "${TIFFLIB} not present"
170test -d ${NANOX}
171check_status $? "${NANOX} not present"
172test -d ${NXLIB}
173check_status $? "${NXLIB} not present"
174
175test -d ${RTEMS_MAKEFILE_PATH}
176check_status $? "${RTEMS_MAKEFILE_PATH} not present"
177
178######### END OF Consistency checks
179
180echo "Generating RTEMS_SETTINGS file..."
181make -f Makefile.settings clean all
182check_status $? Could not generate RTEMS_SETTINGS
183
184source ./RTEMS_SETTINGS
185
186PREFIX=${BSPTOP}
187
188if [ ${verbose} = yes ] ; then
189  echo "USING ${PREFIX} for install point!!!"
190fi
191
192case ${BSP} in
193  pc386) ;; # can be used to turn on detect svgalib supportable on this BSP
194  *)
195esac
196
197######### Log Directory
198LOGDIR=${BASEDIR}/log
199if [ ! -d ${LOGDIR} ] ; then
200  mkdir ${LOGDIR}
201fi
202#########
203
204######### Build and install JPEG
205j_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
229if [ ${do_jpeg} = yes ] ; then
230  echo "Building ${LIBJPEG} ..."
231  j_jpeg
232fi
233
234######### Build and install PNG support
235j_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
259if [ ${do_png} = yes ] ; then
260  echo "Building ${LIBPNG} ..."
261  j_png
262fi
263
264######### Build and install TIFF support
265j_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
288if [ ${do_tiff} = yes ] ; then
289  echo "Building ${TIFFLIB} ..."
290  j_tiff
291fi
292
293######### Build and install Adobe Type 1 Font support
294j_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
319if [ ${do_t1} = yes ] ; then
320  echo "Building ${T1LIB}..."
321  j_t1 >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1
322fi
323
324######### Build and install Truetype Font support
325j_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
348if [ ${do_ttf} = yes ] ; then
349  echo "Building ${FREETYPE} ..."
350  j_ttf >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1
351fi
352
353######### Build and install Nano-X support
354j_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
375if [ ${do_nanox} = yes ] ; then
376  echo "Building ${NANOX} ..."
377  j_nanox >${LOGDIR}/${TARGET}-${NANOX}.log 2>&1
378fi
379
380
381######### Build and install NXLIB support
382j_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
403if [ ${do_nxlib} = yes ] ; then
404  echo "Building ${NXLIB} ..."
405  j_nxlib >${LOGDIR}/${TARGET}-${NXLIB}.log 2>&1
406fi
407
408
409######### Build and install FLTK support
410j_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
434if [ ${do_fltk} = yes ] ; then
435  echo "Building ${FLTK} ..."
436  echo "SKIPPING ${FLTK} ..."
437  # j_fltk >${LOGDIR}/${TARGET}-${FLTK}.log 2>&1
438fi
439
440exit 0
Note: See TracBrowser for help on using the repository browser.