Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)

- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
2013-12-06 12:04:52 +01:00
parent ff10274392
commit 84d9c625bf
4655 changed files with 379317 additions and 151059 deletions

550
build.sh
View File

@@ -1,5 +1,5 @@
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.256 2012/09/29 04:02:42 tsutsui Exp $
# $NetBSD: build.sh,v 1.273 2013/08/30 10:29:06 pooka Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -263,6 +263,8 @@ progname=${0##*/}
toppid=$$
results=/dev/null
tab=' '
nl='
'
trap "exit 1" 1 2 3 15
bomb()
@@ -428,6 +430,7 @@ initdefaults()
unsetmakeenv INFODIR
unsetmakeenv LESSCHARSET
unsetmakeenv MAKEFLAGS
unsetmakeenv TERMINFO
setmakeenv LC_ALL C
# Find information about the build platform. This should be
@@ -505,7 +508,8 @@ initdefaults()
do_iso_image_source=false
do_live_image=false
do_install_image=false
do_params=false
do_disk_image=false
do_show_params=false
do_rump=false
# done_{operation}=true if given operation has been done.
@@ -546,211 +550,255 @@ initdefaults()
}
# valid_MACHINE_ARCH -- A multi-line string, listing all valid
# MACHINE/MACHINE_ARCH pairs.
#
# Each line contains a MACHINE and MACHINE_ARCH value, an optional ALIAS
# which may be used to refer to the MACHINE/MACHINE_ARCH pair, and an
# optional DEFAULT or NO_DEFAULT keyword.
#
# When a MACHINE corresponds to multiple possible values of
# MACHINE_ARCH, then this table should list all allowed combinations.
# If the MACHINE is associated with a default MACHINE_ARCH (to be
# used when the user specifies the MACHINE but fails to specify the
# MACHINE_ARCH), then one of the lines should have the "DEFAULT"
# keyword. If there is no default MACHINE_ARCH for a particular
# MACHINE, then there should be a line with the "NO_DEFAULT" keyword,
# and with a blank MACHINE_ARCH.
#
valid_MACHINE_ARCH='
MACHINE=acorn26 MACHINE_ARCH=arm
MACHINE=acorn32 MACHINE_ARCH=arm
MACHINE=algor MACHINE_ARCH=mips64el ALIAS=algor64
MACHINE=algor MACHINE_ARCH=mipsel DEFAULT
MACHINE=alpha MACHINE_ARCH=alpha
MACHINE=amd64 MACHINE_ARCH=x86_64
MACHINE=amiga MACHINE_ARCH=m68k
MACHINE=amigappc MACHINE_ARCH=powerpc
MACHINE=arc MACHINE_ARCH=mips64el ALIAS=arc64
MACHINE=arc MACHINE_ARCH=mipsel DEFAULT
MACHINE=atari MACHINE_ARCH=m68k
MACHINE=bebox MACHINE_ARCH=powerpc
MACHINE=cats MACHINE_ARCH=arm DEFAULT
MACHINE=cats MACHINE_ARCH=earmv4 ALIAS=ecats
MACHINE=cesfic MACHINE_ARCH=m68k
MACHINE=cobalt MACHINE_ARCH=mips64el ALIAS=cobalt64
MACHINE=cobalt MACHINE_ARCH=mipsel DEFAULT
MACHINE=dreamcast MACHINE_ARCH=sh3el
MACHINE=emips MACHINE_ARCH=mipseb
MACHINE=epoc32 MACHINE_ARCH=arm
MACHINE=evbarm MACHINE_ARCH=arm ALIAS=evbarm-el DEFAULT
MACHINE=evbarm MACHINE_ARCH=armeb ALIAS=evbarm-eb
MACHINE=evbarm MACHINE_ARCH=earm ALIAS=evbearm-el
MACHINE=evbarm MACHINE_ARCH=earmeb ALIAS=evbearm-eb
MACHINE=evbarm MACHINE_ARCH=earmhf ALIAS=evbearmhf-el
MACHINE=evbarm MACHINE_ARCH=earmhfeb ALIAS=evbearmhf-eb
MACHINE=evbarm MACHINE_ARCH=earmv4 ALIAS=evbearmv4-el
MACHINE=evbarm MACHINE_ARCH=earmv4eb ALIAS=evbearmv4-eb
MACHINE=evbarm MACHINE_ARCH=earmv5 ALIAS=evbearmv5-el
MACHINE=evbarm MACHINE_ARCH=earmv5eb ALIAS=evbearmv5-eb
MACHINE=evbarm MACHINE_ARCH=earmv6 ALIAS=evbearmv6-el
MACHINE=evbarm MACHINE_ARCH=earmv6hf ALIAS=evbearmv6hf-el
MACHINE=evbarm MACHINE_ARCH=earmv6eb ALIAS=evbearmv6-eb
MACHINE=evbarm MACHINE_ARCH=earmv6hfeb ALIAS=evbearmv6hf-eb
MACHINE=evbarm MACHINE_ARCH=earmv7 ALIAS=evbearmv7-el
MACHINE=evbarm MACHINE_ARCH=earmv7eb ALIAS=evbearmv7-eb
MACHINE=evbarm MACHINE_ARCH=earmv7hf ALIAS=evbearmv7hf-el
MACHINE=evbarm MACHINE_ARCH=earmv7hfeb ALIAS=evbearmv7hf-eb
MACHINE=evbcf MACHINE_ARCH=coldfire
MACHINE=evbmips MACHINE_ARCH= NO_DEFAULT
MACHINE=evbmips MACHINE_ARCH=mips64eb ALIAS=evbmips64-eb
MACHINE=evbmips MACHINE_ARCH=mips64el ALIAS=evbmips64-el
MACHINE=evbmips MACHINE_ARCH=mipseb ALIAS=evbmips-eb
MACHINE=evbmips MACHINE_ARCH=mipsel ALIAS=evbmips-el
MACHINE=evbppc MACHINE_ARCH=powerpc DEFAULT
MACHINE=evbppc MACHINE_ARCH=powerpc64 ALIAS=evbppc64
MACHINE=evbsh3 MACHINE_ARCH= NO_DEFAULT
MACHINE=evbsh3 MACHINE_ARCH=sh3eb ALIAS=evbsh3-eb
MACHINE=evbsh3 MACHINE_ARCH=sh3el ALIAS=evbsh3-el
MACHINE=ews4800mips MACHINE_ARCH=mipseb
MACHINE=hp300 MACHINE_ARCH=m68k
MACHINE=hp700 MACHINE_ARCH=hppa
MACHINE=hpcarm MACHINE_ARCH=arm DEFAULT
MACHINE=hpcarm MACHINE_ARCH=earm ALIAS=hpcearm
MACHINE=hpcmips MACHINE_ARCH=mipsel
MACHINE=hpcsh MACHINE_ARCH=sh3el
MACHINE=i386 MACHINE_ARCH=i386
MACHINE=ia64 MACHINE_ARCH=ia64
MACHINE=ibmnws MACHINE_ARCH=powerpc
MACHINE=iyonix MACHINE_ARCH=arm DEFAULT
MACHINE=iyonix MACHINE_ARCH=earm ALIAS=eiyonix
MACHINE=landisk MACHINE_ARCH=sh3el
MACHINE=luna68k MACHINE_ARCH=m68k
MACHINE=mac68k MACHINE_ARCH=m68k
MACHINE=macppc MACHINE_ARCH=powerpc DEFAULT
MACHINE=macppc MACHINE_ARCH=powerpc64 ALIAS=macppc64
MACHINE=mipsco MACHINE_ARCH=mipseb
MACHINE=mmeye MACHINE_ARCH=sh3eb
MACHINE=mvme68k MACHINE_ARCH=m68k
MACHINE=mvmeppc MACHINE_ARCH=powerpc
MACHINE=netwinder MACHINE_ARCH=arm DEFAULT
MACHINE=netwinder MACHINE_ARCH=earmv4 ALIAS=enetwinder
MACHINE=news68k MACHINE_ARCH=m68k
MACHINE=newsmips MACHINE_ARCH=mipseb
MACHINE=next68k MACHINE_ARCH=m68k
MACHINE=ofppc MACHINE_ARCH=powerpc DEFAULT
MACHINE=ofppc MACHINE_ARCH=powerpc64 ALIAS=ofppc64
MACHINE=pmax MACHINE_ARCH=mips64el ALIAS=pmax64
MACHINE=pmax MACHINE_ARCH=mipsel DEFAULT
MACHINE=prep MACHINE_ARCH=powerpc
MACHINE=rs6000 MACHINE_ARCH=powerpc
MACHINE=sandpoint MACHINE_ARCH=powerpc
MACHINE=sbmips MACHINE_ARCH= NO_DEFAULT
MACHINE=sbmips MACHINE_ARCH=mips64eb ALIAS=sbmips64-eb
MACHINE=sbmips MACHINE_ARCH=mips64el ALIAS=sbmips64-el
MACHINE=sbmips MACHINE_ARCH=mipseb ALIAS=sbmips-eb
MACHINE=sbmips MACHINE_ARCH=mipsel ALIAS=sbmips-el
MACHINE=sgimips MACHINE_ARCH=mips64eb ALIAS=sgimips64
MACHINE=sgimips MACHINE_ARCH=mipseb DEFAULT
MACHINE=shark MACHINE_ARCH=arm DEFAULT
MACHINE=shark MACHINE_ARCH=earmv4 ALIAS=eshark
MACHINE=sparc MACHINE_ARCH=sparc
MACHINE=sparc64 MACHINE_ARCH=sparc64
MACHINE=sun2 MACHINE_ARCH=m68000
MACHINE=sun3 MACHINE_ARCH=m68k
MACHINE=vax MACHINE_ARCH=vax
MACHINE=x68k MACHINE_ARCH=m68k
MACHINE=zaurus MACHINE_ARCH=arm DEFAULT
MACHINE=zaurus MACHINE_ARCH=earm ALIAS=ezaurus
'
# getarch -- find the default MACHINE_ARCH for a MACHINE,
# or convert an alias to a MACHINE/MACHINE_ARCH pair.
#
# Saves MACHINE in makewrappermachine before possibly modifying MACHINE.
#
# Sets MACHINE and MACHINE_ARCH if the input MACHINE value is
# recognised as an alias, or recognised as a machine that has a default
# MACHINE_ARCH (or that has only one possible MACHINE_ARCH).
#
# Leaves MACHINE and MACHINE_ARCH unchanged if MACHINE is recognised
# as being associated with multiple MACHINE_ARCH values with no default.
#
# Bombs if MACHINE is not recognised.
#
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
local IFS
local found=""
local line
evbearm-e[bl])
makewrappermachine=${MACHINE}
# MACHINE_ARCH is "arm" or "armeb", not "armel"
MACHINE_ARCH=earm${MACHINE##*-}
MACHINE_ARCH=${MACHINE_ARCH%el}
MACHINE=evbarm
IFS="${nl}"
makewrappermachine="${MACHINE}"
for line in ${valid_MACHINE_ARCH}; do
line="${line%%#*}" # ignore comments
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space
case "${line} " in
"")
# skip blank lines or comment lines
continue
;;
*" ALIAS=${MACHINE} "*)
# Found a line with a matching ALIAS=<alias>.
found="$line"
break
;;
"MACHINE=${MACHINE} "*" NO_DEFAULT"*)
# Found an explicit "NO_DEFAULT" for this MACHINE.
found="$line"
break
;;
"MACHINE=${MACHINE} "*" DEFAULT"*)
# Found an explicit "DEFAULT" for this MACHINE.
found="$line"
break
;;
"MACHINE=${MACHINE} "*)
# Found a line for this MACHINE. If it's the
# first such line, then tentatively accept it.
# If it's not the first matching line, then
# remember that there was more than one match.
case "$found" in
'') found="$line" ;;
*) found="MULTIPLE_MATCHES" ; break ;;
esac
;;
esac
done
case "$found" in
*NO_DEFAULT*|*MULTIPLE_MATCHES*)
# MACHINE is OK, but MACHINE_ARCH is still unknown
return
;;
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]}
"MACHINE="*" MACHINE_ARCH="*)
# Obey the MACHINE= and MACHINE_ARCH= parts of the line.
IFS=" "
for frag in ${found}; do
case "$frag" in
MACHINE=*|MACHINE_ARCH=*)
eval "$frag"
;;
esac
done
;;
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 -- check that the MACHINE/MACHINE_ARCH pair is supported.
#
# Bombs if the pair is not supported.
#
validatearch()
{
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
#
local IFS
local line
local foundpair=false foundmachine=false foundarch=false
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"
;;
esac
*)
IFS="${nl}"
for line in ${valid_MACHINE_ARCH}; do
line="${line%%#*}" # ignore comments
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space
case "${line} " in
"")
# skip blank lines or comment lines
continue
;;
"MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} "*)
foundpair=true
;;
"MACHINE=${MACHINE} "*)
foundmachine=true
;;
*"MACHINE_ARCH=${MACHINE_ARCH} "*)
foundarch=true
;;
esac
done
case "${foundpair}:${foundmachine}:${foundarch}" in
true:*)
: OK
;;
*:false:*)
bomb "Unknown target MACHINE: ${MACHINE}"
;;
*:*:false)
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}"
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'"
;;
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 --
@@ -892,7 +940,9 @@ Usage: ${progname} [-EhnorUuxy] [-a arch] [-B buildid] [-C cdextras]
RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage.
install-image Create bootable installation image in
RELEASEDIR/RELEASEMACHINEDIR/installation/installimage.
params Display various make(1) parameters.
disk-image=target Creae bootable disk image in
RELEASEDIR/RELEASEMACHINEDIR/binary/gzimg/target.img.gz.
show-params Display various make(1) parameters.
Options:
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
@@ -1152,7 +1202,11 @@ parseoptions()
usage
;;
makewrapper|cleandir|obj|tools|build|distribution|release|sets|sourcesets|syspkgs|params)
makewrapper|cleandir|obj|tools|build|distribution|release|sets|sourcesets|syspkgs)
;;
show-params)
op=show_params # used as part of a variable name
;;
iso-image)
@@ -1178,6 +1232,14 @@ parseoptions()
bomb "Must supply a kernel name with \`${op}=...'"
;;
disk-image=*)
arg=${op#*=}
op=disk_image
[ -n "${arg}" ] ||
bomb "Must supply a target name with \`${op}=...'"
;;
modules)
op=modules
;;
@@ -1226,6 +1288,24 @@ parseoptions()
#
sanitycheck()
{
# Non-root should always use either the -U or -E flag.
#
if ! ${do_expertmode} && \
[ "$id_u" -ne 0 ] && \
[ "${MKUNPRIVED}" = "no" ] ; then
bomb "-U or -E must be set for build as an unprivileged user."
fi
# Install as non-root is a bad idea.
#
if ${do_install} && [ "$id_u" -ne 0 ] ; then
if ${do_expertmode}; then
warning "Will install as an unprivileged user."
else
bomb "-E must be set for install as an unprivileged user."
fi
fi
# If the PATH contains any non-absolute components (including,
# but not limited to, "." or ""), then complain. As an exception,
# allow "" or "." as the last component of the PATH. This is fatal
@@ -1375,7 +1455,7 @@ print_tooldir_make()
# 1. build a new version of nbmake in a temporary directory;
# 2. use the temporary nbmake to create the top level obj directory;
# 3. use $(getmakevar TOOLDIR) with the temporary nbmake to
# get the corect value of TOOLDIR;
# get the correct value of TOOLDIR;
# 4. move the temporary nbmake to ${TOOLDIR}/bin/nbmake.
#
# However, people don't like building nbmake unnecessarily if their
@@ -1409,7 +1489,8 @@ rebuildmake()
${runcmd} env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \
CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
${HOST_SH} "${TOP}/tools/make/configure" ||
bomb "Configure of ${toolprefix}make failed"
( cp ${tmpdir}/config.log ${tmpdir}-config.log
bomb "Configure of ${toolprefix}make failed, see ${tmpdir}-config.log for details" )
${runcmd} ${HOST_SH} buildmake.sh ||
bomb "Build of ${toolprefix}make failed"
make="${tmpdir}/${toolprefix}make"
@@ -1423,10 +1504,23 @@ rebuildmake()
# Perform some late sanity checks, after rebuildmake,
# but before createmakewrapper or any real work.
#
# Also create the top-level obj directory.
# Creates the top-level obj directory, because that
# is needed by some of the sanity checks.
#
# Prints status messages reporting the values of several variables.
#
validatemakeparams()
{
# MAKECONF (which defaults to /etc/mk.conf in share/mk/bsd.own.mk)
# can affect many things, so mention it in an early status message.
#
MAKECONF=$(getmakevar MAKECONF)
if [ -e "${MAKECONF}" ]; then
statusmsg2 "MAKECONF file:" "${MAKECONF}"
else
statusmsg2 "MAKECONF file:" "${MAKECONF} (File not found)"
fi
if [ "${runcmd}" = "echo" ]; then
TOOLCHAIN_MISSING=no
EXTERNAL_TOOLCHAIN=""
@@ -1540,45 +1634,26 @@ validatemakeparams()
removedirs="${TOOLDIR}"
if [ -z "${DESTDIR}" ] || [ "${DESTDIR}" = "/" ]; then
if ${do_build} || ${do_distribution} || ${do_release}; then
if ! ${do_build} || \
[ "${uname_s}" != "Minix" ] || \
[ "${uname_m}" != "${MACHINE}" ]; then
bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'."
fi
if ! ${do_expertmode}; then
bomb "DESTDIR must != / for non -E (expert) builds"
fi
statusmsg "WARNING: Building to /, in expert mode."
statusmsg " This may cause your system to break! Reasons include:"
statusmsg " - your kernel is not up to date"
statusmsg " - the libraries or toolchain have changed"
statusmsg " YOU HAVE BEEN WARNED!"
if ${do_distribution} || ${do_release} || \
( [ "${uname_s}" != "NetBSD" ] && [ "${uname_s}" != "Minix" ] ) || \
[ "${uname_m}" != "${MACHINE}" ]; then
bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'."
fi
if ! ${do_expertmode}; then
bomb "DESTDIR must != / for non -E (expert) builds"
fi
statusmsg "WARNING: Building to /, in expert mode."
statusmsg " This may cause your system to break! Reasons include:"
statusmsg " - your kernel is not up to date"
statusmsg " - the libraries or toolchain have changed"
statusmsg " YOU HAVE BEEN WARNED!"
else
removedirs="${removedirs} ${DESTDIR}"
fi
if ${do_build} || ${do_distribution} || ${do_release}; then
if ! ${do_expertmode} && \
[ "$id_u" -ne 0 ] && \
[ "${MKUNPRIVED}" = "no" ] ; then
bomb "-U or -E must be set for build as an unprivileged user."
fi
fi
if ${do_releasekernel} && [ -z "${RELEASEDIR}" ]; then
bomb "Must set RELEASEDIR with \`releasekernel=...'"
fi
# Install as non-root is a bad idea.
#
if ${do_install} && [ "$id_u" -ne 0 ] ; then
if ${do_expertmode}; then
warning "Will install as an unprivileged user."
else
bomb "-E must be set for install as an unprivileged user."
fi
fi
# If a previous build.sh run used -U (and therefore created a
# METALOG file), then most subsequent build.sh runs must also
# use -U. If DESTDIR is about to be removed, then don't perform
@@ -1589,9 +1664,7 @@ validatemakeparams()
# DESTDIR is about to be removed
;;
*)
if ( ${do_build} || ${do_distribution} || ${do_release} || \
${do_install} ) && \
[ -e "${DESTDIR}/METALOG" ] && \
if [ -e "${DESTDIR}/METALOG" ] && \
[ "${MKUNPRIVED}" = "no" ] ; then
if $do_expertmode; then
warning "A previous build.sh run specified -U."
@@ -1678,7 +1751,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.256 2012/09/29 04:02:42 tsutsui Exp $
# Generated from: \$NetBSD: build.sh,v 1.273 2013/08/30 10:29:06 pooka Exp $
# with these arguments: ${_args}
#
@@ -1730,8 +1803,7 @@ buildtools()
if [ "${MKUPDATE}" = "no" ]; then
make_in_dir tools cleandir
fi
make_in_dir tools dependall
make_in_dir tools install
make_in_dir tools build_install
statusmsg "Tools built to ${TOOLDIR}"
}
@@ -1762,6 +1834,18 @@ getkernelconf()
kernelbuildpath="${KERNOBJDIR}/${kernelconfname}"
}
diskimage()
{
ARG="$(echo $1 | tr '[:lower:]' '[:upper:]')"
[ -f "${DESTDIR}/etc/mtree/set.base" ] ||
bomb "The release binaries must be built first"
kerneldir="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"
kernel="${kerneldir}/netbsd-${ARG}.gz"
[ -f "${kernel}" ] ||
bomb "The kernel ${kernel} must be built first"
make_in_dir "${NETBSDSRCDIR}/etc" "smp_${1}"
}
buildkernel()
{
if ! ${do_tools} && ! ${buildkernelwarned:-false}; then
@@ -1898,6 +1982,7 @@ dorump()
[ "${1}" != "rumptest" ] && bomb 'build.sh rump not yet functional. ' \
'did you mean "rumptest"?'
export RUMPKERN_ONLY=1
# create obj and distrib dirs
if [ "${MKOBJDIRS}" != "no" ]; then
make_in_dir "${NETBSDSRCDIR}/etc/mtree" obj
@@ -1938,7 +2023,7 @@ dorump()
/undefined reference/ &&
!/more undefined references.*follow/{
if (match($NF,
"`(rumpuser_|__" quirks ")") == 0)
"`(rumpuser_|rumpcomp_|__" quirks ")") == 0)
fails[NR] = $0
}
/cannot find -l/{fails[NR] = $0}
@@ -1995,7 +2080,7 @@ main()
statusmsg "Built sets to ${setdir}"
;;
cleandir|obj|build|distribution|release|sourcesets|syspkgs|params)
cleandir|obj|build|distribution|release|sourcesets|syspkgs|show-params)
${runcmd} "${makewrapper}" ${parallel} ${op} ||
bomb "Failed to make ${op}"
statusmsg "Successful make ${op}"
@@ -2029,6 +2114,11 @@ main()
releasekernel "${arg}"
;;
disk-image=*)
arg=${op#*=}
diskimage "${arg}"
;;
modules)
buildmodules
;;
@@ -2036,7 +2126,7 @@ main()
installmodules=*)
arg=${op#*=}
if [ "${arg}" = "/" ] && \
( [ "${uname_s}" != "Minix" ] || \
( ( [ "${uname_s}" != "NetBSD" ] && [ "${uname_s}" != "Minix" ] ) || \
[ "${uname_m}" != "${MACHINE}" ] ); then
bomb "'${op}' must != / for cross builds."
fi
@@ -2046,7 +2136,7 @@ main()
install=*)
arg=${op#*=}
if [ "${arg}" = "/" ] && \
( [ "${uname_s}" != "Minix" ] || \
( ( [ "${uname_s}" != "NetBSD" ] && [ "${uname_s}" != "Minix" ] ) || \
[ "${uname_m}" != "${MACHINE}" ] ); then
bomb "'${op}' must != / for cross builds."
fi