Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add build.sh -Z var, to unset a variable and ensure it's uns...



details:   https://anonhg.NetBSD.org/src/rev/fde70f3ecda7
branches:  trunk
changeset: 550079:fde70f3ecda7
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jul 29 10:07:15 2003 +0000

description:
Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.

diffstat:

 BUILDING          |  16 ++++++++++++----
 build.sh          |  33 +++++++++++++++++++++++++++------
 doc/BUILDING.mdoc |  39 +++++++++++++++++++++++++++++++--------
 3 files changed, 70 insertions(+), 18 deletions(-)

diffs (260 lines):

diff -r f4511fa6333e -r fde70f3ecda7 BUILDING
--- a/BUILDING  Tue Jul 29 09:06:29 2003 +0000
+++ b/BUILDING  Tue Jul 29 10:07:15 2003 +0000
@@ -541,7 +541,7 @@
                If you see build failures with -j, please save complete build
                logs so the failures can be analyzed.
 
-     -M obj    Set MAKEOBJDIRPREFIX to obj.
+     -M obj    Set MAKEOBJDIRPREFIX to obj.  Unsets MAKEOBJDIR.
 
      -m mach   Set the value of MACHINE to mach.  This will also override any
                value of MACHINE_ARCH in the process environment with a value
@@ -572,7 +572,8 @@
      -O obj    Create an appropriate transform macro for MAKEOBJDIR that will
                place the built object files under obj.  For instance, a set-
                ting of /usr/obj will place build-time files under
-               /usr/obj/bin, /usr/obj/lib, and so forth.
+               /usr/obj/bin, /usr/obj/lib, /usr/obj/usr.bin, and so forth.
+               Unsets MAKEOBJDIRPREFIX.
 
      -o        Set the value of MKOBJDIRS to ``no''.  Otherwise, it will be
                automatically set to ``yes'' (which is opposite to the default
@@ -593,7 +594,8 @@
      -u        Set MKUPDATE=yes.
 
      -V var=[value]
-               Set the variable var to value (which is optional).
+               Set the environment variable var to an optional value.  This is
+               propagated to the nbmake wrapper.
 
      -w wrapper
                Create the nbmake wrapper script (see below) in a custom loca-
@@ -601,6 +603,9 @@
                place the wrapper in PATH automatically.  Note that wrapper is
                the full name of the file, not just a directory name.
 
+     -Z var    Unset ("zap") the environment variable var.  This is propagated
+               to the nbmake wrapper.
+
    The "nbmake-MACHINE" wrapper script
      If using the build.sh script to build NetBSD, a nbmake-MACHINE script
      will be created in TOOLDIR/bin upon the first build to assist in building
@@ -609,6 +614,9 @@
      nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
      the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
      eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
+     build.sh will also set variables specified with -V, and unset variables
+     specified with -Z.
+
      This script can be symlinked into a directory listed in PATH, or called
      with an absolute path.
 
@@ -655,4 +663,4 @@
 BUGS
      A few platforms are not yet using this build system.
 
-NetBSD                           July 18, 2003                          NetBSD
+NetBSD                           July 29, 2003                          NetBSD
diff -r f4511fa6333e -r fde70f3ecda7 build.sh
--- a/build.sh  Tue Jul 29 09:06:29 2003 +0000
+++ b/build.sh  Tue Jul 29 10:07:15 2003 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#      $NetBSD: build.sh,v 1.110 2003/07/28 12:33:42 lukem Exp $
+#      $NetBSD: build.sh,v 1.111 2003/07/29 10:07:15 lukem Exp $
 #
 # Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -316,6 +316,12 @@
        makeenv="${makeenv} $1"
 }
 
+unsetmakeenv()
+{
+       eval "unset $1"
+       makeenv="${makeenv} $1"
+}
+
 resolvepath()
 {
        case "${OPTARG}" in
@@ -337,7 +343,7 @@
 
 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] [-Z var]   operation [...]
 
  Build operations (all imply "obj" and "tools"):
     build               Run "make build"
@@ -366,9 +372,11 @@
                 Should not be used without expert knowledge of the build system
     -j njob     Run up to njob jobs in parallel; see make(1)
     -M obj      Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
+                Unsets MAKEOBJDIR.
     -m mach     Set MACHINE to mach (not required if NetBSD native)
     -n          Show commands that would be executed, but do not execute them
