In build.sh and bsd.own.mk, if uname -p fails, or prints "unknown", or
prints something that does not look like an identifier, then use uname -m instead. (Cygwin prints "unknown", and OpenBSD prints a long string containing several spaces; this code should handle both.)
This commit is contained in:
parent
50b5b59cc7
commit
5ebdda3e89
21
build.sh
21
build.sh
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env sh
|
||||
# $NetBSD: build.sh,v 1.203 2009/02/25 23:34:10 lukem Exp $
|
||||
# $NetBSD: build.sh,v 1.204 2009/03/06 16:29:40 apb Exp $
|
||||
#
|
||||
# Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -163,14 +163,23 @@ initdefaults()
|
|||
[ -f share/mk/bsd.own.mk ] ||
|
||||
bomb "src/share/mk is missing; please re-fetch the source tree"
|
||||
|
||||
# Find information about the build platform. Note that "uname -p"
|
||||
# is not part of POSIX, but NetBSD's uname -p prints MACHINE_ARCH,
|
||||
# while uname -m prints MACHINE.
|
||||
# Find information about the build platform. This should be
|
||||
# kept in sync with _HOST_OSNAME, _HOST_OSREL, and _HOST_ARCH
|
||||
# variables in share/mk/bsd.sys.mk.
|
||||
#
|
||||
# Note that "uname -p" is not part of POSIX, but we want uname_p
|
||||
# to be set to the host MACHINE_ARCH, if possible. On systems
|
||||
# where "uname -p" fails, prints "unknown", or prints a string
|
||||
# that does not look like an identifier, fall back to using the
|
||||
# output from "uname -m" instead.
|
||||
#
|
||||
uname_s=$(uname -s 2>/dev/null)
|
||||
uname_r=$(uname -r 2>/dev/null)
|
||||
uname_m=$(uname -m 2>/dev/null)
|
||||
uname_p=$(uname -p 2>/dev/null || uname -m 2>/dev/null)
|
||||
uname_p=$(uname -p 2>/dev/null || echo "unknown")
|
||||
case "${uname_p}" in
|
||||
''|unknown|*[^a-z0-9]*) uname_p="${uname_m}" ;;
|
||||
esac
|
||||
|
||||
id_u=$(id -u 2>/dev/null || /usr/xpg4/bin/id -u 2>/dev/null)
|
||||
|
||||
|
@ -1204,7 +1213,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.203 2009/02/25 23:34:10 lukem Exp $
|
||||
# Generated from: \$NetBSD: build.sh,v 1.204 2009/03/06 16:29:40 apb Exp $
|
||||
# with these arguments: ${_args}
|
||||
#
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: bsd.own.mk,v 1.557 2009/02/25 20:36:45 sketch Exp $
|
||||
# $NetBSD: bsd.own.mk,v 1.558 2009/03/06 16:29:41 apb Exp $
|
||||
|
||||
.if !defined(_BSD_OWN_MK_)
|
||||
_BSD_OWN_MK_=1
|
||||
|
@ -125,10 +125,16 @@ USETOOLS?= no
|
|||
.if !defined(HOST_OSTYPE)
|
||||
_HOST_OSNAME!= uname -s
|
||||
_HOST_OSREL!= uname -r
|
||||
_HOST_ARCH!= uname -p 2>/dev/null || uname -m
|
||||
# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
|
||||
# something that does not look like an identifier, then use uname -m.
|
||||
_HOST_ARCH!= uname -p 2>/dev/null
|
||||
_HOST_ARCH:= ${HOST_ARCH:tW:C/.*[^a-z0-9].*//:S/unknown//}
|
||||
.if empty(_HOST_ARCH)
|
||||
_HOST_ARCH!= uname -m
|
||||
.endif
|
||||
HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
|
||||
.MAKEOVERRIDES+= HOST_OSTYPE
|
||||
.endif
|
||||
.endif # !defined(HOST_OSTYPE)
|
||||
|
||||
.if ${USETOOLS} == "yes" # {
|
||||
|
||||
|
|
Loading…
Reference in New Issue