Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src * Use /usr/bin/env to invoke the real interpreter. This all...



details:   https://anonhg.NetBSD.org/src/rev/24d21a50c43d
branches:  trunk
changeset: 536367:24d21a50c43d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Sep 13 23:27:13 2002 +0000

description:
* Use /usr/bin/env to invoke the real interpreter.  This allows us to
  get the POSIX shell on more systems.
* Deal with a broken "pwd" on Solaris (suggested by Christos).

diffstat:

 build.sh |  29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diffs (95 lines):

diff -r c0e556aaf7f8 -r 24d21a50c43d build.sh
--- a/build.sh  Fri Sep 13 22:44:58 2002 +0000
+++ b/build.sh  Fri Sep 13 23:27:13 2002 +0000
@@ -1,11 +1,15 @@
-#! /bin/sh
-#  $NetBSD: build.sh,v 1.66 2002/09/13 22:17:04 thorpej Exp $
+#! /usr/bin/env sh
+#  $NetBSD: build.sh,v 1.67 2002/09/13 23:27:13 thorpej Exp $
 #
 # Top level build wrapper, for a system containing no tools.
 #
 # This script should run on any POSIX-compliant shell.  For systems
 # with a strange /bin/sh, "ksh" or "bash" may be an ample alternative.
 #
+# Note, however, that due to the way the interpreter is invoked above,
+# if a POSIX-compliant shell is the first in the PATH, you won't have
+# to take any further action.
+#
 
 bomb () {
        echo ""
@@ -19,8 +23,14 @@
 # If $PWD is a valid name of the current directory, POSIX mandates that pwd
 # return it by default which causes problems in the presence of symlinks.
 # Unsetting PWD is simpler than changing every occurrence of pwd to use -P.
+#
+# XXX Except that doesn't work on Solaris.
 unset PWD
-TOP=`pwd`
+if [ "x`uname -s`" = "xSunOS" ]; then
+       TOP=`pwd -P`
+else
+       TOP=`pwd`
+fi
 
 getarch () {
        # Translate a MACHINE into a default MACHINE_ARCH.
@@ -83,7 +93,7 @@
 resolvepath () {
        case $OPTARG in
        /*)     ;;
-       *)      OPTARG="$cwd/$OPTARG";;
+       *)      OPTARG="$TOP/$OPTARG";;
        esac
 }
 
@@ -119,7 +129,6 @@
 # Set defaults.
 MAKEFLAGS=
 buildtarget=build
-cwd=`pwd`
 do_buildsystem=true
 do_buildonlytools=false
 do_rebuildmake=false
@@ -192,7 +201,7 @@
                makeenv="$makeenv MAKEOBJDIRPREFIX";;
 
        -O)     eval $optargcmd; resolvepath
-               MAKEOBJDIR="\${.CURDIR:C,^$cwd,$OPTARG,}"; export MAKEOBJDIR
+               MAKEOBJDIR="\${.CURDIR:C,^$TOP,$OPTARG,}"; export MAKEOBJDIR
                makeobjdir=$OPTARG
                makeenv="$makeenv MAKEOBJDIR";;
 
@@ -224,7 +233,7 @@
 if [ ! -z "$BUILDID" ]; then
        makeenv="$makeenv BUILDID"
 fi
-MAKEFLAGS="-m $cwd/share/mk $MAKEFLAGS MKOBJDIRS=${MKOBJDIRS-yes}"
+MAKEFLAGS="-m $TOP/share/mk $MAKEFLAGS MKOBJDIRS=${MKOBJDIRS-yes}"
 export MAKEFLAGS MACHINE MACHINE_ARCH
 
 # Test make source file timestamps against installed nbmake binary,
@@ -258,11 +267,11 @@
        $runcmd cd "$tmpdir"
 
        $runcmd env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
-               "$cwd/tools/make/configure" || bomb "configure of nbmake failed"
+               "$TOP/tools/make/configure" || bomb "configure of nbmake failed"
        $runcmd sh buildmake.sh || bomb "build of nbmake failed"
 
        make="$tmpdir/nbmake"
-       $runcmd cd "$cwd"
+       $runcmd cd "$TOP"
        $runcmd rm -f usr.bin/make/*.o usr.bin/make/lst.lib/*.o
 fi
 
@@ -380,7 +389,7 @@
 eval cat <<EOF $makewrapout
 #! /bin/sh
 # Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.66 2002/09/13 22:17:04 thorpej Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.67 2002/09/13 23:27:13 thorpej Exp $
 #
 
 EOF



Home | Main Index | Thread Index | Old Index