need to link stdResource.c now
[netbsd-mini2440.git] / build.sh
blobf3ef7aa6fdd0238a8339a30b88cad58b70989a1b
1 #! /usr/bin/env sh
2 # $NetBSD: build.sh,v 1.205 2009/03/09 06:25:51 apb Exp $
4 # Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
5 # All rights reserved.
7 # This code is derived from software contributed to The NetBSD Foundation
8 # by Todd Vierling and Luke Mewburn.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
12 # are met:
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
32 # Top level build wrapper, for a system containing no tools.
34 # This script should run on any POSIX-compliant shell. If the
35 # first "sh" found in the PATH is a POSIX-compliant shell, then
36 # you should not need to take any special action. Otherwise, you
37 # should set the environment variable HOST_SH to a POSIX-compliant
38 # shell, and invoke build.sh with that shell. (Depending on your
39 # system, one of /bin/ksh, /usr/local/bin/bash, or /usr/xpg4/bin/sh
40 # might be a suitable shell.)
43 progname=${0##*/}
44 toppid=$$
45 results=/dev/null
46 tab=' '
47 trap "exit 1" 1 2 3 15
49 bomb()
51 cat >&2 <<ERRORMESSAGE
53 ERROR: $@
54 *** BUILD ABORTED ***
55 ERRORMESSAGE
56 kill ${toppid} # in case we were invoked from a subshell
57 exit 1
61 statusmsg()
63 ${runcmd} echo "===> $@" | tee -a "${results}"
66 warning()
68 statusmsg "Warning: $@"
71 # Find a program in the PATH, and print the result. If not found,
72 # print a default. If $2 is defined (even if it is an empty string),
73 # then that is the default; otherwise, $1 is used as the default.
74 find_in_PATH()
76 local prog="$1"
77 local result="${2-"$1"}"
78 local oldIFS="${IFS}"
79 local dir
80 IFS=":"
81 for dir in ${PATH}; do
82 if [ -x "${dir}/${prog}" ]; then
83 result="${dir}/${prog}"
84 break
86 done
87 IFS="${oldIFS}"
88 echo "${result}"
91 # Try to find a working POSIX shell, and set HOST_SH to refer to it.
92 # Assumes that uname_s, uname_m, and PWD have been set.
93 set_HOST_SH()
95 # Even if ${HOST_SH} is already defined, we still do the
96 # sanity checks at the end.
98 # Solaris has /usr/xpg4/bin/sh.
100 [ -z "${HOST_SH}" ] && [ x"${uname_s}" = x"SunOS" ] && \
101 [ -x /usr/xpg4/bin/sh ] && HOST_SH="/usr/xpg4/bin/sh"
103 # Try to get the name of the shell that's running this script,
104 # by parsing the output from "ps". We assume that, if the host
105 # system's ps command supports -o comm at all, it will do so
106 # in the usual way: a one-line header followed by a one-line
107 # result, possibly including trailing white space. And if the
108 # host system's ps command doesn't support -o comm, we assume
109 # that we'll get an error message on stderr and nothing on
110 # stdout. (We don't try to use ps -o 'comm=' to suppress the
111 # header line, because that is less widely supported.)
113 # If we get the wrong result here, the user can override it by
114 # specifying HOST_SH in the environment.
116 [ -z "${HOST_SH}" ] && HOST_SH="$(
117 (ps -p $$ -o comm | sed -ne "2s/[ ${tab}]*\$//p") 2>/dev/null )"
119 # If nothing above worked, use "sh". We will later find the
120 # first directory in the PATH that has a "sh" program.
122 [ -z "${HOST_SH}" ] && HOST_SH="sh"
124 # If the result so far is not an absolute path, try to prepend
125 # PWD or search the PATH.
127 case "${HOST_SH}" in
128 /*) :
130 */*) HOST_SH="${PWD}/${HOST_SH}"
132 *) HOST_SH="$(find_in_PATH "${HOST_SH}")"
134 esac
136 # If we don't have an absolute path by now, bomb.
138 case "${HOST_SH}" in
139 /*) :
141 *) bomb "HOST_SH=\"${HOST_SH}\" is not an absolute path."
143 esac
145 # If HOST_SH is not executable, bomb.
147 [ -x "${HOST_SH}" ] ||
148 bomb "HOST_SH=\"${HOST_SH}\" is not executable."
151 initdefaults()
153 makeenv=
154 makewrapper=
155 makewrappermachine=
156 runcmd=
157 operations=
158 removedirs=
160 [ -d usr.bin/make ] || cd "$(dirname $0)"
161 [ -d usr.bin/make ] ||
162 bomb "build.sh must be run from the top source level"
163 [ -f share/mk/bsd.own.mk ] ||
164 bomb "src/share/mk is missing; please re-fetch the source tree"
166 # Find information about the build platform. This should be
167 # kept in sync with _HOST_OSNAME, _HOST_OSREL, and _HOST_ARCH
168 # variables in share/mk/bsd.sys.mk.
170 # Note that "uname -p" is not part of POSIX, but we want uname_p
171 # to be set to the host MACHINE_ARCH, if possible. On systems
172 # where "uname -p" fails, prints "unknown", or prints a string
173 # that does not look like an identifier, fall back to using the
174 # output from "uname -m" instead.
176 uname_s=$(uname -s 2>/dev/null)
177 uname_r=$(uname -r 2>/dev/null)
178 uname_m=$(uname -m 2>/dev/null)
179 uname_p=$(uname -p 2>/dev/null || echo "unknown")
180 case "${uname_p}" in
181 ''|unknown|*[^-_A-Za-z0-9]*) uname_p="${uname_m}" ;;
182 esac
184 id_u=$(id -u 2>/dev/null || /usr/xpg4/bin/id -u 2>/dev/null)
186 # If $PWD is a valid name of the current directory, POSIX mandates
187 # that pwd return it by default which causes problems in the
188 # presence of symlinks. Unsetting PWD is simpler than changing
189 # every occurrence of pwd to use -P.
191 # XXX Except that doesn't work on Solaris. Or many Linuces.
193 unset PWD
194 TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null)
196 # The user can set HOST_SH in the environment, or we try to
197 # guess an appropriate value. Then we set several other
198 # variables from HOST_SH.
200 set_HOST_SH
201 setmakeenv HOST_SH "${HOST_SH}"
202 setmakeenv BSHELL "${HOST_SH}"
203 setmakeenv CONFIG_SHELL "${HOST_SH}"
205 # Set defaults.
207 toolprefix=nb
209 # Some systems have a small ARG_MAX. -X prevents make(1) from
210 # exporting variables in the environment redundantly.
212 case "${uname_s}" in
213 Darwin | FreeBSD | CYGWIN*)
214 MAKEFLAGS=-X
217 MAKEFLAGS=
219 esac
221 # do_{operation}=true if given operation is requested.
223 do_expertmode=false
224 do_rebuildmake=false
225 do_removedirs=false
226 do_tools=false
227 do_cleandir=false
228 do_obj=false
229 do_build=false
230 do_distribution=false
231 do_release=false
232 do_kernel=false
233 do_releasekernel=false
234 do_install=false
235 do_sets=false
236 do_sourcesets=false
237 do_syspkgs=false
238 do_iso_image=false
239 do_iso_image_source=false
240 do_params=false
242 # Create scratch directory
244 tmpdir="${TMPDIR-/tmp}/nbbuild$$"
245 mkdir "${tmpdir}" || bomb "Cannot mkdir: ${tmpdir}"
246 trap "cd /; rm -r -f \"${tmpdir}\"" 0
247 results="${tmpdir}/build.sh.results"
249 # Set source directories
251 setmakeenv NETBSDSRCDIR "${TOP}"
253 # Determine top-level obj directory.
254 # Defaults to the top-level source directory.
255 # If $MAKEOBJDIRPREFIX is set in the environment, use it.
256 # We can't check $MAKEOBJDIR since that may be a make(1)
257 # expression that we can't evaluate at this time.
259 TOP_objdir="${TOP}"
260 if [ -n "${MAKEOBJDIRPREFIX}" ]; then
261 TOP_objdir="${MAKEOBJDIRPREFIX}${TOP}"
262 elif [ -n "${MAKEOBJDIR}" ]; then
263 warning "Can't parse \$(MAKEOBJDIR) \"$MAKEOBJDIR\" to determine top objdir"
266 # Find the version of NetBSD
268 DISTRIBVER="$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh)"
270 # Set the BUILDSEED to NetBSD-"N"
272 setmakeenv BUILDSEED "NetBSD-$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh -m)"
274 # Set MKARZERO to "yes"
276 setmakeenv MKARZERO "yes"
278 # Set various environment variables to known defaults,
279 # to minimize (cross-)build problems observed "in the field".
281 unsetmakeenv INFODIR
282 unsetmakeenv LESSCHARSET
283 setmakeenv LC_ALL C
286 getarch()
288 # Translate some MACHINE name aliases (known only to build.sh)
289 # into proper MACHINE and MACHINE_ARCH names. Save the alias
290 # name in makewrappermachine.
292 case "${MACHINE}" in
294 evbarm-e[bl])
295 makewrappermachine=${MACHINE}
296 # MACHINE_ARCH is "arm" or "armeb", not "armel"
297 MACHINE_ARCH=arm${MACHINE##*-}
298 MACHINE_ARCH=${MACHINE_ARCH%el}
299 MACHINE=${MACHINE%-e[bl]}
302 evbmips-e[bl]|sbmips-e[bl])
303 makewrappermachine=${MACHINE}
304 MACHINE_ARCH=mips${MACHINE##*-}
305 MACHINE=${MACHINE%-e[bl]}
308 evbmips64-e[bl]|sbmips64-e[bl])
309 makewrappermachine=${MACHINE}
310 MACHINE_ARCH=mips64${MACHINE##*-}
311 MACHINE=${MACHINE%64-e[bl]}
314 evbsh3-e[bl])
315 makewrappermachine=${MACHINE}
316 MACHINE_ARCH=sh3${MACHINE##*-}
317 MACHINE=${MACHINE%-e[bl]}
320 esac
322 # Translate a MACHINE into a default MACHINE_ARCH.
324 case "${MACHINE}" in
326 acorn26|acorn32|cats|hpcarm|iyonix|netwinder|shark|zaurus)
327 MACHINE_ARCH=arm
330 evbarm) # unspecified MACHINE_ARCH gets LE
331 MACHINE_ARCH=${MACHINE_ARCH:=arm}
334 hp700)
335 MACHINE_ARCH=hppa
338 sun2)
339 MACHINE_ARCH=m68000
342 amiga|atari|cesfic|hp300|luna68k|mac68k|mvme68k|news68k|next68k|sun3|x68k)
343 MACHINE_ARCH=m68k
346 evbmips|sbmips) # no default MACHINE_ARCH
349 ews4800mips|mipsco|newsmips|sgimips)
350 MACHINE_ARCH=mipseb
353 algor|arc|cobalt|hpcmips|playstation2|pmax)
354 MACHINE_ARCH=mipsel
357 evbppc64|macppc64|ofppc64)
358 makewrappermachine=${MACHINE}
359 MACHINE=${MACHINE%64}
360 MACHINE_ARCH=powerpc64
363 amigappc|bebox|evbppc|ibmnws|macppc|mvmeppc|ofppc|prep|rs6000|sandpoint)
364 MACHINE_ARCH=powerpc
367 evbsh3) # no default MACHINE_ARCH
370 mmeye)
371 MACHINE_ARCH=sh3eb
374 dreamcast|hpcsh|landisk)
375 MACHINE_ARCH=sh3el
378 amd64)
379 MACHINE_ARCH=x86_64
382 alpha|i386|sparc|sparc64|vax|ia64)
383 MACHINE_ARCH=${MACHINE}
387 bomb "Unknown target MACHINE: ${MACHINE}"
390 esac
393 validatearch()
395 # Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
397 case "${MACHINE_ARCH}" in
399 alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|mips64e[bl]|powerpc|powerpc64|sh3e[bl]|sparc|sparc64|vax|x86_64|ia64)
403 bomb "No MACHINE_ARCH provided"
407 bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}"
410 esac
412 # Determine valid MACHINE_ARCHs for MACHINE
414 case "${MACHINE}" in
416 evbarm)
417 arches="arm armeb"
420 evbmips|sbmips)
421 arches="mipseb mipsel mips64eb mips64el"
424 sgimips)
425 arches="mipseb mips64eb"
428 evbsh3)
429 arches="sh3eb sh3el"
432 macppc|evbppc|ofppc)
433 arches="powerpc powerpc64"
436 oma="${MACHINE_ARCH}"
437 getarch
438 arches="${MACHINE_ARCH}"
439 MACHINE_ARCH="${oma}"
442 esac
444 # Ensure that MACHINE_ARCH supports MACHINE
446 archok=false
447 for a in ${arches}; do
448 if [ "${a}" = "${MACHINE_ARCH}" ]; then
449 archok=true
450 break
452 done
453 ${archok} ||
454 bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'"
457 nobomb_getmakevar()
459 [ -x "${make}" ] || return 1
460 "${make}" -m ${TOP}/share/mk -s -B -f- _x_ <<EOF || return 1
461 _x_:
462 echo \${$1}
463 .include <bsd.prog.mk>
464 .include <bsd.kernobj.mk>
468 raw_getmakevar()
470 [ -x "${make}" ] || bomb "raw_getmakevar $1: ${make} is not executable"
471 nobomb_getmakevar "$1" || bomb "raw_getmakevar $1: ${make} failed"
474 getmakevar()
476 # raw_getmakevar() doesn't work properly if $make hasn't yet been
477 # built, which can happen when running with the "-n" option.
478 # getmakevar() deals with this by emitting a literal '$'
479 # followed by the variable name, instead of trying to find the
480 # variable's value.
482 if [ -x "${make}" ]; then
483 raw_getmakevar "$1"
484 else
485 echo "\$$1"
489 setmakeenv()
491 eval "$1='$2'; export $1"
492 makeenv="${makeenv} $1"
495 unsetmakeenv()
497 eval "unset $1"
498 makeenv="${makeenv} $1"
501 # Convert possibly-relative paths to absolute paths by prepending
502 # ${TOP} if necessary. Also delete trailing "/", if any.
503 resolvepaths()
505 _OPTARG=
506 for oa in ${OPTARG}; do
507 case "${oa}" in
511 oa="${oa%/}"
514 oa="${TOP}/${oa%/}"
516 esac
517 _OPTARG="${_OPTARG} ${oa}"
518 done
519 OPTARG="${_OPTARG}"
522 # Convert possibly-relative path to absolute path by prepending
523 # ${TOP} if necessary. Also delete trailing "/", if any.
524 resolvepath()
526 case "${OPTARG}" in
530 OPTARG="${OPTARG%/}"
533 OPTARG="${TOP}/${OPTARG%/}"
535 esac
538 usage()
540 if [ -n "$*" ]; then
541 echo ""
542 echo "${progname}: $*"
544 cat <<_usage_
546 Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras]
547 [-D dest] [-j njob] [-M obj] [-m mach] [-N noisy]
548 [-O obj] [-R release] [-S seed] [-T tools]
549 [-V var=[value]] [-w wrapper] [-X x11src] [-Z var]
550 operation [...]
552 Build operations (all imply "obj" and "tools"):
553 build Run "make build".
554 distribution Run "make distribution" (includes DESTDIR/etc/ files).
555 release Run "make release" (includes kernels & distrib media).
557 Other operations:
558 help Show this message and exit.
559 makewrapper Create ${toolprefix}make-\${MACHINE} wrapper and ${toolprefix}make.
560 Always performed.
561 cleandir Run "make cleandir". [Default unless -u is used]
562 obj Run "make obj". [Default unless -o is used]
563 tools Build and install tools.
564 install=idir Run "make installworld" to \`idir' to install all sets
565 except \`etc'. Useful after "distribution" or "release"
566 kernel=conf Build kernel with config file \`conf'
567 releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR.
568 sets Create binary sets in
569 RELEASEDIR/RELEASEMACHINEDIR/binary/sets.
570 DESTDIR should be populated beforehand.
571 sourcesets Create source sets in RELEASEDIR/source/sets.
572 syspkgs Create syspkgs in
573 RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs.
574 iso-image Create CD-ROM image in RELEASEDIR/iso.
575 iso-image-source Create CD-ROM image with source in RELEASEDIR/iso.
576 params Display various make(1) parameters.
578 Options:
579 -a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
580 -B buildId Set BUILDID to buildId.
581 -C cdextras Set CDEXTRA to cdextras
582 -D dest Set DESTDIR to dest. [Default: destdir.MACHINE]
583 -E Set "expert" mode; disables various safety checks.
584 Should not be used without expert knowledge of the build system.
585 -h Print this help message.
586 -j njob Run up to njob jobs in parallel; see make(1) -j.
587 -M obj Set obj root directory to obj; sets MAKEOBJDIRPREFIX.
588 Unsets MAKEOBJDIR.
589 -m mach Set MACHINE to mach; not required if NetBSD native.
590 -N noisy Set the noisyness (MAKEVERBOSE) level of the build:
591 0 Minimal output ("quiet")
592 1 Describe what is occurring
593 2 Describe what is occurring and echo the actual command
594 3 Ignore the effect of the "@" prefix in make commands
595 4 Trace shell commands using the shell's -x flag
596 [Default: 2]
597 -n Show commands that would be executed, but do not execute them.
598 -O obj Set obj root directory to obj; sets a MAKEOBJDIR pattern.
599 Unsets MAKEOBJDIRPREFIX.
600 -o Set MKOBJDIRS=no; do not create objdirs at start of build.
601 -R release Set RELEASEDIR to release. [Default: releasedir]
602 -r Remove contents of TOOLDIR and DESTDIR before building.
603 -S seed Set BUILDSEED to seed. [Default: NetBSD-majorversion]
604 -T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
605 the environment, ${toolprefix}make will be (re)built unconditionally.
606 -U Set MKUNPRIVED=yes; build without requiring root privileges,
607 install from an UNPRIVED build with proper file permissions.
608 -u Set MKUPDATE=yes; do not run "make cleandir" first.
609 Without this, everything is rebuilt, including the tools.
610 -V v=[val] Set variable \`v' to \`val'.
611 -w wrapper Create ${toolprefix}make script as wrapper.
612 [Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE}]
613 -X x11src Set X11SRCDIR to x11src. [Default: /usr/xsrc]
614 -x Set MKX11=yes; build X11 from X11SRCDIR
615 -Z v Unset ("zap") variable \`v'.
617 _usage_
618 exit 1
621 parseoptions()
623 opts='a:B:C:D:Ehj:M:m:N:nO:oR:rS:T:UuV:w:xX:Z:'
624 opt_a=no
626 if type getopts >/dev/null 2>&1; then
627 # Use POSIX getopts.
629 getoptcmd='getopts ${opts} opt && opt=-${opt}'
630 optargcmd=':'
631 optremcmd='shift $((${OPTIND} -1))'
632 else
633 type getopt >/dev/null 2>&1 ||
634 bomb "/bin/sh shell is too old; try ksh or bash"
636 # Use old-style getopt(1) (doesn't handle whitespace in args).
638 args="$(getopt ${opts} $*)"
639 [ $? = 0 ] || usage
640 set -- ${args}
642 getoptcmd='[ $# -gt 0 ] && opt="$1" && shift'
643 optargcmd='OPTARG="$1"; shift'
644 optremcmd=':'
647 # Parse command line options.
649 while eval ${getoptcmd}; do
650 case ${opt} in
653 eval ${optargcmd}
654 MACHINE_ARCH=${OPTARG}
655 opt_a=yes
659 eval ${optargcmd}
660 BUILDID=${OPTARG}
664 eval ${optargcmd}; resolvepaths
665 iso_dir=${OPTARG}
669 eval ${optargcmd}; resolvepath
670 setmakeenv DESTDIR "${OPTARG}"
674 do_expertmode=true
678 eval ${optargcmd}
679 parallel="-j ${OPTARG}"
683 eval ${optargcmd}; resolvepath
684 TOP_objdir="${OPTARG}${TOP}"
685 unsetmakeenv MAKEOBJDIR
686 setmakeenv MAKEOBJDIRPREFIX "${OPTARG}"
689 # -m overrides MACHINE_ARCH unless "-a" is specified
691 eval ${optargcmd}
692 MACHINE="${OPTARG}"
693 [ "${opt_a}" != "yes" ] && getarch
697 eval ${optargcmd}
698 case "${OPTARG}" in
699 0|1|2|3|4)
700 setmakeenv MAKEVERBOSE "${OPTARG}"
703 usage "'${OPTARG}' is not a valid value for -N"
705 esac
709 runcmd=echo
713 eval ${optargcmd}; resolvepath
714 TOP_objdir="${OPTARG}"
715 unsetmakeenv MAKEOBJDIRPREFIX
716 setmakeenv MAKEOBJDIR "\${.CURDIR:C,^$TOP,$OPTARG,}"
720 MKOBJDIRS=no
724 eval ${optargcmd}; resolvepath
725 setmakeenv RELEASEDIR "${OPTARG}"
729 do_removedirs=true
730 do_rebuildmake=true
734 eval ${optargcmd}
735 setmakeenv BUILDSEED "${OPTARG}"
739 eval ${optargcmd}; resolvepath
740 TOOLDIR="${OPTARG}"
741 export TOOLDIR
745 setmakeenv MKUNPRIVED yes
749 setmakeenv MKUPDATE yes
753 eval ${optargcmd}
754 case "${OPTARG}" in
755 # XXX: consider restricting which variables can be changed?
756 [a-zA-Z_][a-zA-Z_0-9]*=*)
757 setmakeenv "${OPTARG%%=*}" "${OPTARG#*=}"
760 usage "-V argument must be of the form 'var=[value]'"
762 esac
766 eval ${optargcmd}; resolvepath
767 makewrapper="${OPTARG}"
771 eval ${optargcmd}; resolvepath
772 setmakeenv X11SRCDIR "${OPTARG}"
776 setmakeenv MKX11 yes
780 eval ${optargcmd}
781 # XXX: consider restricting which variables can be unset?
782 unsetmakeenv "${OPTARG}"
786 break
789 -'?'|-h)
790 usage
793 esac
794 done
796 # Validate operations.
798 eval ${optremcmd}
799 while [ $# -gt 0 ]; do
800 op=$1; shift
801 operations="${operations} ${op}"
803 case "${op}" in
805 help)
806 usage
809 makewrapper|cleandir|obj|tools|build|distribution|release|sets|sourcesets|syspkgs|params)
812 iso-image)
813 op=iso_image # used as part of a variable name
816 iso-image-source)
817 op=iso_image_source # used as part of a variable name
820 kernel=*|releasekernel=*)
821 arg=${op#*=}
822 op=${op%%=*}
823 [ -n "${arg}" ] ||
824 bomb "Must supply a kernel name with \`${op}=...'"
827 install=*)
828 arg=${op#*=}
829 op=${op%%=*}
830 [ -n "${arg}" ] ||
831 bomb "Must supply a directory with \`install=...'"
835 usage "Unknown operation \`${op}'"
838 esac
839 eval do_${op}=true
840 done
841 [ -n "${operations}" ] || usage "Missing operation to perform."
843 # Set up MACHINE*. On a NetBSD host, these are allowed to be unset.
845 if [ -z "${MACHINE}" ]; then
846 [ "${uname_s}" = "NetBSD" ] ||
847 bomb "MACHINE must be set, or -m must be used, for cross builds."
848 MACHINE=${uname_m}
850 [ -n "${MACHINE_ARCH}" ] || getarch
851 validatearch
853 # Set up default make(1) environment.
855 makeenv="${makeenv} TOOLDIR MACHINE MACHINE_ARCH MAKEFLAGS"
856 [ -z "${BUILDID}" ] || makeenv="${makeenv} BUILDID"
857 MAKEFLAGS="-de -m ${TOP}/share/mk ${MAKEFLAGS} MKOBJDIRS=${MKOBJDIRS-yes}"
858 export MAKEFLAGS MACHINE MACHINE_ARCH
861 sanitycheck()
863 # If the PATH contains any non-absolute components (including,
864 # but not limited to, "." or ""), then complain. As an exception,
865 # allow "" or "." as the last component of the PATH. This is fatal
866 # if expert mode is not in effect.
868 local path="${PATH}"
869 path="${path%:}" # delete trailing ":"
870 path="${path%:.}" # delete trailing ":."
871 case ":${path}:/" in
872 *:[!/]*)
873 if ${do_expertmode}; then
874 warning "PATH contains non-absolute components"
875 else
876 bomb "PATH environment variable must not" \
877 "contain non-absolute components"
880 esac
883 # Try to set a value for TOOLDIR. This is difficult because of a cyclic
884 # dependency: TOOLDIR may be affected by settings in /etc/mk.conf, so
885 # we would like to use getmakevar to get the value of TOOLDIR, but we
886 # can't use getmakevar before we have an up to date version of nbmake;
887 # we might already have an up to date version of nbmake in TOOLDIR, but
888 # we don't yet know where TOOLDIR is.
890 # In principle, we could break the cycle by building a copy of nbmake
891 # in a temporary directory. However, people who use the default value
892 # of TOOLDIR do not like to have nbmake rebuilt every time they run
893 # build.sh.
895 # We try to please everybody as follows:
897 # * If TOOLDIR was set in the environment or on the command line, use
898 # that value.
899 # * Otherwise try to guess what TOOLDIR would be if not overridden by
900 # /etc/mk.conf, and check whether the resulting directory contains
901 # a copy of ${toolprefix}make (this should work for everybody who
902 # doesn't override TOOLDIR via /etc/mk.conf);
903 # * Failing that, search for ${toolprefix}make, nbmake, bmake, or make,
904 # in the PATH (this might accidentally find a non-NetBSD version of
905 # make, which will lead to failure in the next step);
906 # * If a copy of make was found above, try to use it with
907 # nobomb_getmakevar to find the correct value for TOOLDIR;
908 # * If all else fails, leave TOOLDIR unset. Our caller is expected to
909 # be able to cope with this.
911 try_set_TOOLDIR()
913 [ -n "${TOOLDIR}" ] && return
915 # Set host_ostype to something like "NetBSD-4.5.6-i386". This
916 # is intended to match the HOST_OSTYPE variable in <bsd.own.mk>.
918 local host_ostype="${uname_s}-$(
919 echo "${uname_r}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
920 )-$(
921 echo "${uname_p}" | sed -e 's/([^)]*)//g' -e 's/ /_/g'
924 # Look in a few potential locations for
925 # ${possible_TOOLDIR}/bin/${toolprefix}make.
926 # If we find it, then set guess_make.
928 # In the usual case (without interference from environment
929 # variables or /etc/mk.conf), <bsd.own.mk> should set TOOLDIR to
930 # "${TOP_objdir}/tooldir.${host_ostype}". However, in practice
931 # we might have the wrong value of TOP_objdir, so we also try
932 # some other possibilities.
934 local possible_TOP_OBJ
935 local possible_TOOLDIR
936 for possible_TOP_OBJ in "${TOP_objdir}" "${TOP}" "${TOP}/obj" \
937 "${TOP}/obj.${MACHINE}"
939 possible_TOOLDIR="${possible_TOP_OBJ}/tooldir.${host_ostype}"
940 guess_make="${possible_TOOLDIR}/bin/${toolprefix}make"
941 if [ -x "${guess_make}" ]; then
942 break;
943 else
944 unset guess_make
946 done
948 # If the above didn't work, search the PATH for a suitable
949 # ${toolprefix}make, nbmake, bmake, or make.
951 : ${guess_make:=$(find_in_PATH ${toolprefix}make '')}
952 : ${guess_make:=$(find_in_PATH nbmake '')}
953 : ${guess_make:=$(find_in_PATH bmake '')}
954 : ${guess_make:=$(find_in_PATH make '')}
956 # Use ${guess_make} with nobomb_getmakevar to try to find
957 # the value of TOOLDIR. If this fails, unset TOOLDIR.
959 unset TOOLDIR
960 if [ -x "${guess_make}" ]; then
961 TOOLDIR=$(make="${guess_make}" nobomb_getmakevar TOOLDIR)
962 [ $? -eq 0 -a -n "${TOOLDIR}" ] || unset TOOLDIR
966 rebuildmake()
968 # Test make source file timestamps against installed ${toolprefix}make
969 # binary, if TOOLDIR is pre-set or if try_set_TOOLDIR can set it.
971 try_set_TOOLDIR
972 make="${TOOLDIR-nonexistent}/bin/${toolprefix}make"
973 if [ -x "${make}" ]; then
974 for f in usr.bin/make/*.[ch] usr.bin/make/lst.lib/*.[ch]; do
975 if [ "${f}" -nt "${make}" ]; then
976 statusmsg "${make} outdated (older than ${f}), needs building."
977 do_rebuildmake=true
978 break
980 done
981 else
982 statusmsg "No ${make}, needs building."
983 do_rebuildmake=true
986 # Build bootstrap ${toolprefix}make if needed.
987 if ${do_rebuildmake}; then
988 statusmsg "Bootstrapping ${toolprefix}make"
989 ${runcmd} cd "${tmpdir}"
990 ${runcmd} env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \
991 CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
992 ${HOST_SH} "${TOP}/tools/make/configure" ||
993 bomb "Configure of ${toolprefix}make failed"
994 ${runcmd} ${HOST_SH} buildmake.sh ||
995 bomb "Build of ${toolprefix}make failed"
996 make="${tmpdir}/${toolprefix}make"
997 ${runcmd} cd "${TOP}"
998 ${runcmd} rm -f usr.bin/make/*.o usr.bin/make/lst.lib/*.o
1002 validatemakeparams()
1004 if [ "${runcmd}" = "echo" ]; then
1005 TOOLCHAIN_MISSING=no
1006 EXTERNAL_TOOLCHAIN=""
1007 else
1008 TOOLCHAIN_MISSING=$(raw_getmakevar TOOLCHAIN_MISSING)
1009 EXTERNAL_TOOLCHAIN=$(raw_getmakevar EXTERNAL_TOOLCHAIN)
1011 if [ "${TOOLCHAIN_MISSING}" = "yes" ] && \
1012 [ -z "${EXTERNAL_TOOLCHAIN}" ]; then
1013 ${runcmd} echo "ERROR: build.sh (in-tree cross-toolchain) is not yet available for"
1014 ${runcmd} echo " MACHINE: ${MACHINE}"
1015 ${runcmd} echo " MACHINE_ARCH: ${MACHINE_ARCH}"
1016 ${runcmd} echo ""
1017 ${runcmd} echo "All builds for this platform should be done via a traditional make"
1018 ${runcmd} echo "If you wish to use an external cross-toolchain, set"
1019 ${runcmd} echo " EXTERNAL_TOOLCHAIN=<path to toolchain root>"
1020 ${runcmd} echo "in either the environment or mk.conf and rerun"
1021 ${runcmd} echo " ${progname} $*"
1022 exit 1
1025 # Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE
1026 # These may be set as build.sh options or in "mk.conf".
1027 # Don't export them as they're only used for tests in build.sh.
1029 MKOBJDIRS=$(getmakevar MKOBJDIRS)
1030 MKUNPRIVED=$(getmakevar MKUNPRIVED)
1031 MKUPDATE=$(getmakevar MKUPDATE)
1033 if [ "${MKOBJDIRS}" != "no" ]; then
1034 # Try to create the top level object directory before
1035 # running "make obj", otherwise <bsd.own.mk> will not
1036 # set the correct value for _SRC_TOP_OBJ_.
1038 # If either -M or -O was specified, then we have the
1039 # directory name already.
1041 # If neither -M nor -O was specified, then try to get
1042 # the directory name from bsd.obj.mk's __usrobjdir
1043 # variable, which is set using complex rules. This
1044 # works only if TOP = /usr/src.
1046 top_obj_dir="${TOP_objdir}"
1047 if [ -z "${top_obj_dir}" ]; then
1048 if [ "$TOP" = "/usr/src" ]; then
1049 top_obj_dir="$(getmakevar __usrobjdir)"
1050 # else __usrobjdir is not actually used
1054 case "$top_obj_dir" in
1055 */*)
1056 ${runcmd} mkdir -p "${top_obj_dir}" \
1057 || bomb "Can't create object" \
1058 "directory ${top_obj_dir}"
1061 # We don't know what the top level object
1062 # directory should be, so we can't create it.
1063 # A nonexistant directory might cause an error
1064 # when we "make obj" later, but we ignore it for
1065 # now.
1067 esac
1069 # make obj in tools to ensure that the objdir for the top-level
1070 # of the source tree and for "tools" is available, in case the
1071 # default TOOLDIR setting from <bsd.own.mk> is used, or the
1072 # build.sh default DESTDIR and RELEASEDIR is to be used.
1074 ${runcmd} cd tools
1075 ${runcmd} "${make}" -m ${TOP}/share/mk obj NOSUBDIR= ||
1076 bomb "Failed to make obj in tools"
1077 ${runcmd} cd "${TOP}"
1080 # Find TOOLDIR, DESTDIR, RELEASEDIR, and RELEASEMACHINEDIR.
1082 TOOLDIR=$(getmakevar TOOLDIR)
1083 statusmsg "TOOLDIR path: ${TOOLDIR}"
1084 DESTDIR=$(getmakevar DESTDIR)
1085 RELEASEDIR=$(getmakevar RELEASEDIR)
1086 RELEASEMACHINEDIR=$(getmakevar RELEASEMACHINEDIR)
1087 if ! $do_expertmode; then
1088 _SRC_TOP_OBJ_=$(getmakevar _SRC_TOP_OBJ_)
1089 : ${DESTDIR:=${_SRC_TOP_OBJ_}/destdir.${MACHINE}}
1090 : ${RELEASEDIR:=${_SRC_TOP_OBJ_}/releasedir}
1091 makeenv="${makeenv} DESTDIR RELEASEDIR"
1093 export TOOLDIR DESTDIR RELEASEDIR
1094 statusmsg "DESTDIR path: ${DESTDIR}"
1095 statusmsg "RELEASEDIR path: ${RELEASEDIR}"
1097 # Check validity of TOOLDIR and DESTDIR.
1099 if [ -z "${TOOLDIR}" ] || [ "${TOOLDIR}" = "/" ]; then
1100 bomb "TOOLDIR '${TOOLDIR}' invalid"
1102 removedirs="${TOOLDIR}"
1104 if [ -z "${DESTDIR}" ] || [ "${DESTDIR}" = "/" ]; then
1105 if ${do_build} || ${do_distribution} || ${do_release}; then
1106 if ! ${do_build} || \
1107 [ "${uname_s}" != "NetBSD" ] || \
1108 [ "${uname_m}" != "${MACHINE}" ]; then
1109 bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'."
1111 if ! ${do_expertmode}; then
1112 bomb "DESTDIR must != / for non -E (expert) builds"
1114 statusmsg "WARNING: Building to /, in expert mode."
1115 statusmsg " This may cause your system to break! Reasons include:"
1116 statusmsg " - your kernel is not up to date"
1117 statusmsg " - the libraries or toolchain have changed"
1118 statusmsg " YOU HAVE BEEN WARNED!"
1120 else
1121 removedirs="${removedirs} ${DESTDIR}"
1123 if ${do_build} || ${do_distribution} || ${do_release}; then
1124 if ! ${do_expertmode} && \
1125 [ "$id_u" -ne 0 ] && \
1126 [ "${MKUNPRIVED}" = "no" ] ; then
1127 bomb "-U or -E must be set for build as an unprivileged user."
1130 if ${do_releasekernel} && [ -z "${RELEASEDIR}" ]; then
1131 bomb "Must set RELEASEDIR with \`releasekernel=...'"
1134 # Install as non-root is a bad idea.
1136 if ${do_install} && [ "$id_u" -ne 0 ] ; then
1137 if ${do_expertmode}; then
1138 warning "Will install as an unprivileged user."
1139 else
1140 bomb "-E must be set for install as an unprivileged user."
1144 # If a previous build.sh run used -U (and therefore created a
1145 # METALOG file), then most subsequent build.sh runs must also
1146 # use -U. If DESTDIR is about to be removed, then don't perform
1147 # this check.
1149 case "${do_removedirs} ${removedirs} " in
1150 true*" ${DESTDIR} "*)
1151 # DESTDIR is about to be removed
1154 if ( ${do_build} || ${do_distribution} || ${do_release} || \
1155 ${do_install} ) && \
1156 [ -e "${DESTDIR}/METALOG" ] && \
1157 [ "${MKUNPRIVED}" = "no" ] ; then
1158 if $do_expertmode; then
1159 warning "A previous build.sh run specified -U."
1160 else
1161 bomb "A previous build.sh run specified -U; you must specify it again now."
1165 esac
1169 createmakewrapper()
1171 # Remove the target directories.
1173 if ${do_removedirs}; then
1174 for f in ${removedirs}; do
1175 statusmsg "Removing ${f}"
1176 ${runcmd} rm -r -f "${f}"
1177 done
1180 # Recreate $TOOLDIR.
1182 ${runcmd} mkdir -p "${TOOLDIR}/bin" ||
1183 bomb "mkdir of '${TOOLDIR}/bin' failed"
1185 # Install ${toolprefix}make if it was built.
1187 if ${do_rebuildmake}; then
1188 ${runcmd} rm -f "${TOOLDIR}/bin/${toolprefix}make"
1189 ${runcmd} cp "${make}" "${TOOLDIR}/bin/${toolprefix}make" ||
1190 bomb "Failed to install \$TOOLDIR/bin/${toolprefix}make"
1191 make="${TOOLDIR}/bin/${toolprefix}make"
1192 statusmsg "Created ${make}"
1195 # Build a ${toolprefix}make wrapper script, usable by hand as
1196 # well as by build.sh.
1198 if [ -z "${makewrapper}" ]; then
1199 makewrapper="${TOOLDIR}/bin/${toolprefix}make-${makewrappermachine:-${MACHINE}}"
1200 [ -z "${BUILDID}" ] || makewrapper="${makewrapper}-${BUILDID}"
1203 ${runcmd} rm -f "${makewrapper}"
1204 if [ "${runcmd}" = "echo" ]; then
1205 echo 'cat <<EOF >'${makewrapper}
1206 makewrapout=
1207 else
1208 makewrapout=">>\${makewrapper}"
1211 case "${KSH_VERSION:-${SH_VERSION}}" in
1212 *PD\ KSH*|*MIRBSD\ KSH*)
1213 set +o braceexpand
1215 esac
1217 eval cat <<EOF ${makewrapout}
1218 #! ${HOST_SH}
1219 # Set proper variables to allow easy "make" building of a NetBSD subtree.
1220 # Generated from: \$NetBSD: build.sh,v 1.205 2009/03/09 06:25:51 apb Exp $
1221 # with these arguments: ${_args}
1226 for f in ${makeenv}; do
1227 if eval "[ -z \"\${$f}\" -a \"\${${f}-X}\" = \"X\" ]"; then
1228 eval echo "unset ${f}"
1229 else
1230 eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}"
1232 done
1234 eval cat <<EOF
1235 MAKEWRAPPERMACHINE=${makewrappermachine:-${MACHINE}}; export MAKEWRAPPERMACHINE
1236 USETOOLS=yes; export USETOOLS
1238 } | eval sort -u "${makewrapout}"
1239 eval cat <<EOF "${makewrapout}"
1241 exec "\${TOOLDIR}/bin/${toolprefix}make" \${1+"\$@"}
1243 [ "${runcmd}" = "echo" ] && echo EOF
1244 ${runcmd} chmod +x "${makewrapper}"
1245 statusmsg "makewrapper: ${makewrapper}"
1246 statusmsg "Updated ${makewrapper}"
1249 make_in_dir()
1251 dir="$1"
1252 op="$2"
1253 ${runcmd} cd "${dir}" ||
1254 bomb "Failed to cd to \"${dir}\""
1255 ${runcmd} "${makewrapper}" ${parallel} ${op} ||
1256 bomb "Failed to make ${op} in \"${dir}\""
1257 ${runcmd} cd "${TOP}" ||
1258 bomb "Failed to cd back to \"${TOP}\""
1261 buildtools()
1263 if [ "${MKOBJDIRS}" != "no" ]; then
1264 ${runcmd} "${makewrapper}" ${parallel} obj-tools ||
1265 bomb "Failed to make obj-tools"
1267 if [ "${MKUPDATE}" = "no" ]; then
1268 make_in_dir tools cleandir
1270 make_in_dir tools dependall
1271 make_in_dir tools install
1272 statusmsg "Tools built to ${TOOLDIR}"
1275 getkernelconf()
1277 kernelconf="$1"
1278 if [ "${MKOBJDIRS}" != "no" ]; then
1279 # The correct value of KERNOBJDIR might
1280 # depend on a prior "make obj" in
1281 # ${KERNSRCDIR}/${KERNARCHDIR}/compile.
1283 KERNSRCDIR="$(getmakevar KERNSRCDIR)"
1284 KERNARCHDIR="$(getmakevar KERNARCHDIR)"
1285 make_in_dir "${KERNSRCDIR}/${KERNARCHDIR}/compile" obj
1287 KERNCONFDIR="$(getmakevar KERNCONFDIR)"
1288 KERNOBJDIR="$(getmakevar KERNOBJDIR)"
1289 case "${kernelconf}" in
1290 */*)
1291 kernelconfpath="${kernelconf}"
1292 kernelconfname="${kernelconf##*/}"
1295 kernelconfpath="${KERNCONFDIR}/${kernelconf}"
1296 kernelconfname="${kernelconf}"
1298 esac
1299 kernelbuildpath="${KERNOBJDIR}/${kernelconfname}"
1302 buildkernel()
1304 if ! ${do_tools} && ! ${buildkernelwarned:-false}; then
1305 # Building tools every time we build a kernel is clearly
1306 # unnecessary. We could try to figure out whether rebuilding
1307 # the tools is necessary this time, but it doesn't seem worth
1308 # the trouble. Instead, we say it's the user's responsibility
1309 # to rebuild the tools if necessary.
1311 statusmsg "Building kernel without building new tools"
1312 buildkernelwarned=true
1314 getkernelconf $1
1315 statusmsg "Building kernel: ${kernelconf}"
1316 statusmsg "Build directory: ${kernelbuildpath}"
1317 ${runcmd} mkdir -p "${kernelbuildpath}" ||
1318 bomb "Cannot mkdir: ${kernelbuildpath}"
1319 if [ "${MKUPDATE}" = "no" ]; then
1320 make_in_dir "${kernelbuildpath}" cleandir
1322 [ -x "${TOOLDIR}/bin/${toolprefix}config" ] \
1323 || bomb "${TOOLDIR}/bin/${toolprefix}config does not exist. You need to \"$0 tools\" first."
1324 ${runcmd} "${TOOLDIR}/bin/${toolprefix}config" -b "${kernelbuildpath}" \
1325 -s "${TOP}/sys" "${kernelconfpath}" ||
1326 bomb "${toolprefix}config failed for ${kernelconf}"
1327 make_in_dir "${kernelbuildpath}" depend
1328 make_in_dir "${kernelbuildpath}" all
1330 if [ "${runcmd}" != "echo" ]; then
1331 statusmsg "Kernels built from ${kernelconf}:"
1332 kernlist=$(awk '$1 == "config" { print $2 }' ${kernelconfpath})
1333 for kern in ${kernlist:-netbsd}; do
1334 [ -f "${kernelbuildpath}/${kern}" ] && \
1335 echo " ${kernelbuildpath}/${kern}"
1336 done | tee -a "${results}"
1340 releasekernel()
1342 getkernelconf $1
1343 kernelreldir="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"
1344 ${runcmd} mkdir -p "${kernelreldir}"
1345 kernlist=$(awk '$1 == "config" { print $2 }' ${kernelconfpath})
1346 for kern in ${kernlist:-netbsd}; do
1347 builtkern="${kernelbuildpath}/${kern}"
1348 [ -f "${builtkern}" ] || continue
1349 releasekern="${kernelreldir}/${kern}-${kernelconfname}.gz"
1350 statusmsg "Kernel copy: ${releasekern}"
1351 if [ "${runcmd}" = "echo" ]; then
1352 echo "gzip -c -9 < ${builtkern} > ${releasekern}"
1353 else
1354 gzip -c -9 < "${builtkern}" > "${releasekern}"
1356 done
1359 installworld()
1361 dir="$1"
1362 ${runcmd} "${makewrapper}" INSTALLWORLDDIR="${dir}" installworld ||
1363 bomb "Failed to make installworld to ${dir}"
1364 statusmsg "Successful installworld to ${dir}"
1368 main()
1370 initdefaults
1371 _args=$@
1372 parseoptions "$@"
1374 sanitycheck
1376 build_start=$(date)
1377 statusmsg "${progname} command: $0 $@"
1378 statusmsg "${progname} started: ${build_start}"
1379 statusmsg "NetBSD version: ${DISTRIBVER}"
1380 statusmsg "MACHINE: ${MACHINE}"
1381 statusmsg "MACHINE_ARCH: ${MACHINE_ARCH}"
1382 statusmsg "Build platform: ${uname_s} ${uname_r} ${uname_m}"
1383 statusmsg "HOST_SH: ${HOST_SH}"
1385 rebuildmake
1386 validatemakeparams
1387 createmakewrapper
1389 # Perform the operations.
1391 for op in ${operations}; do
1392 case "${op}" in
1394 makewrapper)
1395 # no-op
1398 tools)
1399 buildtools
1402 sets)
1403 statusmsg "Building sets from pre-populated ${DESTDIR}"
1404 ${runcmd} "${makewrapper}" ${parallel} ${op} ||
1405 bomb "Failed to make ${op}"
1406 setdir=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
1407 statusmsg "Built sets to ${setdir}"
1410 cleandir|obj|build|distribution|release|sourcesets|syspkgs|params)
1411 ${runcmd} "${makewrapper}" ${parallel} ${op} ||
1412 bomb "Failed to make ${op}"
1413 statusmsg "Successful make ${op}"
1416 iso-image|iso-image-source)
1417 ${runcmd} "${makewrapper}" ${parallel} \
1418 CDEXTRA="$iso_dir" ${op} ||
1419 bomb "Failed to make ${op}"
1420 statusmsg "Successful make ${op}"
1423 kernel=*)
1424 arg=${op#*=}
1425 buildkernel "${arg}"
1428 releasekernel=*)
1429 arg=${op#*=}
1430 releasekernel "${arg}"
1433 install=*)
1434 arg=${op#*=}
1435 if [ "${arg}" = "/" ] && \
1436 ( [ "${uname_s}" != "NetBSD" ] || \
1437 [ "${uname_m}" != "${MACHINE}" ] ); then
1438 bomb "'${op}' must != / for cross builds."
1440 installworld "${arg}"
1444 bomb "Unknown operation \`${op}'"
1447 esac
1448 done
1450 statusmsg "${progname} ended: $(date)"
1451 if [ -s "${results}" ]; then
1452 echo "===> Summary of results:"
1453 sed -e 's/^===>//;s/^/ /' "${results}"
1454 echo "===> ."
1458 main "$@"