Annotation of embedaddon/ntp/build, revision 1.1.1.1

1.1       misho       1: #! /bin/sh
                      2: 
                      3: LOGF=make.log
                      4: IAM=`hostname || uname -n`
                      5: MYNAME=`IFS=. ; set $IAM ; echo $1`
                      6: SIG=
                      7: 
                      8: case "$1" in
                      9:  0.*)
                     10:     SIG=$1
                     11:     shift
                     12:     CONFIG_ARGS="$@"
                     13:     KEY=`sed -e q < .buildkey-$MYNAME`
                     14:     case "$SIG" in
                     15:      $KEY) ;;
                     16:      *)
                     17:        echo "Wrong directory for build on host $IAM"
                     18:        echo "This is <`pwd`>"
                     19:        echo "SIG is <$SIG>"
                     20:        echo "KEY is <$KEY>"
                     21:        exit 1
                     22:        ;;
                     23:     esac
                     24:     ;;
                     25:  *)
                     26:     CONFIG_ARGS="$@"
                     27:     ;;
                     28: esac
                     29: 
                     30: #set -e
                     31: #set -x
                     32: 
                     33: # scripts/cvo.sh invokes config.guess, and we want it to use the copy
                     34: # in the top directory (alongside build) if there's not another
                     35: # config.guess earlier on the path, so we invoke it using env to append
                     36: # . to the PATH.
                     37: 
                     38: CVO=`env PATH="$PATH:." scripts/cvo.sh @cvo@`
                     39: case "$CVO" in
                     40:  *-*-*-*) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me."
                     41:     exit 1
                     42:     ;;
                     43:  *-*-*) ;;
                     44:  *) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me."
                     45:     exit 1
                     46:     ;;
                     47: esac
                     48: 
                     49: case "$NTP_BDIR" in
                     50:  '')
                     51:     case "$IAM" in
                     52:      *.ntp.org)
                     53:        NTP_BDIR=host
                     54:        ;;
                     55:      *.udel.edu)
                     56:        NTP_BDIR=host
                     57:        # HMS: --enable-local-libopts is the default now...
                     58:        #CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts"
                     59:        case "$CVO" in
                     60:         *-*-ultrix*)
                     61:            CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local"
                     62:            ;;
                     63:        esac
                     64:        ;;
                     65:      *)
                     66:        NTP_BDIR=cvo
                     67:        ;;
                     68:      esac
                     69:      ;;
                     70: esac
                     71: 
                     72: case "$NTP_BDIR" in
                     73:  host) 
                     74:     BASEDIR=A.$MYNAME
                     75:     ;;
                     76:  cvo)
                     77:     BASEDIR=A.$CVO
                     78:     ;;
                     79:  *)
                     80:     echo "build: NTP_BDIR must be either 'cvo' or 'host'!" 1>&2
                     81:     exit 1
                     82:     ;;
                     83: esac
                     84: 
                     85: KEYSUF=""
                     86: 
                     87: case "$CONFIG_ARGS" in
                     88:  *--with-crypto=autokey*)
                     89:     KEYSUF="-autokey"
                     90:     ;;
                     91:  *--without-crypto*)
                     92:     KEYSUF="-noopenssl"
                     93:     ;;
                     94: esac
                     95: 
                     96: case "$CONFIG_ARGS" in
                     97:  *--disable-all-clocks*)
                     98:     KEYSUF="$KEYSUF-no-refclocks"
                     99:     ;;
                    100: esac
                    101: 
                    102: case "$CONFIG_ARGS" in
                    103:  *--disable-debugging*)
                    104:     KEYSUF="$KEYSUF-nodebug"
                    105:     ;;
                    106: esac
                    107: 
                    108: case "$CC" in
                    109:  '')
                    110:     CCSUF=""
                    111:     ;;
                    112:  *)
                    113:     CCSUF="-`echo $CC | sed -e 's: :_:g' -e's:/:+:g'`"
                    114:     ;;
                    115: esac
                    116: 
                    117: BDIR="$BASEDIR$KEYSUF$CCSUF"
                    118: 
                    119: [ -d "$BDIR" ] || mkdir $BDIR
                    120: [ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
                    121: [ -f "$BDIR/.buildhost" ] || echo $IAM > $BDIR/.buildhost
                    122: 
                    123: 
                    124: cd $BDIR
                    125: 
                    126: #
                    127: # Make sure we have a nice that works.
                    128: # To disable use of nice, setenv NO_NICE_BUILD=1
                    129: #
                    130: NICEB=
                    131: [ "$NO_NICE_BUILD" != "1" ] && nice true && NICEB=nice
                    132: [ -z "$NICEB" ] && {
                    133:        NICEB="./.nicebuild-$MYNAME-$SIG"
                    134:        cat > $NICEB <<-HEREDOC
                    135:                #! /bin/sh
                    136:                shift
                    137:                \$*
                    138: HEREDOC
                    139:        chmod +x $NICEB
                    140: }
                    141: 
                    142: #
                    143: # Find a test which supports -nt, unlike Solaris /bin/sh builtin.
                    144: #
                    145: TEST="${TEST-}"
                    146: if [ -z "$TEST" ] ; then
                    147:     for try in test /bin/test /usr/bin/test ; do
                    148:        case `$try config.status -nt ../configure 2>&1` in
                    149:         '')
                    150:            TEST="$try"
                    151:            # echo "Using $TEST"
                    152:            break
                    153:            ;;
                    154:        esac            
                    155:     done
                    156:     if [ -z "$TEST" ] ; then
                    157:        echo "build: need help finding test binary" 1>&2
                    158:        exit 1
                    159:     fi
                    160: fi
                    161: 
                    162: CONFIGURE="../configure --cache-file=../config.cache-$IAM$CCSUF $CONFIG_ARGS"
                    163: 
                    164: (      # This sequence of commands is logged to make.log.
                    165:        # If config.status is newer than ../configure, and the same
                    166:        # is true for sntp, we do not need to re-run configure.
                    167:        # Solaris /bin/sh doesn't grok -nt.
                    168: 
                    169:        ( "$TEST" config.status -nt ../configure &&
                    170:                $TEST sntp/config.status -nt ../sntp/configure ) ||
                    171:                "$NICEB" -7 $CONFIGURE
                    172:        "$NICEB" -5 ./config.status &&
                    173:                ( cd sntp && "$NICEB" -5 ./config.status ) &&
                    174:                "$NICEB" -14 ${MAKE-make} &&
                    175:                "$NICEB" -11 ${MAKE-make} check
                    176: ) > $LOGF 2>&1
                    177: 
                    178: EXITCODE=$?
                    179: 
                    180: # clean up if we made a dummy nice script
                    181: case "$NICEB" in
                    182:  nice)
                    183:     ;;
                    184:  *)
                    185:     rm "$NICEB"
                    186:     ;;
                    187: esac
                    188: 
                    189: exit $EXITCODE

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>