Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/build.sh,v rcsdiff: /ftp/cvs/cvsroot/src/build.sh,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.58 retrieving revision 1.58.2.5 diff -u -p -r1.58 -r1.58.2.5 --- src/build.sh 2002/05/13 01:44:34 1.58 +++ src/build.sh 2002/11/03 16:36:06 1.58.2.5 @@ -1,11 +1,15 @@ -#! /bin/sh -# $NetBSD: build.sh,v 1.58 2002/05/13 01:44:34 lukem Exp $ +#! /usr/bin/env sh +# $NetBSD: build.sh,v 1.58.2.5 2002/11/03 16:36:06 he 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 "" @@ -16,7 +20,17 @@ bomb () { [ -d usr.bin/make ] || bomb "build.sh must be run from the top source level" [ -f share/mk/bsd.own.mk ] || bomb "src/share/mk is missing; please re-fetch the source tree" -TOP=`pwd` +# 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 +if [ "x`uname -s`" = "xSunOS" ]; then + TOP=`pwd -P` +else + TOP=`pwd` +fi getarch () { # Translate a MACHINE into a default MACHINE_ARCH. @@ -58,7 +72,7 @@ getarch () { validatearch () { # Ensure that the MACHINE_ARCH exists (and is supported by build.sh). case $MACHINE_ARCH in - alpha|arm|i386|m68000|m68k|mipse[bl]|powerpc|sh3e[bl]|sparc|sparc64|vax|x86_64) + alpha|arm|armeb|i386|m68000|m68k|mipse[bl]|powerpc|sh3e[bl]|sparc|sparc64|vax|x86_64) ;; *) bomb "unknown target MACHINE_ARCH: $MACHINE_ARCH";; @@ -76,7 +90,7 @@ EOF resolvepath () { case $OPTARG in /*) ;; - *) OPTARG="$cwd/$OPTARG";; + *) OPTARG="$TOP/$OPTARG";; esac } @@ -112,7 +126,6 @@ usage () { # Set defaults. MAKEFLAGS= buildtarget=build -cwd=`pwd` do_buildsystem=true do_buildonlytools=false do_rebuildmake=false @@ -185,7 +198,7 @@ while eval $getoptcmd; do case $opt in 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";; @@ -217,7 +230,7 @@ makeenv="$makeenv TOOLDIR MACHINE MACHIN 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, @@ -251,11 +264,11 @@ if $do_rebuildmake; then $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 @@ -309,7 +322,7 @@ else echo "===> DESTDIR path: $DESTDIR" TOOLDIR=`getmakevar TOOLDIR`; - [ $? = 0 ] || bomb "getmakevar DESTDIR failed"; + [ $? = 0 ] || bomb "getmakevar TOOLDIR failed"; echo "===> TOOLDIR path: $TOOLDIR" export DESTDIR TOOLDIR @@ -373,7 +386,7 @@ fi eval cat <