Source-Changes-HG archive

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

[src/trunk]: src Only the -m command line option, not MACHINE from the enviro...



details:   https://anonhg.NetBSD.org/src/rev/005af969e3e0
branches:  trunk
changeset: 331598:005af969e3e0
user:      apb <apb%NetBSD.org@localhost>
date:      Fri Aug 15 18:34:19 2014 +0000

description:
Only the -m command line option, not MACHINE from the environment,
is supposed override MACHINE_ARCH from the environment with the
default MACHINE_ARCH for the requested machine.

Add and use an opt_m variable to enforce this.

diffstat:

 build.sh |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r 58fe02e963a6 -r 005af969e3e0 build.sh
--- a/build.sh  Fri Aug 15 18:23:42 2014 +0000
+++ b/build.sh  Fri Aug 15 18:34:19 2014 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#      $NetBSD: build.sh,v 1.294 2014/08/10 05:56:36 matt Exp $
+#      $NetBSD: build.sh,v 1.295 2014/08/15 18:34:19 apb Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1100,6 +1100,7 @@
 {
        opts='a:B:C:D:Ehj:M:m:N:nO:oR:rS:T:UuV:w:X:xY:yZ:'
        opt_a=false
+       opt_m=false
 
        if type getopts >/dev/null 2>&1; then
                # Use POSIX getopts.
@@ -1177,6 +1178,7 @@
                -m)
                        eval ${optargcmd}
                        MACHINE="${OPTARG}"
+                       opt_m=true
                        ;;
 
                -N)
@@ -1372,16 +1374,17 @@
 
        # Set up MACHINE*.  On a NetBSD host, these are allowed to be unset.
        #
-       # MACHINE_ARCH from the environment may be overridden by getarch
-       # (based on the MACHINE), but MACHINE_ARCH from the -a option should
-       # not be overridden.
-       #
        if [ -z "${MACHINE}" ]; then
                [ "${uname_s}" = "NetBSD" ] ||
                    bomb "MACHINE must be set, or -m must be used, for cross builds."
                MACHINE=${uname_m}
        fi
-       $opt_a || getarch
+       if $opt_m && ! $opt_a; then
+               # Settings implied by the command line -m option
+               # override MACHINE_ARCH from the environment (if any).
+               getarch
+       fi
+       [ -n "${MACHINE_ARCH}" ] || getarch
        validatearch
 
        # Set up default make(1) environment.
@@ -1864,7 +1867,7 @@
        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.294 2014/08/10 05:56:36 matt Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.295 2014/08/15 18:34:19 apb Exp $
 # with these arguments: ${_args}
 #
 



Home | Main Index | Thread Index | Old Index