1999-12-09 13:01:21 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
LOGF=make.log
|
|
|
|
IAM=`hostname || uname -n`
|
2009-12-12 22:29:30 +00:00
|
|
|
MYNAME=`IFS=. ; set $IAM ; echo $1`
|
|
|
|
SIG=
|
1999-12-09 13:01:21 +00:00
|
|
|
|
2001-08-29 14:35:15 +00:00
|
|
|
case "$1" in
|
|
|
|
0.*)
|
|
|
|
SIG=$1
|
|
|
|
shift
|
|
|
|
CONFIG_ARGS="$@"
|
2009-12-12 22:29:30 +00:00
|
|
|
KEY=`sed -e q < .buildkey-$MYNAME`
|
2001-08-29 14:35:15 +00:00
|
|
|
case "$SIG" in
|
|
|
|
$KEY) ;;
|
|
|
|
*)
|
|
|
|
echo "Wrong directory for build on host $IAM"
|
2004-07-20 15:01:56 +00:00
|
|
|
echo "This is <`pwd`>"
|
|
|
|
echo "SIG is <$SIG>"
|
|
|
|
echo "KEY is <$KEY>"
|
2013-12-04 21:33:17 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
2001-08-29 14:35:15 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CONFIG_ARGS="$@"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-12-09 13:01:21 +00:00
|
|
|
#set -e
|
|
|
|
#set -x
|
|
|
|
|
2014-12-20 22:52:39 +00:00
|
|
|
if [ ! -r sntp/libevent/build-aux/config.guess ] ; then
|
|
|
|
echo "Error: bootstrap required." 1>&2 && exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# sntp/scripts/cvo.sh invokes config.guess, and we want it to use the copy
|
|
|
|
# in the build-aux directory if there's not another config.guess earlier
|
|
|
|
# on the path, so we invoke it using env to append to the PATH.
|
2013-12-04 21:33:17 +00:00
|
|
|
|
2014-12-20 22:52:39 +00:00
|
|
|
CVO=`env PATH="$PATH:./sntp/libevent/build-aux" sntp/scripts/cvo.sh @cvo@`
|
1999-12-09 13:01:21 +00:00
|
|
|
case "$CVO" in
|
2014-12-20 22:52:39 +00:00
|
|
|
*-*-*-*) echo "sntp/scripts/cvo.sh returned <$CVO>, which makes no sense to me."
|
2013-12-04 21:33:17 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
1999-12-09 13:01:21 +00:00
|
|
|
*-*-*) ;;
|
2014-12-20 22:52:39 +00:00
|
|
|
*) echo "sntp/scripts/cvo.sh returned <$CVO>, which makes no sense to me."
|
1999-12-09 13:01:21 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
case "$NTP_BDIR" in
|
|
|
|
'')
|
|
|
|
case "$IAM" in
|
2019-03-07 13:01:16 +00:00
|
|
|
*.ntp.org | *.ntfo.org)
|
2013-12-04 21:33:17 +00:00
|
|
|
NTP_BDIR=host
|
2008-08-18 14:26:05 +00:00
|
|
|
;;
|
2013-12-04 21:33:17 +00:00
|
|
|
*.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
|
1999-12-09 13:01:21 +00:00
|
|
|
;;
|
|
|
|
*)
|
2013-12-04 21:33:17 +00:00
|
|
|
echo "build: NTP_BDIR must be either 'cvo' or 'host'!" 1>&2
|
|
|
|
exit 1
|
1999-12-09 13:01:21 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2001-08-29 14:35:15 +00:00
|
|
|
KEYSUF=""
|
|
|
|
|
|
|
|
case "$CONFIG_ARGS" in
|
|
|
|
*--with-crypto=autokey*)
|
|
|
|
KEYSUF="-autokey"
|
|
|
|
;;
|
|
|
|
*--without-crypto*)
|
2004-07-20 15:01:56 +00:00
|
|
|
KEYSUF="-noopenssl"
|
2001-08-29 14:35:15 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-08-18 14:26:05 +00:00
|
|
|
case "$CONFIG_ARGS" in
|
|
|
|
*--disable-all-clocks*)
|
|
|
|
KEYSUF="$KEYSUF-no-refclocks"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$CONFIG_ARGS" in
|
|
|
|
*--disable-debugging*)
|
|
|
|
KEYSUF="$KEYSUF-nodebug"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-12-09 13:01:21 +00:00
|
|
|
case "$CC" in
|
2013-12-04 21:33:17 +00:00
|
|
|
'')
|
|
|
|
CCSUF=""
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CCSUF="-`echo $CC | sed -e 's: :_:g' -e's:/:+:g'`"
|
1999-12-09 13:01:21 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-02-05 20:53:33 +00:00
|
|
|
BDIR="$BASEDIR$KEYSUF$CCSUF"
|
1999-12-09 13:01:21 +00:00
|
|
|
|
|
|
|
[ -d "$BDIR" ] || mkdir $BDIR
|
|
|
|
[ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
|
|
|
|
[ -f "$BDIR/.buildhost" ] || echo $IAM > $BDIR/.buildhost
|
|
|
|
|
2009-12-12 22:29:30 +00:00
|
|
|
|
1999-12-09 13:01:21 +00:00
|
|
|
cd $BDIR
|
|
|
|
|
2009-12-12 22:29:30 +00:00
|
|
|
#
|
2013-12-04 21:33:17 +00:00
|
|
|
# Make sure we have a nice that works.
|
|
|
|
# To disable use of nice, setenv NO_NICE_BUILD=1
|
2009-12-12 22:29:30 +00:00
|
|
|
#
|
2013-12-04 21:33:17 +00:00
|
|
|
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
|
|
|
|
}
|
2009-12-12 22:29:30 +00:00
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2015-02-05 20:53:33 +00:00
|
|
|
CONFIGURE="../configure"
|
|
|
|
# We need KEYSUF because of RAND_ and others, and -noopenssl"
|
|
|
|
#CONFIGURE="$CONFIGURE --cache-file=../config.cache-$IAM$KEYSUF$CCSUF"
|
|
|
|
CONFIGURE="$CONFIGURE $CONFIG_ARGS"
|
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
|
|
|
|
( # 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.
|
2014-12-20 22:52:39 +00:00
|
|
|
# For libevent, the twist is we may not be configuring the
|
|
|
|
# tearoff, so only act if its config.status exists.
|
2013-12-04 21:33:17 +00:00
|
|
|
# Solaris /bin/sh doesn't grok -nt.
|
|
|
|
|
|
|
|
( "$TEST" config.status -nt ../configure &&
|
2014-12-20 22:52:39 +00:00
|
|
|
"$TEST" sntp/config.status -nt ../sntp/configure &&
|
|
|
|
( "$TEST" '!' -f sntp/libevent/config.status ||
|
|
|
|
"$TEST" sntp/libevent/config.status -nt ../sntp/libevent/configure ) ) ||
|
2013-12-04 21:33:17 +00:00
|
|
|
"$NICEB" -7 $CONFIGURE
|
2014-12-20 22:52:39 +00:00
|
|
|
"$TEST" Makefile -nt config.status ||
|
|
|
|
"$NICEB" -5 ./config.status
|
|
|
|
"$TEST" sntp/Makefile -nt sntp/config.status ||
|
|
|
|
( cd sntp && "$NICEB" -5 ./config.status )
|
|
|
|
"$TEST" '!' -f sntp/libevent/Makefile ||
|
|
|
|
"$TEST" sntp/libevent/Makefile -nt sntp/libevent/config.status ||
|
|
|
|
( cd sntp/libevent && "$NICEB" -5 ./config.status )
|
|
|
|
"$NICEB" -14 ${MAKE-make} && "$NICEB" -11 ${MAKE-make} check
|
2013-12-04 21:33:17 +00:00
|
|
|
) > $LOGF 2>&1
|
1999-12-09 13:01:21 +00:00
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
EXITCODE=$?
|
2001-08-29 14:35:15 +00:00
|
|
|
|
2013-12-04 21:33:17 +00:00
|
|
|
# clean up if we made a dummy nice script
|
|
|
|
case "$NICEB" in
|
|
|
|
nice)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
rm "$NICEB"
|
|
|
|
;;
|
1999-12-09 13:01:21 +00:00
|
|
|
esac
|
2013-12-04 21:33:17 +00:00
|
|
|
|
|
|
|
exit $EXITCODE
|