]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Improvements to the 'build' script
authorHarlan Stenn <stenn@ntp.org>
Sun, 28 Nov 2010 04:10:00 +0000 (23:10 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sun, 28 Nov 2010 04:10:00 +0000 (23:10 -0500)
bk: 4cf1d618vaIHv77OQBvn9QlEAtQmHg

ChangeLog
build

index 13bfcb429ed7f05efb7f5fb3bf85515105b225d4..142ffd0373f890426d66bf6786fc65940f339c67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
 * Upgrade libopts to 33.3.8.
 * Bump minimum Automake version to 1.11, required for AM_COND_IF
   use in LIBOPTS_CHECK.
+* Improvements to the 'build' script.
 
 ---
 (4.2.6p3-RC10) 2010/11/14 Released by Harlan Stenn <stenn@ntp.org>
diff --git a/build b/build
index de4ea81314e794d16d426e2d68ba3dc47a0a79b4..cc6a53bdaf05e664b1c0dd8f6e03ffcfa5090537 100755 (executable)
--- a/build
+++ b/build
@@ -46,19 +46,36 @@ case "$CVO" in
     ;;
 esac
 
-case "$IAM" in
- *.udel.edu)
-    BASEDIR=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
+     *.udel.edu)
+       NTP_BDIR=host
+       CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts"
+       case "$CVO" in
+        *-*-ultrix*)
+           CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local"
+           ;;
+       esac
        ;;
-    esac
+     *)
+       NTP_BDIR=cvo
+       ;;
+     esac
+     ;;
+esac
+
+case "$NTP_BDIR" in
+ host) 
+    BASEDIR=A.$MYNAME
     ;;
*)
cvo)
     BASEDIR=A.$CVO
     ;;
+ *)
+    echo "build: NTP_BDIR must be either 'cvo' or 'host'!" 1>&2
+    exit 1
+    ;;
 esac
 
 KEYSUF=""
@@ -106,7 +123,7 @@ cd $BDIR
 # Make sure we have a nice that works.
 # To disable use of nice, setenv NO_NICE_BUILD=1
 #
-NICEB=""
+NICEB=
 [ "$NO_NICE_BUILD" != "1" ] && nice true && NICEB=nice
 [ -z "$NICEB" ] && {
        NICEB="./.nicebuild-$MYNAME-$SIG"
@@ -118,16 +135,40 @@ HEREDOC
        chmod +x $NICEB
 }
 
+#
+# 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.
-       # Solaris /bin/sh doesn't grok -nt, csh does
-       csh -c '[ config.status -nt ../configure ] && \
-               [ 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
+       # 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
 
 EXITCODE=$?
@@ -137,7 +178,8 @@ case "$NICEB" in
  nice)
     ;;
  *)
-    rm $NICEB
+    rm "$NICEB"
+    ;;
 esac
 
 exit $EXITCODE