source: rtems-graphics-toolkit/do_it @ 8c14de8

Last change on this file since 8c14de8 was 8c14de8, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/10 at 18:53:10

2010-01-08 Joel Sherrill <joel.sherrill@…>

  • do_it: Complete rewrite.
  • VERSIONS: New file.
  • Property mode set to 100755
File size: 6.8 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
16if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then
17  echo RTEMS_MAKEFILE_PATH not set
18  exit 1
19fi
20
21source ${vfile}
22
23if [ X${LIBJPEG} = X ] ; then
24  echo VERSION FILE NOT CORRECT
25  exit 1
26fi
27
28######################## Set defaults #############################
29# Do we clean after build and install
30do_clean="no"
31# Do we build jpeg support?
32do_jpeg="no"
33# Do we build png support?
34do_png="no"
35# Do we build tiff support?
36do_tiff="no"
37# Do we build Adobe Type 1 Font support?
38do_t1="no"
39# Do we build Truetype Font support?
40do_ttf="no"
41# Are we noisy when running?
42verbose="no"
43######################## Parse arguments ###########################
44
45usage()
46{
47cat <<EOF
48do_one [options] CPU BSP
49  -A - build and install all libraries
50  -j - build JPEG support (default=no)
51  -p - build PNG support (default=no)
52  -t - build TIFF support (default=no)
53  -1 - build Adobe Type 1 font support (default=no)
54  -T - build Truetype font support (default=no)
55  -c - clean after building (default=no)
56  -v - verbose
57
58NOTES:
59  + Use of each option toggles the setting.  For example, \"-v -v -A -1\"
60    results in verbose=no and all steps done except Type 1 fonts.
61EOF
62}
63
64fatal()
65{
66  usage
67  exit 1
68}
69
70check_status()
71{
72  if [ $1 -ne 0 ] ; then
73    shift
74    echo "ERROR: $*" >&2
75    exit 1
76  fi
77}
78
79toggle()
80{
81  case $1 in
82    no)  echo "yes" ;;
83    yes) echo "no" ;;
84    *)   fatal "Unknown value to toggle ($1)" ;;
85  esac
86}
87
88while getopts Ajpt1Tv OPT
89do
90    case "$OPT" in
91      A) do_jpeg="yes"
92         do_png="yes"
93         do_tiff="yes"
94         do_t1="yes"
95         do_ttf="yes"
96         ;;
97      j) do_jpeg=`toggle ${do_jpeg}` ;;
98      p) do_png=`toggle ${do_png}` ;;
99      t) do_tiff=`toggle ${do_tiff}` ;;
100      1) do_t1=`toggle ${do_t1}` ;;
101      T) do_ttf=`toggle ${do_ttf}` ;;
102      c) do_clean=`toggle ${do_clean}` ;;
103      v) verbose=`toggle ${verbose}` ;;
104      *) fatal;;
105    esac
106done
107
108########################### Grab CPU/BSP ###########################
109
110shiftcount=`expr $OPTIND - 1`
111shift $shiftcount
112
113cpu=${1}
114bsp=${2}
115
116case ${cpu} in
117  m32c)
118    do_ada=no
119    do_cxx=no
120    run_acats=no
121    echo M32C does not support C++ or Ada
122    ;;
123  *);;
124esac
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 "Adobe Type 1 Font Library   : " ${T1LIB}
137  echo "JPEG Library                : " ${do_t1}
138  echo "Clean after instal          : " ${do_clean}
139fi
140
141test -d ${LIBJPEG}
142check_status $? "${LIBJPEG} not present"
143test -d ${FREETYPE}
144check_status $? "${FREETYPE} not present"
145test -d ${LIBPNG}
146check_status $? "${LIBPNG} not present"
147test -d ${T1LIB}
148check_status $? "${T1LIB} not present"
149test -d ${TIFFLIB}
150check_status $? "${TIFFLIB} not present"
151
152test -d ${RTEMS_MAKEFILE_PATH}
153check_status $? "${RTEMS_MAKEFILE_PATH} not present"
154
155######### END OF Consistency checks
156
157echo "Generating RTEMS_SETTINGS file..."
158make -f Makefile.settings clean all
159check_status $? Could not generate RTEMS_SETTINGS
160
161source ./RTEMS_SETTINGS
162
163PREFIX=${BSPTOP}
164
165if [ ${verbose} = yes ] ; then
166  echo "USING ${PREFIX} for install point!!!"
167fi
168
169
170######### Log Directory
171LOGDIR=${BASEDIR}/log
172if [ ! -d ${LOGDIR} ] ; then
173  mkdir ${LOGDIR}
174fi
175#########
176
177######### Build and install JPEG
178j_jpeg()
179{
180  cd ${LIBJPEG}
181  CFLAGS="${CPU_CFLAGS}" \
182     ./configure --host=${TARGET} --prefix=${PREFIX} \
183     --includedir=${PREFIX}/lib/include \
184     --disable-shared \
185     --disable-programs
186  check_status $? Could not configure ${LIBJPEG}
187
188  make
189  check_status $? Could not make ${LIBJPEG}
190
191  make install
192  check_status $? Could not make isntall ${LIBJPEG}
193
194  if [ ${do_clean} = yes ] ; then
195    make distclean
196    check_status $? Could not make distclean ${LIBJPEG}
197  fi
198
199  cd ..
200}
201
202if [ ${do_jpeg} = yes ] ; then
203  echo "Building ${LIBJPEG} ..."
204  j_jpeg >${LOGDIR}/${TARGET}-${LIBJPEG}.log 2>&1
205fi
206
207######### Build and install PNG support
208j_png()
209{
210  cd ${LIBPNG}
211  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
212     ./configure --host=${TARGET} --prefix=${PREFIX} \
213     --includedir=${PREFIX}/lib/include \
214     --disable-shared
215  check_status $? Could not configure ${LIBPNG}
216
217  make
218  check_status $? Could not make ${LIBPNG}
219
220  make install
221  check_status $? Could not make isntall ${LIBPNG}
222
223  if [ ${do_clean} = yes ] ; then
224    make distclean
225    check_status $? Could not make distclean ${LIBPNG}
226  fi
227
228  cd ..
229}
230
231if [ ${do_png} = yes ] ; then
232  echo "Building ${LIBPNG} ..."
233  j_png >${LOGDIR}/${TARGET}-${LIBPNG}.log 2>&1
234fi
235
236######### Build and install TIFF support
237j_tiff()
238{
239  cd ${TIFFLIB}
240  CFLAGS="${CPU_CFLAGS}" \
241     ./configure --host=${TARGET} --prefix=${PREFIX} \
242     --includedir=${PREFIX}/lib/include \
243     --disable-shared
244  check_status $? Could not configure ${TIFFLIB}
245
246  make
247  check_status $? Could not make ${TIFFLIB}
248
249  make install
250  check_status $? Could not make isntall ${TIFFLIB}
251
252  if [ ${do_clean} = yes ] ; then
253    make distclean
254    check_status $? Could not make distclean ${TIFFLIB}
255  fi
256
257  cd ..
258}
259
260if [ ${do_tiff} = yes ] ; then
261  echo "Building ${TIFFLIB} ..."
262  j_tiff >${LOGDIR}/${TARGET}-${TIFFLIB}.log 2>&1
263fi
264
265######### Build and install Adobe Type 1 Font support
266j_t1()
267{
268  cd ${T1LIB}
269  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
270     ./configure --host=${TARGET} --prefix=${PREFIX} \
271     --includedir=${PREFIX}/lib/include \
272     --datadir=${PREFIX}/share \
273     --disable-shared \
274     --without-athena --without-x
275  check_status $? Could not configure ${T1LIB}
276
277  make
278  check_status $? Could not make ${T1LIB}
279
280  make install
281  check_status $? Could not make isntall ${T1LIB}
282
283  if [ ${do_clean} = yes ] ; then
284    make distclean
285    check_status $? Could not make distclean ${T1LIB}
286  fi
287
288  cd ..
289}
290
291if [ ${do_t1} = yes ] ; then
292  echo "Building ${T1LIB}..."
293  j_t1 >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1
294fi
295
296######### Build and install Truetype Font support
297j_ttf()
298{
299  cd ${FREETYPE}
300  CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
301     ./configure --host=${TARGET} --prefix=${PREFIX} \
302     --includedir=${PREFIX}/lib/include \
303     --disable-shared
304  check_status $? Could not configure ${FREETYPE}
305
306  make
307  check_status $? Could not make ${FREETYPE}
308
309  make install
310  check_status $? Could not make isntall ${FREETYPE}
311
312  if [ ${do_clean} = yes ] ; then
313    make distclean
314    check_status $? Could not make distclean ${FREETYPE}
315  fi
316
317  cd ..
318}
319
320if [ ${do_ttf} = yes ] ; then
321  echo "Building ${FREETYPE} ..."
322  j_ttf >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1
323fi
324
325exit 0
Note: See TracBrowser for help on using the repository browser.