Subject: Re: Bi-endian platforms and build.sh
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-toolchain
Date: 12/11/2002 14:13:18
Jason R Thorpe wrote:

> I think I'd like the "buildid" to default to "eb" or "el" in these
> cases, unless the user overrides buildid with -B, in which case we
> can assume they know what they're doing.

This patch drops the makewrapper_suffix and uses BUILDID instead if
it's not already set.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/


Index: build.sh
===================================================================
RCS file: /cvsroot/basesrc/build.sh,v
retrieving revision 1.72
diff -d -p -u -r1.72 build.sh
--- build.sh	2002/11/17 12:59:37	1.72
+++ build.sh	2002/12/11 03:11:51
@@ -44,10 +44,14 @@ getarch () {
 		amiga|atari|cesfic|hp300|sun3|*68k)
 			MACHINE_ARCH=m68k;;
 
-		mipsco|newsmips|sbmips|sgimips)
+		evbmips|sbmips)
+			bi_endian=true
+			MACHINE_ARCH=mips;;
+
+		mipsco|newsmips|sgimips)
 			MACHINE_ARCH=mipseb;;
 
-		algor|arc|cobalt|evbmips|hpcmips|playstation2|pmax)
+		algor|arc|cobalt|hpcmips|playstation2|pmax)
 			MACHINE_ARCH=mipsel;;
 
 		pc532)
@@ -78,7 +82,7 @@ getarch () {
 validatearch () {
 	# Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
 	case $MACHINE_ARCH in
-		alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64)
+		alpha|arm|armeb|hppa|i386|m68000|m68k|mips|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64)
 			;;
 
 		*)	bomb "unknown target MACHINE_ARCH: $MACHINE_ARCH";;
@@ -136,6 +140,7 @@ _usage_
 
 # Set defaults.
 MAKEFLAGS=
+bi_endian=false
 buildtarget=build
 do_buildsystem=true
 do_buildkernel=false
@@ -229,6 +234,28 @@ while eval $getoptcmd; do case $opt in
 	--)		break;;
 	-'?'|-h)	usage;;
 esac; done
+
+# Check that MACHINE_ARCH is set correctly for bi-endian machines.
+if $bi_endian; then
+	case $MACHINE_ARCH in
+		mips)
+			echo "MACHINE_ARCH must be set, or -a must be used, for $MACHINE."
+			echo ""; usage
+			;;
+	esac
+
+	# If BUILDID is already set we assume that the user knows what
+	# they are doing and don't override that when an endianness
+	# qualifier.
+	if [ -z "$BUILDID" ]; then
+		case $MACHINE_ARCH in
+			*el)
+				BUILDID=el;;
+			*eb)
+				BUILDID=eb;;
+		esac
+	fi
+fi
 
 # Set up MACHINE*.  On a NetBSD host, these are allowed to be unset.
 if [ -z "$MACHINE" ]; then