Changeset 8c14de8 in rtems-graphics-toolkit


Ignore:
Timestamp:
Jan 8, 2010, 6:53:10 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
35c1f65
Parents:
504de3c
Message:

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

  • do_it: Complete rewrite.
  • VERSIONS: New file.
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r504de3c r8c14de8  
     12010-01-08      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * do_it: Complete rewrite.
     4        * VERSIONS: New file.
     5
    162009-12-27      Joel Sherrill <joel.sherrill@oarcorp.com>
    27
  • do_it

    r504de3c r8c14de8  
    1 #! /bin/sh
     1#! /bin/sh
     2#
     3#  Script to help build RTEMS Graphics Toolkit
    24#
    35#  $Id$
    46#
    57
    6 test_exit()
    7 {
    8   exit_code=$1
    9   exit $exit_code
    10 }
    11 
    12 progname=${0##*/}        # fast basename hack for ksh, bash
    13 
    14 USAGE=\
    15 "usage: $progname [ -opts ] test [ test ... ]
    16 "
    17 
    18 check_status()
    19 {
    20   if [ $1 -ne 0 ] ; then
    21     shift
    22     echo "FAILED: " "$*" >&2
    23     exit 1
    24   fi
    25 }
    26 
     8BASEDIR=`dirname $0`
     9
     10vfile=`dirname $0`/VERSIONS
     11if [ ! -r ${vfile} ] ; then
     12  echo VERSIONS file not found
     13  exit 1
     14fi
    2715
    2816if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then
     
    3119fi
    3220
     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
    33157echo "Generating RTEMS_SETTINGS file..."
    34158make -f Makefile.settings clean all
     
    39163PREFIX=${BSPTOP}
    40164
    41 echo WARNING USING ${PREFIX} for install point!!!
    42 
    43 do_step()
    44 {
    45   case $1 in
    46     rmlogs)
    47       rm -f */build.log */c.log */clean.log */distclean.log */install.log
    48       ;;
    49     configure)
    50       echo "configuring jpeg-7 ..."
    51       cd jpeg-7
    52       CFLAGS="${CPU_CFLAGS}" \
    53          ./configure --host=${TARGET} --prefix=${PREFIX} \
    54          --includedir=${PREFIX}/lib/include \
    55          --disable-shared \
    56          --disable-programs \
    57          >c.log 2>&1
    58       check_status $? Could not configure jpeg-7
    59 
    60       cd ../tiff-3.9.2
    61       check_status $? Could not cd to tiff-3.9.2
    62 
    63       echo "configuring tiff-3.9.2 ..."
    64       CFLAGS="${CPU_CFLAGS}" \
    65          ./configure --host=${TARGET} --prefix=${PREFIX} \
    66          --includedir=${PREFIX}/lib/include \
    67          --disable-shared \
    68          >c.log 2>&1
    69       check_status $? Could not configure tiff-3.9.2
    70 
    71       cd ../libpng-1.2.41
    72       echo "configuring libpng-1.2.41 ..."
    73       # include BSP_CFLAGS so it sees libz
    74       CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
    75          ./configure --host=${TARGET} --prefix=${PREFIX} \
    76          --includedir=${PREFIX}/lib/include \
    77          --disable-shared \
    78          >c.log 2>&1
    79       check_status $? Could not configure libpng-1.2.41
    80 
    81       cd ../freetype-2.3.11
    82       echo "configuring freetype-2.3.11 ..."
    83       # include BSP_CFLAGS so it sees libz
    84       CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
    85          ./configure --host=${TARGET} --prefix=${PREFIX} \
    86          --includedir=${PREFIX}/lib/include \
    87          --disable-shared \
    88          >c.log 2>&1
    89       check_status $? Could not configure freetype-2.3.11
    90 
    91       cd ../t1lib-5.1.2
    92       echo "configuring t1lib-5.1.2 ..."
    93       # include BSP_CFLAGS so it sees libz
    94       CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \
    95          ./configure --host=${TARGET} --prefix=${PREFIX} \
    96          --includedir=${PREFIX}/lib/include \
    97          --datadir=${PREFIX}/share \
    98          --disable-shared \
    99          --without-athena --without-x \
    100          >c.log 2>&1
    101       check_status $? Could not configure t1lib-5.1.2
    102 
    103       cd ..
    104       ;;
    105     build|clean|distclean|install)
    106       action=${1}
    107       if [ ${1} = build ] ; then
    108         action=
    109       fi
    110 
    111       for d in jpeg-7 tiff-3.9.2 libpng-1.2.41 freetype-2.3.11 t1lib-5.1.2
    112       do
    113         echo "Performing ${1} on ${d} ..."
    114 
    115         cd ${d}
    116         check_status $? Could not cd to ${d}
    117         make ${action} >${1}.log 2>&1
    118 
    119         if [ ${1} != distclean ] ; then
    120           check_status $? Could not ${1} in ${d}
    121         fi
    122         #if [ ${1} = distclean ] ; then
    123         #  rm -f build.log c.log clean.log distclean.log
    124         #fi
    125         cd ..
    126       done
    127 
    128       echo "Performing ${1} on rtems-nano-x ..."
    129       case $1 in
    130         build|clean|install)
    131           #cd rtems-nano-x
    132           #make -C microwin/src -f Makefile.rtems ${action}
    133           #check_status $? Could not ${1} in rtems-nano-x
    134           #cd ..
    135           ;;
    136         *)
    137           ;;
    138       esac
    139       ;;
    140     *)
    141       check_status 1 Unknown action ${1}
    142       ;;
    143   esac
    144 }
    145 
    146 for a in $*
    147 do
    148   do_step ${a}
    149 done
     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
    150324
    151325exit 0
Note: See TracChangeset for help on using the changeset viewer.