diff options
author | Ollivier Robert <roberto@FreeBSD.org> | 2013-12-04 21:33:17 +0000 |
---|---|---|
committer | Ollivier Robert <roberto@FreeBSD.org> | 2013-12-04 21:33:17 +0000 |
commit | 2b45e011ca352ce509bc83ae148230aeee0c7e0d (patch) | |
tree | a618007bb41d13153794a598e3d904ace2976324 /build | |
parent | 9b5bd0a264b0a21eefac2b929b574c73bd601507 (diff) | |
download | src-5592cd9e3002995d676cc186b0362f891fead9fc.tar.gz src-5592cd9e3002995d676cc186b0362f891fead9fc.zip |
Virgin import of ntpd 4.2.6p5.vendor/ntp/4.2.6p5
When the series of commits is complete, things like
https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks
should be fixed.
PR: bin/148836 (except that we import a newer version)
Asked by: Too many
MFC after: 2 weeks
Diffstat (limited to 'build')
-rwxr-xr-x | build | 145 |
1 files changed, 106 insertions, 39 deletions
@@ -18,8 +18,8 @@ case "$1" in echo "This is <`pwd`>" echo "SIG is <$SIG>" echo "KEY is <$KEY>" - exit 1 - ;; + exit 1 + ;; esac ;; *) @@ -30,26 +30,55 @@ esac #set -e #set -x -CVO=`./config.guess` +# scripts/cvo.sh invokes config.guess, and we want it to use the copy +# in the top directory (alongside build) if there's not another +# config.guess earlier on the path, so we invoke it using env to append +# . to the PATH. + +CVO=`env PATH="$PATH:." scripts/cvo.sh @cvo@` case "$CVO" in + *-*-*-*) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me." + exit 1 + ;; *-*-*) ;; - *) echo "config.guess returned <$CVO>, which makes no sense to me." + *) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me." exit 1 ;; esac -case "$IAM" in - *.udel.edu) - BDIR=A.$MYNAME - CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts" - case "$CVO" in - *-*-ultrix*) - CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local" +case "$NTP_BDIR" in + '') + case "$IAM" in + *.ntp.org) + NTP_BDIR=host ;; - esac + *.udel.edu) + NTP_BDIR=host + # HMS: --enable-local-libopts is the default now... + #CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts" + case "$CVO" in + *-*-ultrix*) + CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local" + ;; + esac + ;; + *) + NTP_BDIR=cvo + ;; + esac + ;; +esac + +case "$NTP_BDIR" in + host) + BASEDIR=A.$MYNAME + ;; + cvo) + BASEDIR=A.$CVO ;; *) - BDIR=A.$CVO + echo "build: NTP_BDIR must be either 'cvo' or 'host'!" 1>&2 + exit 1 ;; esac @@ -76,15 +105,16 @@ case "$CONFIG_ARGS" in ;; esac -CCSUF="" - case "$CC" in - '') ;; - *) CCSUF="-$CC" + '') + CCSUF="" + ;; + *) + CCSUF="-`echo $CC | sed -e 's: :_:g' -e's:/:+:g'`" ;; esac -BDIR="$BDIR$KEYSUF$CCSUF" +BDIR="$BASEDIR$KEYSUF$CCSUF" [ -d "$BDIR" ] || mkdir $BDIR [ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo @@ -94,29 +124,66 @@ BDIR="$BDIR$KEYSUF$CCSUF" cd $BDIR # -# make sure we have a nice that works, +# Make sure we have a nice that works. +# To disable use of nice, setenv NO_NICE_BUILD=1 # -nice true && NICEB=nice -nice true || NICEB=./.nicebuild-$MYNAME-$SIG && ( - cat > .nicebuild-$MYNAME-$SIG <<UNLYKUHLY -#! /bin/sh -shift -\$* -UNLYKUHLY - chmod +x .nicebuild-$MYNAME-$SIG -) - +NICEB= +[ "$NO_NICE_BUILD" != "1" ] && nice true && NICEB=nice +[ -z "$NICEB" ] && { + NICEB="./.nicebuild-$MYNAME-$SIG" + cat > $NICEB <<-HEREDOC + #! /bin/sh + shift + \$* +HEREDOC + chmod +x $NICEB +} -( -[ -f config.status ] || $NICEB -7 ../configure --config-cache \ - $CONFIG_ARGS +# +# Find a test which supports -nt, unlike Solaris /bin/sh builtin. +# +TEST="${TEST-}" +if [ -z "$TEST" ] ; then + for try in test /bin/test /usr/bin/test ; do + case `$try config.status -nt ../configure 2>&1` in + '') + TEST="$try" + # echo "Using $TEST" + break + ;; + esac + done + if [ -z "$TEST" ] ; then + echo "build: need help finding test binary" 1>&2 + exit 1 + fi +fi + +CONFIGURE="../configure --cache-file=../config.cache-$IAM$CCSUF $CONFIG_ARGS" + +( # This sequence of commands is logged to make.log. + # If config.status is newer than ../configure, and the same + # is true for sntp, we do not need to re-run configure. + # Solaris /bin/sh doesn't grok -nt. + + ( "$TEST" config.status -nt ../configure && + $TEST sntp/config.status -nt ../sntp/configure ) || + "$NICEB" -7 $CONFIGURE + "$NICEB" -5 ./config.status && + ( cd sntp && "$NICEB" -5 ./config.status ) && + "$NICEB" -14 ${MAKE-make} && + "$NICEB" -11 ${MAKE-make} check +) > $LOGF 2>&1 -$NICEB -5 ./config.status +EXITCODE=$? -case "$MAKE" in - '') $NICEB -14 make && $NICEB -10 make check - ;; - *) $NICEB -14 $MAKE && $NICEB -10 $MAKE check - ;; +# clean up if we made a dummy nice script +case "$NICEB" in + nice) + ;; + *) + rm "$NICEB" + ;; esac -) > $LOGF 2>&1 + +exit $EXITCODE |