Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Change build.sh so that at least one operation is required.
details: https://anonhg.NetBSD.org/src/rev/34eb1bef81ec
branches: trunk
changeset: 542303:34eb1bef81ec
user: lukem <lukem%NetBSD.org@localhost>
date: Sun Jan 26 05:34:32 2003 +0000
description:
Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]
Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]
Improve the examples in BUILDING.
diffstat:
BUILDING | 48 ++++++++++++++++++++++--------------------------
build.sh | 47 +++++++++++++++++++++++++++++++----------------
doc/BUILDING.mdoc | 53 ++++++++++++++++++++++++++++-------------------------
3 files changed, 81 insertions(+), 67 deletions(-)
diffs (truncated from 360 to 300 lines):
diff -r 5ff28043427d -r 34eb1bef81ec BUILDING
--- a/BUILDING Sun Jan 26 04:16:36 2003 +0000
+++ b/BUILDING Sun Jan 26 05:34:32 2003 +0000
@@ -462,6 +462,9 @@
release Build a full release as per ``make release''. This option
implies the distribution operation.
+ makewrapper Create the nbmake-MACHINE wrapper. This operation is auto-
+ matically performed for any of the other operations.
+
obj Perform ``make obj''.
tools Build and install the host tools from src/tools.
@@ -494,8 +497,13 @@
-D dest Set the value of DESTDIR to dest.
- -E Set `expert' mode; DESTDIR does not have to be set to a non-
- root path for builds when this is set.
+ -E Set `expert' mode. This overrides various sanity checks, and
+ allows: DESTDIR does not have to be set to a non-root path for
+ builds, and UNPRIVED does not have to be set when building as a
+ non-root user.
+
+ Note: It is highly recommended that you know what you are doing
+ when you use this option.
-j njob Passed through to make(1). Makefiles should use .WAIT or have
explicit dependancies as necessary to enforce build ordering.
@@ -536,9 +544,7 @@
-u Set the UPDATE variable.
-V var=[value]
- Set the variable var to value (which is optional). This is
- useful for setting RELEASEDIR without actually building a re-
- lease.
+ Set the variable var to value (which is optional).
-w wrapper
Create the nbmake wrapper script (see below) in a custom loca-
@@ -558,35 +564,25 @@
with an absolute path.
EXAMPLES
- ./build.sh tools
- Build a new toolchain.
-
- cd ${KERNCONFDIR} ; ${TOOLDIR}/bin/nbconfig GENERIC
- Use the new version of config(8) to prepare to build a new
- GENERIC kernel.
-
- cd ${KERNOBJDIR}/GENERIC ; ${TOOLDIR}/bin/nbmake-${MACHINE} dependall
- Use the new toolchain to build a new GENERIC kernel.
-
./build.sh tools kernel=GENERIC
Build a new toolchain, and use the new toolchain to configure
and build a new GENERIC kernel. This is a simpler way to
achieve what the first three examples do.
- ./build.sh -U distribution
+ ./build.sh -U -D /some/DESTDIR distribution
Using unprivileged mode, build a complete distribution in
- DESTDIR.
+ /some/DESTDIR.
- # ./build.sh -U installworld=/
+ # ./build.sh -U -D /some/DESTDIR installworld=/
As root, install the distribution that was built with unprivi-
- leged mode from DESTDIR to /. (Even though this is run as
- root, -U is required so that the permissions stored in
- DESTDIR/METALOG are correctly applied to the files as they're
- copied to /).
+ leged mode from /some/DESTDIR to /. (Even though this is run
+ as root, -U is required so that the permissions stored in
+ /some/DESTDIR/METALOG are correctly applied to the files as
+ they're copied to /).
- ./build.sh -U -R /some/dir/RELEASE release
- Using unprivileged mode, build a complete release in the speci-
- fied release directory.
+ ./build.sh -U -D /some/dir/DESTDIR -R /some/dir/RELEASE release
+ Using unprivileged mode, build a complete release in
+ /some/dir/RELEASE.
OBSOLETE VARIABLES
NBUILDJOBS Use the make(1) option -j, instead.
@@ -605,4 +601,4 @@
BUGS
A few platforms are not yet using this build system.
-NetBSD January 24, 2003 10
+NetBSD January 26, 2003 10
diff -r 5ff28043427d -r 34eb1bef81ec build.sh
--- a/build.sh Sun Jan 26 04:16:36 2003 +0000
+++ b/build.sh Sun Jan 26 05:34:32 2003 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.85 2003/01/24 01:17:52 lukem Exp $
+# $NetBSD: build.sh,v 1.86 2003/01/26 05:34:32 lukem Exp $
#
# Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -234,15 +234,16 @@
Usage: ${progname} [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
- [-w wrapper] [operation [...] ]
+ [-w wrapper] operation [...]
- System build operations (all imply "obj" and "tools"):
+ Build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)
Other operations:
- obj Run "make obj" (default unless -o)
+ makewrapper Create ${toolprefix}make-${MACHINE} wrapper and ${toolprefix}make. (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'
@@ -262,12 +263,12 @@
-R release Set RELEASEDIR to release
-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
- -u Set UPDATE
+ 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})
+ (Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE})
_usage_
exit 1
@@ -314,7 +315,7 @@
;;
-b)
- usage "'-b' has been removed; it is the default operation"
+ usage "'-b' has been replaced by 'makewrapper'"
;;
-D)
@@ -451,13 +452,13 @@
case "$op" in
- tools|obj|build|distribution|release)
+ makewrapper|obj|tools|build|distribution|release)
;;
kernel=*)
arg=${op#*=}
op=${op%%=*}
- if [ "${arg}" = "" ]; then
+ if [ -z "${arg}" ]; then
bomb "Must supply a kernel name with \`kernel=...'"
fi
;;
@@ -465,7 +466,7 @@
install=*)
arg=${op#*=}
op=${op%%=*}
- if [ "${arg}" = "" ]; then
+ if [ -z "${arg}" ]; then
bomb "Must supply a directory with \`install=...'"
fi
;;
@@ -477,6 +478,9 @@
esac
eval do_$op=true
done
+ if [ -z "${operations}" ]; then
+ usage "Missing operation to perform."
+ fi
# Set up MACHINE*. On a NetBSD host, these are allowed to be unset.
#
@@ -554,7 +558,7 @@
EXTERNAL_TOOLCHAIN=$(getmakevar EXTERNAL_TOOLCHAIN)
fi
if [ "${TOOLCHAIN_MISSING}" = "yes" ] && \
- [ "${EXTERNAL_TOOLCHAIN}" = "" ]; then
+ [ -z "${EXTERNAL_TOOLCHAIN}" ]; then
$runcmd echo "ERROR: build.sh (in-tree cross-toolchain) is not yet available for"
$runcmd echo " MACHINE: ${MACHINE}"
$runcmd echo " MACHINE_ARCH: ${MACHINE_ARCH}"
@@ -619,6 +623,13 @@
else
removedirs="$removedirs $DESTDIR"
fi
+ if $do_build || $do_distribution || $do_release; then
+ if ! $do_expertmode && \
+ [ $(id -u 2>/dev/null) -ne 0 ] &&\
+ [ -z "$UNPRIVED" ] ; then
+ bomb "-U or -E must be set for build as an unprivileged user."
+ fi
+ fi
}
@@ -670,7 +681,7 @@
eval cat <<EOF $makewrapout
#! /bin/sh
# Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from: \$NetBSD: build.sh,v 1.85 2003/01/24 01:17:52 lukem Exp $
+# Generated from: \$NetBSD: build.sh,v 1.86 2003/01/26 05:34:32 lukem Exp $
#
EOF
@@ -695,7 +706,7 @@
bomb "failed to make obj-tools"
fi
$runcmd cd tools
- if [ "$UPDATE" = "" ]; then
+ if [ -z "$UPDATE" ]; then
cleandir=cleandir
else
cleandir=
@@ -745,7 +756,7 @@
$runcmd echo "===> Kernel build directory: ${kernbuilddir}"
$runcmd mkdir -p "${kernbuilddir}" ||
bomb "cannot mkdir: ${kernbuilddir}"
- if [ "$UPDATE" = "" ]; then
+ if [ -z "$UPDATE" ]; then
$runcmd cd "${kernbuilddir}"
$runcmd "$makewrapper" cleandir ||
bomb "make cleandir failed in ${kernbuilddir}"
@@ -784,6 +795,10 @@
for op in $operations; do
case "$op" in
+ makewrapper)
+ # no-op
+ ;;
+
tools)
buildtools
;;
diff -r 5ff28043427d -r 34eb1bef81ec doc/BUILDING.mdoc
--- a/doc/BUILDING.mdoc Sun Jan 26 04:16:36 2003 +0000
+++ b/doc/BUILDING.mdoc Sun Jan 26 05:34:32 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: BUILDING.mdoc,v 1.9 2003/01/23 16:24:08 lukem Exp $
+.\" $NetBSD: BUILDING.mdoc,v 1.10 2003/01/26 05:34:32 lukem Exp $
.\"
.\" Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -38,7 +38,7 @@
.\" NOTE: After changing this file, run "make build-docs" to generate the
.\" proper plaintext versions, and check in all BUILDING.* files!
.\"
-.Dd January 24, 2003
+.Dd January 26, 2003
.Dt BUILDING 8
.Os NetBSD
.
@@ -865,6 +865,13 @@
.Sy distribution
operation.
.
+.It Sy makewrapper
+Create the
+.Sy nbmake-MACHINE
+wrapper.
+This operation is automatically performed for any of the other
+operations.
+.
.It Sy obj
Perform
.Dq make obj .
@@ -940,9 +947,17 @@
.It Fl E
Set
.Sq expert
-mode;
+mode.
+This overrides various sanity checks, and allows:
.Sy DESTDIR
-does not have to be set to a non-root path for builds when this is set.
+does not have to be set to a non-root path for builds,
+and
+.Sy UNPRIVED
+does not have to be set when building as a non-root user.
+.Pp
+.Em Note :
+It is highly recommended that you know what you are doing when
+you use this option.
.
.It Fl j Ar njob
Passed through to
@@ -1049,9 +1064,6 @@
to
.Ar value
(which is optional).
Home |
Main Index |
Thread Index |
Old Index