8000 minix/build.sh at R3.2.1 · dtytomi/minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
executable file
·
2075 lines (1843 loc) · 55.4 KB

build.sh

File metadata and controls

executable file
·
2075 lines (1843 loc) · 55.4 KB
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.256 2012/09/29 04:02:42 tsutsui Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Todd Vierling and Luke Mewburn.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
# Top level build wrapper, to build or cross-build NetBSD.
#
#
# {{{ Begin shell feature tests.
#
# We try to determine whether or not this script is being run under
# a shell that supports the features that we use. If not, we try to
# re-exec the script under another shell. If we can't find another
# suitable shell, then we print a message and exit.
#
errmsg='' # error message, if not empty
shelltest=false # if true, exit after testing the shell
re_exec_allowed=true # if true, we may exec under another shell
# Parse special command line options in $1. These special options are
# for internal use only, are not documented, and are not valid anywhere
# other than $1.
case "$1" in
"--shelltest")
shelltest=true
re_exec_allowed=false
shift
;;
"--no-re-exec")
re_exec_allowed=false
shift
;;
esac
# Solaris /bin/sh, and other SVR4 shells, do not support "!".
# This is the first feature that we test, because subsequent
# tests use "!".
#
if test -z "$errmsg"; then
if ( eval '! false' ) >/dev/null 2>&1 ; then
:
else
errmsg='Shell does not support "!".'
fi
fi
# Does the shell support functions?
#
if test -z "$errmsg"; then
if ! (
eval 'somefunction() { : ; }'
) >/dev/null 2>&1
then
errmsg='Shell does not support functions.'
fi
fi
# Does the shell support the "local" keyword for variables in functions?
#
# Local variables are not required by SUSv3, but some scripts run during
# the NetBSD build use them.
#
# ksh93 fails this test; it uses an incompatible syntax involving the
# keywords 'function' and 'typeset'.
#
if test -z "$errmsg"; then
if ! (
eval 'f() { local v=2; }; v=1; f && test x"$v" = x"1"'
) >/dev/null 2>&1
then
errmsg='Shell does not support the "local" keyword in functions.'
fi
fi
# Does the shell support ${var%suffix}, ${var#prefix}, and their variants?
#
# We don't bother testing for ${var+value}, ${var-value}, or their variants,
# since shells without those are sure to fail other tests too.
#
if test -z "$errmsg"; then
if ! (
eval 'var=a/b/c ;
test x"${var#*/};${var##*/};${var%/*};${var%%/*}" = \
x"b/c;c;a/b;a" ;'
) >/dev/null 2>&1
then
errmsg='Shell does not support "${var%suffix}" or "${var#prefix}".'
fi
fi
# Does the shell support IFS?
#
# zsh in normal mode (as opposed to "emulate sh" mode) fails this test.
#
if test -z "$errmsg"; then
if ! (
eval 'IFS=: ; v=":a b::c" ; set -- $v ; IFS=+ ;
test x"$#;$1,$2,$3,$4;$*" = x"4;,a b,,c;+a b++c"'
) >/dev/null 2>&1
then
errmsg='Shell does not support IFS word splitting.'
fi
fi
# Does the shell support ${1+"$@"}?
#
# Some versions of zsh fail this test, even in "emulate sh" mode.
#
if test -z "$errmsg"; then
if ! (
eval 'set -- "a a a" "b b b"; set -- ${1+"$@"};
test x"$#;$1;$2" = x"2;a a a;b b b";'
) >/dev/null 2>&1
then
errmsg='Shell does not support ${1+"$@"}.'
fi
fi
# Does the shell support $(...) command substitution?
#
if test -z "$errmsg"; then
if ! (
eval 'var=$(echo abc); test x"$var" = x"abc"'
) >/dev/null 2>&1
then
errmsg='Shell does not support "$(...)" command substitution.'
fi
fi
# Does the shell support $(...) command substitution with
# unbalanced parentheses?
#
# Some shells known to fail this test are: NetBSD /bin/ksh (as of 2009-12),
# bash-3.1, pdksh-5.2.14, zsh-4.2.7 in "emulate sh" mode.
#
if test -z "$errmsg"; then
if ! (
eval 'var=$(case x in x) echo abc;; esac); test x"$var" = x"abc"'
) >/dev/null 2>&1
then
# XXX: This test is ignored because so many shells fail it; instead,
# the NetBSD build avoids using the problematic construct.
: ignore 'Shell does not support "$(...)" with unbalanced ")".'
fi
fi
# Does the shell support getopts or getopt?
#
if test -z "$errmsg"; then
if ! (
eval 'type getopts || type getopt'
) >/dev/null 2>&1
then
errmsg='Shell does not support getopts or getopt.'
fi
fi
#
# If shelltest is true, exit now, reporting whether or not the shell is good.
#
if $shelltest; then
if test -n "$errmsg"; then
echo >&2 "$0: $errmsg"
exit 1
else
exit 0
fi
fi
#
# If the shell was bad, try to exec a better shell, or report an error.
#
# Loops are broken by passing an extra "--no-re-exec" flag to the new
# instance of this script.
#
if test -n "$errmsg"; then
if $re_exec_allowed; then
for othershell in \
"${HOST_SH}" /usr/xpg4/bin/sh ksh ksh88 mksh pdksh bash dash
# NOTE: some shells known not to work are:
# any shell using csh syntax;
# Solaris /bin/sh (missing many modern features);
# ksh93 (incompatible syntax for local variables);
# zsh (many differences, unless run in compatibility mode).
do
test -n "$othershell" || continue
if eval 'type "$othershell"' >/dev/null 2>&1 \
&& "$othershell" "$0" --shelltest >/dev/null 2>&1
then
cat <<EOF
$0: $errmsg
$0: Retrying under $othershell
EOF
HOST_SH="$othershell"
export HOST_SH
exec $othershell "$0" --no-re-exec "$@" # avoid ${1+"$@"}
fi
# If HOST_SH was set, but failed the test above,
# then give up without trying any other shells.
test x"${othershell}" = x"${HOST_SH}" && break
done
fi
#
# If we get here, then the shell is bad, and we either could not
# find a replacement, or were not allowed to try a replacement.
#
cat <<EOF
$0: $errmsg
The NetBSD build system requires a shell that supports modern POSIX
features, as well as the "local" keyword in functions (which is a
widely-implemented but non-standardised feature).
Please re-run this script under a suitable shell. For example:
/path/to/suitable/shell $0 ...
The above command will usually enable build.sh to automatically set
HOST_SH=/path/to/suitable/shell, but if that fails, then you may also
need to explicitly set the HOST_SH environment variable, as follows:
HOST_SH=/path/to/suitable/shell
export HOST_SH
\${HOST_SH} $0 ...
EOF
exit 1
fi
#
# }}} End shell feature tests.
#
progname=${0##*/}
toppid=$$
results=/dev/null
tab=' '
trap "exit 1" 1 2 3 15
bomb()
{
cat >&2 <<ERRORMESSAGE
ERROR: $@
*** BUILD ABORTED ***
ERRORMESSAGE
kill ${toppid} # in case we were invoked from a subshell
exit 1
}
statusmsg()
{
${runcmd} echo "===> $@" | tee -a "${results}"
}
statusmsg2()
{
local msg
msg="${1}"
shift
case "${msg}" in
????????????????*) ;;
??????????*) msg="${msg} ";;
?????*) msg="${msg} ";;
*) msg="${msg} ";;
esac
case "${msg}" in
?????????????????????*) ;;
????????????????????) msg="${msg} ";;
???????????????????) msg="${msg} ";;
??????????????????) msg="${msg} ";;
?????????????????) msg="${msg} ";;
????????????????) msg="${msg} ";;
esac
statusmsg "${msg}$*"
}
warning()
{
statusmsg "Warning: $@"
}
# Find a program in the PATH, and print the result. If not found,
# print a default. If $2 is defined (even if it is an empty string),
# then that is the default; otherwise, $1 is used as the default.
find_in_PATH()
{
local prog="$1"
local result="${2-"$1"}"
local oldIFS="${IFS}"
local dir
IFS=":"
for dir in ${PATH}; do
if [ -x "${dir}/${prog}" ]; then
result="${dir}/${prog}"
break
fi
done
IFS="${oldIFS}"
echo "${result}"
}
# Try to find a working POSIX shell, and set HOST_SH to refer to it.
# Assumes that uname_s, uname_m, and PWD have been set.
set_HOST_SH()
{
# Even if ${HOST_SH} is already defined, we still do the
# sanity checks at the end.
# Solaris has /usr/xpg4/bin/sh.
#
[ -z "${HOST_SH}" ] && [ x"${uname_s}" = x"SunOS" ] && \
[ -x /usr/xpg4/bin/sh ] && HOST_SH="/usr/xpg4/bin/sh"
# Try to get the name of the shell that's running this script,
# by parsing the output from "ps". We assume that, if the host
# system's ps command supports -o comm at all, it will do so
# in the usual way: a one-line header followed by a one-line
# result, possibly including trailing white space. And if the
# host system's ps command doesn't support -o comm, we assume
# that we'll get an error message on stderr and nothing on
# stdout. (We don't try to use ps -o 'comm=' to suppress the
# header line, because that is less widely supported.)
#
# If we get the wrong result here, the user can override it by
# specifying HOST_SH in the environment.
#
[ -z "${HOST_SH}" ] && HOST_SH="$(
(ps -p $$ -o comm | sed -ne "2s/[ ${tab}]*\$//p") 2>/dev/null )"
# If nothing above worked, use "sh". We will later find the
# first directory in the PATH that has a "sh" program.
#
[ -z "${HOST_SH}" ] && HOST_SH="sh"
# If the result so far is not an absolute path, try to prepend
# PWD or search the PATH.
#
case "${HOST_SH}" in
/*) :
;;
*/*) HOST_SH="${PWD}/${HOST_SH}"
;;
*) HOST_SH="$(find_in_PATH "${HOST_SH}")"
;;
esac
# If we don't have an absolute path by now, bomb.
#
case "${HOST_SH}" in
/*) :
;;
*) bomb "HOST_SH=\"${HOST_SH}\" is not an absolute path."
;;
esac
# If HOST_SH is not executable, bomb.
#
[ -x "${HOST_SH}" ] ||
bomb "HOST_SH=\"${HOST_SH}\" is not executable."
# If HOST_SH fails tests, bomb.
# ("$0" may be a path that is no longer valid, because we have
# performed "cd $(dirname $0)", so don't use $0 here.)
#
"${HOST_SH}" build.sh --shelltest ||
bomb "HOST_SH=\"${HOST_SH}\" failed functionality tests."
}
# initdefaults --
# Set defaults before parsing command line options.
#
initdefaults()
{
makeenv=
makewrapper=
makewrappermachine=
runcmd=
operations=
removedirs=
[ -d usr.bin/make ] || cd "$(dirname $0)"
[ -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"
# Set various environment varia 8 bles to 10BC8 known defaults,
# to minimize (cross-)build problems observed "in the field".
#
# LC_ALL=C must be set before we try to parse the output from
# any command. Other variables are set (or unset) here, before
# we parse command line arguments.
#
# These variables can be overridden via "-V var=value" if
# you know what you are doing.
#
unsetmakeenv INFODIR
unsetmakeenv LESSCHARSET
unsetmakeenv MAKEFLAGS
setmakeenv LC_ALL C
# Find information about the build platform. This should be
# kept in sync with _HOST_OSNAME, _HOST_OSREL, and _HOST_ARCH
# variables in share/mk/bsd.sys.mk.
#
# Note that "uname -p" is not part of POSIX, but we want uname_p
# to be set to the host MACHINE_ARCH, if possible. On systems
# where "uname -p" fails, prints "unknown", or prints a string
# that does not look like an identifier, fall back to using the
# output from "uname -m" instead.
#
uname_s=$(uname -s 2>/dev/null)
uname_r=$(uname -r 2>/dev/null)
uname_m=$(uname -m 2>/dev/null)
uname_p=$(uname -p 2>/dev/null || echo "unknown")
case "${uname_p}" in
''|unknown|*[^-_A-Za-z0-9]*) uname_p="${uname_m}" ;;
esac
id_u=$(id -u 2>/dev/null || /usr/xpg4/bin/id -u 2>/dev/null)
# 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. Or many Linuces.
#
unset PWD
TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null)
# The user can set HOST_SH in the environment, or we try to
# guess an appropriate value. Then we set several other
# variables from HOST_SH.
#
set_HOST_SH
setmakeenv HOST_SH "${HOST_SH}"
setmakeenv BSHELL "${HOST_SH}"
setmakeenv CONFIG_SHELL "${HOST_SH}"
# Set defaults.
#
toolprefix=nb
# Some systems have a small ARG_MAX. -X prevents make(1) from
# exporting variables in the environment redundantly.
#
case "${uname_s}" in
Darwin | FreeBSD | CYGWIN*)
MAKEFLAGS="-X ${MAKEFLAGS}"
;;
esac
# do_{operation}=true if given operation is requested.
#
do_expertmode=false
do_rebuildmake=false
do_removedirs=false
do_tools=false
do_cleandir=false
do_obj=false
do_build=false
do_distribution=false
do_release=false
do_kernel=false
do_releasekernel=false
do_modules=false
do_installmodules=false
do_install=false
do_sets=false
do_sourcesets=false
do_syspkgs=false
do_iso_image=false
do_iso_image_source=false
do_live_image=false
do_install_image=false
do_params=false
do_rump=false
# done_{operation}=true if given operation has been done.
#
done_rebuildmake=false
# Create scratch directory
#
tmpdir="${TMPDIR-/tmp}/nbbuild$$"
mkdir "${tmpdir}" || bomb "Cannot mkdir: ${tmpdir}"
trap "cd /; rm -r -f \"${tmpdir}\"" 0
results="${tmpdir}/build.sh.results"
# Set source directories
#
setmakeenv NETBSDSRCDIR "${TOP}"
# Make sure KERNOBJDIR is an absolute path if defined
#
case "${KERNOBJDIR}" in
''|/*) ;;
*) KERNOBJDIR="${TOP}/${KERNOBJDIR}"
setmakeenv KERNOBJDIR "${KERNOBJDIR}"
;;
esac
# Find the version of NetBSD
#
DISTRIBVER="$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh)"
# Set the BUILDSEED to NetBSD-"N"
#
setmakeenv BUILDSEED "MINIX-$(${HOST_SH} ${TOP}/sys/conf/osrelease.sh -m)"
# Set MKARZERO to "yes"
#
setmakeenv MKARZERO "yes"
}
getarch()
{
# Translate some MACHINE name aliases (known only to build.sh)
# into proper MACHINE and MACHINE_ARCH names. Save the alias
# name in makewrappermachine.
#
case "${MACHINE}" in
evbearm-e[bl])
makewrappermachine=${MACHINE}
# MACHINE_ARCH is "arm" or "armeb", not "armel"
MACHINE_ARCH=earm${MACHINE##*-}
MACHINE_ARCH=${MACHINE_ARCH%el}
MACHINE=evbarm
;;
evbarm-e[bl])
makewrappermachine=${MACHINE}
# MACHINE_ARCH is "arm" or "armeb", not "armel"
MACHINE_ARCH=arm${MACHINE##*-}
MACHINE_ARCH=${MACHINE_ARCH%el}
MACHINE=${MACHINE%-e[bl]}
;;
evbmips-e[bl]|sbmips-e[bl])
makewrappermachine=${MACHINE}
MACHINE_ARCH=mips${MACHINE##*-}
MACHINE=${MACHINE%-e[bl]}
;;
evbmips64-e[bl]|sbmips64-e[bl])
makewrappermachine=${MACHINE}
MACHINE_ARCH=mips64${MACHINE##*-}
MACHINE=${MACHINE%64-e[bl]}
;;
evbsh3-e[bl])
makewrappermachine=${MACHINE}
MACHINE_ARCH=sh3${MACHINE##*-}
MACHINE=${MACHINE%-e[bl]}
;;
esac
# Translate a MACHINE into a default MACHINE_ARCH.
#
case "${MACHINE}" in
acorn26|acorn32|cats|hpcarm|iyonix|netwinder|shark|zaurus)
MACHINE_ARCH=arm
;;
evbarm) # unspecified MACHINE_ARCH gets LE
MACHINE_ARCH=${MACHINE_ARCH:=arm}
;;
hp700)
MACHINE_ARCH=hppa
;;
sun2)
MACHINE_ARCH=m68000
;;
amiga|atari|cesfic|hp300|luna68k|mac68k|mvme68k|news68k|next68k|sun3|x68k)
MACHINE_ARCH=m68k
;;
evbmips|sbmips) # no default MACHINE_ARCH
;;
sgimips64)
makewrappermachine=${MACHINE}
MACHINE=${MACHINE%64}
MACHINE_ARCH=mips64eb
;;
ews4800mips|mipsco|newsmips|sgimips|emips)
MACHINE_ARCH=mipseb
;;
algor64|arc64|cobalt64|pmax64)
makewrappermachine=${MACHINE}
MACHINE=${MACHINE%64}
MACHINE_ARCH=mips64el
;;
algor|arc|cobalt|hpcmips|pmax)
MACHINE_ARCH=mipsel
;;
evbppc64|macppc64|ofppc64)
makewrappermachine=${MACHINE}
MACHINE=${MACHINE%64}
MACHINE_ARCH=powerpc64
;;
amigappc|bebox|evbppc|ibmnws|macppc|mvmeppc|ofppc|prep|rs6000|sandpoint)
MACHINE_ARCH=powerpc
;;
evbsh3) # no default MACHINE_ARCH
;;
mmeye)
MACHINE_ARCH=sh3eb
;;
dreamcast|hpcsh|landisk)
MACHINE_ARCH=sh3el
;;
amd64)
MACHINE_ARCH=x86_64
;;
alpha|i386|sparc|sparc64|vax|ia64)
MACHINE_ARCH=${MACHINE}
;;
i[4-6]86)
# LSC FIXME: This is required as uname -m reports the actual machine.
# We will be able to remove this once our triple has been cleaned up
# (at this time we compile only for i386, and use an incorrect host triple)
MACHINE=i386
MACHINE_ARCH=i386
;;
*)
bomb "Unknown target MACHINE: ${MACHINE}"
;;
esac
}
validatearch()
{
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
#
case "${MACHINE_ARCH}" in
alpha|arm|armeb|earm|earmeb|hppa|i386|m68000|m68k|mipse[bl]|mips64e[bl]|powerpc|powerpc64|sh3e[bl]|sparc|sparc64|vax|x86_64|ia64)
;;
"")
bomb "No MACHINE_ARCH provided"
;;
*)
bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}"
;;
esac
# Determine valid MACHINE_ARCHs for MACHINE
#
case "${MACHINE}" in
evbarm)
arches="arm armeb earm earmeb"
;;
cats|iyonix|netwinder|shark|zaurus)
arches="arm earm"
;;
algor|arc|cobalt|pmax)
arches="mipsel mips64el"
;;
evbmips|sbmips)
arches="mipseb mipsel mips64eb mips64el"
;;
sgimips)
arches="mipseb mips64eb"
;;
evbsh3)
arches="sh3eb sh3el"
;;
macppc|evbppc|ofppc)
arches="powerpc powerpc64"
;;
*)
oma="${MACHINE_ARCH}"
getarch
arches="${MACHINE_ARCH}"
MACHINE_ARCH="${oma}"
;;
esac
# Ensure that MACHINE_ARCH supports MACHINE
#
archok=false
for a in ${arches}; do
if [ "${a}" = "${MACHINE_ARCH}" ]; then
archok=true
break
fi
done
${archok} ||
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'"
}
# nobomb_getmakevar --
# Given the name of a make variable in $1, print make's idea of the
# value of that variable, or return 1 if there's an error.
#
nobomb_getmakevar()
{
[ -x "${make}" ] || return 1
"${make}" -m ${TOP}/share/mk -s -B -f- _x_ <<EOF || return 1
_x_:
echo \${$1}
# LSC FIXME: We are cross compiling, so overwrite default and build tools
USETOOLS:=yes
.include <bsd.prog.mk>
.include <bsd.kernobj.mk>
EOF
}
# bomb_getmakevar --
# Given the name of a make variable in $1, print make's idea of the
# value of that variable, or bomb if there's an error.
#
bomb_getmakevar()
{
[ -x "${make}" ] || bomb "bomb_getmakevar $1: ${make} is not executable"
nobomb_getmakevar "$1" || bomb "bomb_getmakevar $1: ${make} failed"
}
# getmakevar --
# Given the name of a make variable in $1, print make's idea of the
# value of that variable, or print a literal '$' followed by the
# variable name if ${make} is not executable. This is intended for use in
# messages that need to be readable even if $make hasn't been built,
# such as when build.sh is run with the "-n" option.
#
getmakevar()
{
if [ -x "${make}" ]; then
bomb_getmakevar "$1"
else
echo "\$$1"
fi
}
setmakeenv()
{
eval "$1='$2'; export $1"
makeenv="${makeenv} $1"
}
unsetmakeenv()
{
eval "unset $1"
makeenv="${makeenv} $1"
}
# Given a variable name in $1, modify the variable in place as follows:
# For each space-separated word in the variable, call resolvepath.
resolvepaths()
{
local var="$1"
local val
eval val=\"\${${var}}\"
local newval=''
local word
for word in ${val}; do
resolvepath word
newval="${newval}${newval:+ }${word}"
done
eval ${var}=\"\${newval}\"
}
# Given a variable name in $1, modify the variable in place as follows:
# Convert possibly-relative path to absolute path by prepending
# ${TOP} if necessary. Also delete trailing "/", if any.
resolvepath()
{
local var="$1"
local val
eval val=\"\${${var}}\"
case "${val}" in
/)
;;
/*)
val="${val%/}"
;;
*)
val="${TOP}/${val%/}"
;;
esac
eval ${var}=\"\${val}\"
}
usage()
{
if [ -n "$*" ]; then
echo ""
echo "${progname}: $*"
fi
cat <<_usage_
Usage: ${progname} [-EhnorUuxy] [-a arch] [-B buildid] [-C cdextras]
[-D dest] [-j njob] [-M obj] [-m mach] [-N noisy]
[-O obj] [-R release] [-S seed] [-T tools]
[-V var=[value]] [-w wrapper] [-X x11src] [-Y extsrcsrc]
[-Z var]
operation [...]
Build operations (all imply "obj" and "tools"):
build Run "make build".
distribution Run "make distribution" (includes DESTDIR/etc/ files).
release Run "make release" (includes kernels & distrib media).
Other operations:
help Show this message and exit.
makewrapper Create ${toolprefix}make-\${MACHINE} wrapper and ${toolprefix}make.
Always performed.
cleandir Run "make cleandir". [Default unless -u is used]
obj Run "make obj". [Default unless -o is used]
tools Build and install tools.
install=idir Run "make installworld" to \`idir' to install all sets
except \`etc'. Useful after "distribution" or "release"
kernel=conf Build kernel with config file \`conf'
releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR.
installmodules=idir Run "make installmodules" to \`idir' to install all
kernel modules.
modules Build kernel modules.
rumptest Do a linktest for rump (for developers).
sets Create binary sets in
RELEASEDIR/RELEASEMACHINEDIR/binary/sets.
DESTDIR should be populated beforehand.
sourcesets Create source sets in RELEASEDIR/source/sets.
syspkgs Create syspkgs in
RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs.
iso-image Create CD-ROM image in RELEASEDIR/iso.
iso-image-source Create CD-ROM image with source in RELEASEDIR/iso.
live-image Create bootable live image in
RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage.
install-image Create bootable installation image in
RELEASEDIR/RELEASEMACHINEDIR/installation/installimage.
params Display various make(1) parameters.
Options:
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
-B buildid Set BUILDID to buildid.
-C cdextras Append cdextras to CDEXTRA variable for inclusion on CD-ROM.
-D dest Set DESTDIR to dest. [Default: destdir.MACHINE]
-E Set "expert" mode; disables various safety checks.
Should not be used without expert knowledge of the build system.
-h Print this help message.
-j njob Run up to njob jobs in parallel; see make(1) -j.
-M obj Set obj root directory to obj; sets MAKEOBJDIRPREFIX.
Unsets MAKEOBJDIR.
-m mach Set MACHINE to mach; not required if NetBSD native.
-N noisy Set the noisyness (MAKEVERBOSE) level of the build:
0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag
[Default: 2]
-n Show commands that would be executed, but do not execute them.
-O obj Set obj root directory to obj; sets a MAKEOBJDIR pattern.
Unsets MAKEOBJDIRPREFIX.
-o Set MKOBJDIRS=no; do not create objdirs at start of build.
-R release Set RELEASEDIR to release. [Default: releasedir]
-r Remove contents of TOOLDIR and DESTDIR before building.
-S seed Set BUILDSEED to seed. [Default: NetBSD-majorversion]
-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 MKUNPRIVED=yes; build without requiring root privileges,
install from an UNPRIVED build with proper file permissions.
-u Set MKUPDATE=yes; do not run "make cleandir" first.
Without this, everything is rebuilt, including the tools.
-V var=[value] Set variable \`var' to \`value'.
-w wrapper Create ${toolprefix}make script as wrapper.
[Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE}]
-X x11src Set X11SRCDIR to x11src. [Default: /usr/xsrc]
-x Set MKX11=yes; build X11 from X11SRCDIR
-Y extsrcsrc Set EXTSRCSRCDIR to extsrcsrc. [Default: /usr/extsrc]
-y Set MKEXTSRC=yes; build extsrc from EXTSRCSRCDIR
-Z var Unset ("zap") variable \`var'.
_usage_
exit 1
}
parseoptions()
{
opts='a:B:C:D:Ehj:M:m:N:nO:oR:rS:T:UuV:w:X:xY:yZ:'
opt_a=no
if type getopts >/dev/null 2>&1; then
# Use POSIX getopts.
#
getoptcmd='getopts ${opts} opt && opt=-${opt}'
optargcmd=':'
optremcmd='shift $((${OPTIND} -1))'
else
type getopt >/dev/null 2>&1 ||
bomb "Shell does not support getopts or getopt"
# Use old-style getopt(1) (doesn't handle whitespace in args).
#
args="$(getopt ${opts} $*)"
[ $? = 0 ] || usage
set -- ${args}
getoptcmd='[ $# -gt 0 ] && opt="$1" && shift'
optargcmd='OPTARG="$1"; shift'
optremcmd=':'
fi
# Parse command line options.
#
while eval ${getoptcmd}; do
case ${opt} in
-a)
eval ${optargcmd}
MACHINE_ARCH=${OPTARG}
opt_a=yes
;;
-B)
eval ${optargcmd}
BUILDID=${OPTARG}
;;
-C)
eval ${optargcmd}; resolvepaths OPTARG
CDEXTRA="${CDEXTRA}${CDEXTRA:+ }${OPTARG}"
;;
-D)
eval ${optargcmd}; resolvepath OPTARG
setmakeenv DESTDIR "${OPTARG}"
;;
-E)
do_expertmode=true
;;
-j)
eval ${optargcmd}
0