-    -O obj      Set obj root directory to obj (sets a MAKEOBJDIR pattern)
+    -O 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
@@ -380,6 +388,7 @@
     -V v=[val]  Set variable \`v' to \`val'
     -w wrapper  Create ${toolprefix}make script as wrapper
                 (Default: \${TOOLDIR}/bin/${toolprefix}make-\${MACHINE})
+    -Z v        Unset ("zap") variable \`v'
 
 _usage_
        exit 1
@@ -387,7 +396,7 @@
 
 parseoptions()
 {
-       opts='a:B:bD:dEhi:j:k:M:m:nO:oR:rT:tUuV:w:'
+       opts='a:B:bD:dEhi:j:k:M:m:nO:oR:rT:tUuV:w:Z:'
        opt_a=no
 
        if type getopts >/dev/null 2>&1; then
@@ -460,6 +469,7 @@
                -M)
                        eval ${optargcmd}; resolvepath
                        makeobjdir="${OPTARG}"
+                       unsetmakeenv MAKEOBJDIR
                        setmakeenv MAKEOBJDIRPREFIX "${OPTARG}"
                        ;;
 
@@ -477,6 +487,7 @@
                -O)
                        eval ${optargcmd}; resolvepath
                        makeobjdir="${OPTARG}"
+                       unsetmakeenv MAKEOBJDIRPREFIX
                        setmakeenv MAKEOBJDIR "\${.CURDIR:C,^$TOP,$OPTARG,}"
                        ;;
 
@@ -530,6 +541,12 @@
                        makewrapper="${OPTARG}"
                        ;;
 
+               -Z)
+                       eval ${optargcmd}
+                   # XXX: consider restricting which variables can be unset?
+                       unsetmakeenv "${OPTARG}"
+                       ;;
+
                --)
                        break
                        ;;
@@ -784,12 +801,16 @@
        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.110 2003/07/28 12:33:42 lukem Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.111 2003/07/29 10:07:15 lukem Exp $
 #
 
 EOF
        for f in ${makeenv}; do
-               eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}" ${makewrapout}
+               if eval "[ -z \"\${$f}\" -a \"\${${f}-X}\" = \"X\" ]"; then
+                       eval echo "unset ${f}" ${makewrapout}
+               else
+                       eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}" ${makewrapout}
+               fi
        done
        eval echo "USETOOLS=yes\; export USETOOLS" ${makewrapout}
 
diff -r f4511fa6333e -r fde70f3ecda7 doc/BUILDING.mdoc
--- a/doc/BUILDING.mdoc Tue Jul 29 09:06:29 2003 +0000
+++ b/doc/BUILDING.mdoc Tue Jul 29 10:07:15 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: BUILDING.mdoc,v 1.26 2003/07/18 16:30:48 lukem Exp $
+.\"    $NetBSD: BUILDING.mdoc,v 1.27 2003/07/29 10:07:16 lukem Exp $
 .\"
 .\" Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -40,7 +40,7 @@
 .\" Toolchain prefix for commands
 .ds toolprefix nb
 .
-.Dd July 18, 2003
+.Dd July 29, 2003
 .Dt BUILDING 8
 .Os NetBSD
 .
@@ -1052,6 +1052,8 @@
 .Sy MAKEOBJDIRPREFIX
 to
 .Ar obj .
+Unsets
+.Sy MAKEOBJDIR .
 .
 .It Fl m Ar mach
 Set the value of
@@ -1109,8 +1111,12 @@
 For instance, a setting of
 .Sy /usr/obj
 will place build-time files under
-.Sy /usr/obj/bin , /usr/obj/lib ,
+.Sy /usr/obj/bin ,
+.Sy /usr/obj/lib ,
+.Sy /usr/obj/usr.bin ,
 and so forth.
+Unsets
+.Sy MAKEOBJDIRPREFIX .
 .
 .It Fl o
 Set the value of
@@ -1164,14 +1170,18 @@
 .Op Ar value
 .Sm on
 .Xc
-Set the variable
+Set the environment variable
 .Ar var
-to
-.Ar value
-(which is optional).
+to an optional
+.Ar value .
+This is propagated to the 
+.Sy \*[toolprefix]make
+wrapper.
 .
 .It Fl w Ar wrapper
-Create the \*[toolprefix]make wrapper script (see below) in a custom location,
+Create the
+.Sy \*[toolprefix]make
+wrapper script (see below) in a custom location,
 specified by
 .Ar wrapper .
 This allows, for instance, to place the wrapper in
@@ -1181,6 +1191,13 @@
 .Ar wrapper
 is the full name of the file, not just a directory name.
 .
+.It Fl Z Ar var
+Unset ("zap") the environment variable
+.Ar var .
+This is propagated to the 
+.Sy \*[toolprefix]make
+wrapper.
+.
 .El
 .
 .Ss The \*q\*[toolprefix]make-MACHINE\*q wrapper script
@@ -1207,6 +1224,12 @@
 .Sy MACHINE , MACHINE_ARCH ,
 and
 .Sy TOOLDIR .
+.Sy build.sh
+will also set variables specified with
+.Fl V ,
+and unset variables specified with
+.Fl Z .
+.Pp
 This script can be symlinked into a directory listed in
 .Sy PATH ,
 or called with an absolute path.



Home | Main Index | Thread Index | Old Index