"Fossies" - the Fresh Open Source Software Archive

Member "di-4.47.2/mkconfig/bin/mkreqlib.sh" (30 Oct 2019, 2062 Bytes) of package /linux/privat/di-4.47.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "mkreqlib.sh": 4.44_vs_4.45.

    1 #!/bin/sh
    2 #
    3 # Copyright 2009-2018 Brad Lanam Walnut Creek, CA USA
    4 #
    5 
    6 set -f
    7 
    8 unset CDPATH
    9 # this is a workaround for ksh93 on solaris
   10 if [ "$1" = "-d" ]; then
   11   cd $2
   12   shift
   13   shift
   14 fi
   15 . ${_MKCONFIG_DIR}/bin/shellfuncs.sh
   16 doshelltest $0 $@
   17 
   18 RUNTOPDIR=`pwd`
   19 CACHEFILE="mkconfig.cache"
   20 
   21 unset GREP_OPTIONS
   22 unset ENV
   23 
   24 getlibdata () {
   25     var=$1
   26     gdname=$2
   27     lang=$3
   28 
   29     cmd="${var}=\${mkc_${lang}_lib_${gdname}}"
   30     eval $cmd
   31 }
   32 
   33 mkconfigversion
   34 
   35 debug=F
   36 OUTLIBFILE="mkconfig.reqlibs"
   37 while test $# -gt 1; do
   38   case $1 in
   39     -X)
   40       shift
   41       debug=T
   42       ;;
   43     -c)
   44       shift
   45       CACHEFILE=$1
   46       shift
   47       ;;
   48     -o|-l)   # -l backwards compatibility
   49       shift
   50       OUTLIBFILE=$1
   51       shift
   52       ;;
   53   esac
   54 done
   55 
   56 CONFH=$1
   57 
   58 ok=1
   59 if [ ! -f "${CONFH}" ]; then
   60   echo "Unable to locate ${CONFH}"
   61   ok=0
   62 fi
   63 if [ ! -f "$RUNTOPDIR/$CACHEFILE" ]; then
   64   echo "Unable to locate $RUNTOPDIR/$CACHEFILE"
   65   ok=0
   66 fi
   67 if [ $ok -eq 0 ]; then
   68   exit 1
   69 fi
   70 
   71 reqlibs=""
   72 . $RUNTOPDIR/$CACHEFILE
   73 
   74 exec 7<&0 < ${CONFH}
   75 dver=0
   76 while read cline; do
   77   if [ $debug = T ]; then
   78     echo "cline:$cline:"
   79   fi
   80   case $cline in
   81     "#define _lib_"*1)
   82       lang=c
   83       ;;
   84     "enum bool _clib_"*" = true;")
   85       lang=d
   86       dver=2
   87       ;;
   88     "enum bool _lib_"*" = true;")
   89       lang=d
   90       dver=2
   91       ;;
   92     "enum : bool { _clib_"*" = true };")
   93       lang=d
   94       dver=1
   95       ;;
   96     "enum : bool { _lib_"*" = true };")
   97       lang=d
   98       dver=1
   99       ;;
  100     *)
  101       continue
  102       ;;
  103   esac
  104 
  105   # bash2 can't handle # in subst
  106   if [ $lang = "d" -a $dver -eq 1 ]; then
  107     dosubst cline ': ' '' '{ ' '' ' }' ''
  108   fi
  109   dosubst cline '#define ' '' ' 1' '' ' = true;' '' 'enum bool ' ''
  110   getlibdata var $cline $lang
  111   if [ $debug = T ]; then
  112     echo "cline:$cline:lang:$lang:var:$var:"
  113   fi
  114   if [ "$var" != "" ]; then
  115     echo $reqlibs | grep -- $var > /dev/null 2>&1
  116     rc=$?
  117     if [ $rc -ne 0 ]; then
  118       doappend reqlibs " $var"
  119       if [ $debug = T ]; then
  120         echo "append:$var"
  121       fi
  122     fi
  123   fi
  124 done
  125 exec <&7 7<&-
  126 echo $reqlibs > $OUTLIBFILE