| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! /usr/bin/env sh | | 1 | #! /usr/bin/env sh |
2 | # $NetBSD: build.sh,v 1.198.2.2 2009/03/18 05:37:59 snj Exp $ | | 2 | # $NetBSD: build.sh,v 1.198.2.3 2009/03/18 05:39:06 snj Exp $ |
3 | # | | 3 | # |
4 | # Copyright (c) 2001-2008 The NetBSD Foundation, Inc. | | 4 | # Copyright (c) 2001-2008 The NetBSD Foundation, Inc. |
5 | # All rights reserved. | | 5 | # All rights reserved. |
6 | # | | 6 | # |
7 | # This code is derived from software contributed to The NetBSD Foundation | | 7 | # This code is derived from software contributed to The NetBSD Foundation |
8 | # by Todd Vierling and Luke Mewburn. | | 8 | # by Todd Vierling and Luke Mewburn. |
9 | # | | 9 | # |
10 | # Redistribution and use in source and binary forms, with or without | | 10 | # Redistribution and use in source and binary forms, with or without |
11 | # modification, are permitted provided that the following conditions | | 11 | # modification, are permitted provided that the following conditions |
12 | # are met: | | 12 | # are met: |
13 | # 1. Redistributions of source code must retain the above copyright | | 13 | # 1. Redistributions of source code must retain the above copyright |
14 | # notice, this list of conditions and the following disclaimer. | | 14 | # notice, this list of conditions and the following disclaimer. |
15 | # 2. Redistributions in binary form must reproduce the above copyright | | 15 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -168,27 +168,27 @@ initdefaults() | | | @@ -168,27 +168,27 @@ initdefaults() |
168 | # variables in share/mk/bsd.sys.mk. | | 168 | # variables in share/mk/bsd.sys.mk. |
169 | # | | 169 | # |
170 | # Note that "uname -p" is not part of POSIX, but we want uname_p | | 170 | # Note that "uname -p" is not part of POSIX, but we want uname_p |
171 | # to be set to the host MACHINE_ARCH, if possible. On systems | | 171 | # to be set to the host MACHINE_ARCH, if possible. On systems |
172 | # where "uname -p" fails, prints "unknown", or prints a string | | 172 | # where "uname -p" fails, prints "unknown", or prints a string |
173 | # that does not look like an identifier, fall back to using the | | 173 | # that does not look like an identifier, fall back to using the |
174 | # output from "uname -m" instead. | | 174 | # output from "uname -m" instead. |
175 | # | | 175 | # |
176 | uname_s=$(uname -s 2>/dev/null) | | 176 | uname_s=$(uname -s 2>/dev/null) |
177 | uname_r=$(uname -r 2>/dev/null) | | 177 | uname_r=$(uname -r 2>/dev/null) |
178 | uname_m=$(uname -m 2>/dev/null) | | 178 | uname_m=$(uname -m 2>/dev/null) |
179 | uname_p=$(uname -p 2>/dev/null || echo "unknown") | | 179 | uname_p=$(uname -p 2>/dev/null || echo "unknown") |
180 | case "${uname_p}" in | | 180 | case "${uname_p}" in |
181 | ''|unknown|*[^a-z0-9]*) uname_p="${uname_m}" ;; | | 181 | ''|unknown|*[^-_A-Za-z0-9]*) uname_p="${uname_m}" ;; |
182 | esac | | 182 | esac |
183 | | | 183 | |
184 | # If $PWD is a valid name of the current directory, POSIX mandates | | 184 | # If $PWD is a valid name of the current directory, POSIX mandates |
185 | # that pwd return it by default which causes problems in the | | 185 | # that pwd return it by default which causes problems in the |
186 | # presence of symlinks. Unsetting PWD is simpler than changing | | 186 | # presence of symlinks. Unsetting PWD is simpler than changing |
187 | # every occurrence of pwd to use -P. | | 187 | # every occurrence of pwd to use -P. |
188 | # | | 188 | # |
189 | # XXX Except that doesn't work on Solaris. Or many Linuces. | | 189 | # XXX Except that doesn't work on Solaris. Or many Linuces. |
190 | # | | 190 | # |
191 | unset PWD | | 191 | unset PWD |
192 | TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null) | | 192 | TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null) |
193 | | | 193 | |
194 | # The user can set HOST_SH in the environment, or we try to | | 194 | # The user can set HOST_SH in the environment, or we try to |
| @@ -1199,27 +1199,27 @@ createmakewrapper() | | | @@ -1199,27 +1199,27 @@ createmakewrapper() |
1199 | else | | 1199 | else |
1200 | makewrapout=">>\${makewrapper}" | | 1200 | makewrapout=">>\${makewrapper}" |
1201 | fi | | 1201 | fi |
1202 | | | 1202 | |
1203 | case "${KSH_VERSION:-${SH_VERSION}}" in | | 1203 | case "${KSH_VERSION:-${SH_VERSION}}" in |
1204 | *PD\ KSH*|*MIRBSD\ KSH*) | | 1204 | *PD\ KSH*|*MIRBSD\ KSH*) |
1205 | set +o braceexpand | | 1205 | set +o braceexpand |
1206 | ;; | | 1206 | ;; |
1207 | esac | | 1207 | esac |
1208 | | | 1208 | |
1209 | eval cat <<EOF ${makewrapout} | | 1209 | eval cat <<EOF ${makewrapout} |
1210 | #! ${HOST_SH} | | 1210 | #! ${HOST_SH} |
1211 | # Set proper variables to allow easy "make" building of a NetBSD subtree. | | 1211 | # Set proper variables to allow easy "make" building of a NetBSD subtree. |
1212 | # Generated from: \$NetBSD: build.sh,v 1.198.2.2 2009/03/18 05:37:59 snj Exp $ | | 1212 | # Generated from: \$NetBSD: build.sh,v 1.198.2.3 2009/03/18 05:39:06 snj Exp $ |
1213 | # with these arguments: ${_args} | | 1213 | # with these arguments: ${_args} |
1214 | # | | 1214 | # |
1215 | | | 1215 | |
1216 | EOF | | 1216 | EOF |
1217 | { | | 1217 | { |
1218 | for f in ${makeenv}; do | | 1218 | for f in ${makeenv}; do |
1219 | if eval "[ -z \"\${$f}\" -a \"\${${f}-X}\" = \"X\" ]"; then | | 1219 | if eval "[ -z \"\${$f}\" -a \"\${${f}-X}\" = \"X\" ]"; then |
1220 | eval echo "unset ${f}" | | 1220 | eval echo "unset ${f}" |
1221 | else | | 1221 | else |
1222 | eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}" | | 1222 | eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}" |
1223 | fi | | 1223 | fi |
1224 | done | | 1224 | done |
1225 | | | 1225 | |