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.
This commit is contained in:
apb 2014-08-15 18:34:19 +00:00
parent 70b43d6df9
commit 9c3c6064f6
1 changed files with 10 additions and 7 deletions

View File

@ -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 @@ parseoptions()
{
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 @@ parseoptions()
-m)
eval ${optargcmd}
MACHINE="${OPTARG}"
opt_m=true
;;
-N)
@ -1372,16 +1374,17 @@ parseoptions()
# 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 @@ 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.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}
#