Subject: build.sh: pass -k to make(1)?
To: None <tech-toolchain@netbsd.org>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-toolchain
Date: 05/06/2003 01:55:12
How about adding a -k switch to build.sh that gets passed on to make(1) to
not abort on errors? See the patch below...


 - Hubert

Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.96
diff -u -r1.96 build.sh
--- build.sh	2003/04/26 18:42:34	1.96
+++ build.sh	2003/05/05 23:53:34
@@ -106,6 +106,7 @@
 	do_expertmode=false
 	do_rebuildmake=false
 	do_removedirs=false
+	kontinue=

 	# do_{operation}=true if given operation is requested.
 	#
@@ -245,7 +246,7 @@
 	fi
 	cat <<_usage_

-Usage: ${progname} [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
+Usage: ${progname} [-EknorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
 		[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
 		[-w wrapper]   operation [...]

@@ -257,34 +258,35 @@
  Other operations:
     help		Show this message (and exit)
     makewrapper		Create ${toolprefix}make-\${MACHINE} wrapper and ${toolprefix}make.
-			(Always done)
+                        (Always done)
     obj			Run "make obj" (default unless -o is used)
     tools 		Build and install tools
     kernel=conf		Build kernel with config file \`conf'
     install=idir	Run "make installworld" to \`idir'
-			(useful after 'distribution' or 'release')
+                        (useful after 'distribution' or 'release')
     sets		Create distribution sets in RELEASEDIR

  Options:
     -a arch	Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
     -B buildId	Set BUILDID to buildId
     -D dest	Set DESTDIR to dest
-    -E		Set "expert" mode; disables some DESTDIR checks
+    -E          Set "expert" mode; disables some DESTDIR checks
     -j njob	Run up to njob jobs in parallel; see make(1)
+    -k          Continue on errors; see make(1)
     -M obj	Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
     -m mach	Set MACHINE to mach (not required if NetBSD native)
-    -n		Show commands that would be executed, but do not execute them
+    -n          Show commands that would be executed, but do not execute them
     -O obj	Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-    -o		Set MKOBJDIRS=no (do not create objdirs at start of build)
+    -o          Set MKOBJDIRS=no (do not create objdirs at start of build)
     -R release	Set RELEASEDIR to release
-    -r		Remove contents of TOOLDIR and DESTDIR before building
+    -r          Remove contents of TOOLDIR and DESTDIR before building
     -T tools	Set TOOLDIR to tools.  If unset, and TOOLDIR is not set in
-		the environment, ${toolprefix}make will be (re)built unconditionally
-    -U		Set UNPRIVED (build without requiring root privileges)
-    -u		Set UPDATE (do not run "make clean" first)
-    -V v=[val]	Set variable \`v' to \`val'
-    -w wrapper	Create ${toolprefix}make script as wrapper
-		(Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE})
+                the environment, ${toolprefix}make will be (re)built unconditionally
+    -U          Set UNPRIVED (build without requiring root privileges)
+    -u          Set UPDATE (do not run "make clean" first)
+    -V v=[val]  Set variable \`v' to \`val'
+    -w wrapper  Create ${toolprefix}make script as wrapper
+                (Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE})

 _usage_
 	exit 1
@@ -292,7 +294,7 @@

 parseoptions()
 {
-	opts='a:B:bD:dEhi:j:k:M:m:nO:oR:rT:tUuV:w:'
+	opts='a:B:bD:dEhi:j:kM:m:nO:oR:rT:tUuV:w:'
 	opt_a=no

 	if type getopts >/dev/null 2>&1; then
@@ -359,7 +361,7 @@
 			;;

 		-k)
-			usage "'-k conf' has been replaced by 'kernel=conf'"
+			kontinue=-k
 			;;

 		-M)
@@ -722,7 +724,7 @@
 buildtools()
 {
 	if [ "$MKOBJDIRS" != "no" ]; then
-		$runcmd "$makewrapper" $parallel obj-tools ||
+		$runcmd "$makewrapper" $kontinue $parallel obj-tools ||
 		    bomb "failed to make obj-tools"
 	fi
 	$runcmd cd tools
@@ -731,7 +733,7 @@
 	else
 		cleandir=
 	fi
-	$runcmd "$makewrapper" ${cleandir} dependall install ||
+	$runcmd "$makewrapper" $kontinue ${cleandir} dependall install ||
 	    bomb "failed to make tools"
 }

@@ -756,7 +758,7 @@
 		KERNSRCDIR="$(safe_getmakevar KERNSRCDIR)"
 		KERNARCHDIR="$(safe_getmakevar KERNARCHDIR)"
 		$runcmd cd "${KERNSRCDIR}/${KERNARCHDIR}/compile"
-		$runcmd "$makewrapper" obj ||
+		$runcmd "$makewrapper" $kontinue obj ||
 		    bomb "failed to make obj in ${KERNSRCDIR}/${KERNARCHDIR}/compile"
 		$runcmd cd "$TOP"
 	fi
@@ -786,9 +788,9 @@
 		-s "${TOP}/sys" "${kernconfpath}" ||
 	    bomb "${toolprefix}config failed for ${kernconf}"
 	$runcmd cd "${kernbuilddir}"
-	$runcmd "$makewrapper" depend ||
+	$runcmd "$makewrapper" $kontinue depend ||
 	    bomb "make depend failed in ${kernbuilddir}"
-	$runcmd "$makewrapper" $parallel all ||
+	$runcmd "$makewrapper" $kontinue $parallel all ||
 	    bomb "make all failed in ${kernbuilddir}"

 	if [ "$runcmd" != "echo" ]; then
@@ -804,7 +806,7 @@
 installworld()
 {
 	dir="$1"
-	${runcmd} "$makewrapper" INSTALLWORLDDIR="${dir}" installworld ||
+	${runcmd} "$makewrapper" $kontinue INSTALLWORLDDIR="${dir}" installworld ||
 	    bomb "failed to make installworld to ${dir}"
 }

@@ -836,7 +838,7 @@
 			;;

 		obj|build|distribution|release|sets)
-			${runcmd} "$makewrapper" $parallel $op ||
+			${runcmd} "$makewrapper" $kontinue $parallel $op ||
 			    bomb "failed to make $op"
 			;;

-- 
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
* Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/