aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorOllivier Robert <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
committerOllivier Robert <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
commit2b45e011ca352ce509bc83ae148230aeee0c7e0d (patch)
treea618007bb41d13153794a598e3d904ace2976324 /build
parent9b5bd0a264b0a21eefac2b929b574c73bd601507 (diff)
downloadsrc-2b45e011ca352ce509bc83ae148230aeee0c7e0d.tar.gz
src-2b45e011ca352ce509bc83ae148230aeee0c7e0d.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
Notes
Notes: svn path=/vendor/ntp/dist/; revision=258945 svn path=/vendor/ntp/4.2.6p5/; revision=258946; tag=vendor/ntp/4.2.6p5
Diffstat (limited to 'build')
-rwxr-xr-xbuild145
1 files changed, 106 insertions, 39 deletions
diff --git a/build b/build
index 2a65d8678266..18e223c7adf2 100755
--- a/build
+++ b/build
@@ -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