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

Last change on this file since 0b5c029 was 0b5c029, checked in by Chirayu Desai <cdesai@…>, on Dec 28, 2013 at 4:22:08 PM

do_it: Add a build-only option

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