Module Name:    src
Committed By:   msaitoh
Date:           Fri Mar 27 14:50:36 UTC 2009

Modified Files:
        src [netbsd-5]: Makefile
        src/etc [netbsd-5]: Makefile
        src/sys/arch/x86/acpi [netbsd-5]: Makefile.wakecode.inc genwakecode.sh
        src/sys/conf [netbsd-5]: Makefile.kern.inc
        src/usr.bin/hexdump [netbsd-5]: parse.c
        src/usr.sbin/postinstall [netbsd-5]: postinstall

Log Message:
Pull up following revision(s) (requested by sketch in ticket #536):
        etc/Makefile: revision 1.364
        Makefile: revision 1.267
        usr.sbin/postinstall/postinstall: revision 1.90
        usr.bin/hexdump/parse.c: revision 1.25
        sys/arch/x86/acpi/genwakecode.sh: revision 1.3
        usr.sbin/postinstall/postinstall: revision 1.87
        usr.sbin/postinstall/postinstall: revision 1.88
        usr.sbin/postinstall/postinstall: revision 1.89
        sys/arch/x86/acpi/Makefile.wakecode.inc: revision 1.4
        sys/conf/Makefile.kern.inc: revision 1.120
Use ll instead of non-standard q as length modifier in format strings. Makes
this work on Solaris. OK by apb.
Not every grep knows -q. Ok by apb.
Use sed, awk and hexdump from tools to make this work on Solaris. Ok by apb.
Use awk and grep host tools where required.  'build.sh release' now
works on Solaris (but only with HOST_CC=/usr/sfw/bin/gcc for now).
"grep -q" is not portable; use "grep >/dev/null" instead.  Also add a
comment saying that postinstal is invoked during a cross build.
In file_exists_exact(), fix an incorrect test of "1" instead of "$1",
and improve the comment explaining what this function does.
As long as we don't yet have a working TOOL_GREP, fgrep is more portablethan 
grep -F.


To generate a diff of this commit:
cvs rdiff -u -r1.262.2.2 -r1.262.2.3 src/Makefile
cvs rdiff -u -r1.359.2.2 -r1.359.2.3 src/etc/Makefile
cvs rdiff -u -r1.3 -r1.3.26.1 src/sys/arch/x86/acpi/Makefile.wakecode.inc
cvs rdiff -u -r1.2 -r1.2.28.1 src/sys/arch/x86/acpi/genwakecode.sh
cvs rdiff -u -r1.118.4.1 -r1.118.4.2 src/sys/conf/Makefile.kern.inc
cvs rdiff -u -r1.24 -r1.24.24.1 src/usr.bin/hexdump/parse.c
cvs rdiff -u -r1.76.2.9 -r1.76.2.10 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.262.2.2 src/Makefile:1.262.2.3
--- src/Makefile:1.262.2.2	Sat Dec  6 22:07:34 2008
+++ src/Makefile	Fri Mar 27 14:50:35 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.262.2.2 2008/12/06 22:07:34 snj Exp $
+#	$NetBSD: Makefile,v 1.262.2.3 2009/03/27 14:50:35 msaitoh Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -177,17 +177,17 @@
 
 postinstall-check: .PHONY
 	@echo "   === Post installation checks ==="
-	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
+	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
 	@echo "   ================================"
 
 postinstall-fix: .NOTMAIN .PHONY
 	@echo "   === Post installation fixes ==="
-	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
+	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
 	@echo "   ==============================="
 
 postinstall-fix-obsolete: .NOTMAIN .PHONY
 	@echo "   === Removing obsolete files ==="
-	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
+	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
 	@echo "   ==============================="
 
 

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.359.2.2 src/etc/Makefile:1.359.2.3
--- src/etc/Makefile:1.359.2.2	Sat Dec  6 22:00:31 2008
+++ src/etc/Makefile	Fri Mar 27 14:50:35 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.359.2.2 2008/12/06 22:00:31 snj Exp $
+#	$NetBSD: Makefile,v 1.359.2.3 2009/03/27 14:50:35 msaitoh Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -367,10 +367,10 @@
 	mkdir -p ${OBSOLETE.dir}
 .if ${MKX11} != "no"
 	(cd ${NETBSDSRCDIR}/distrib/sets && \
-	    MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
+	    AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
 .else
 	(cd ${NETBSDSRCDIR}/distrib/sets && \
-	    MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
+	    AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
 .endif
 .for file in ${OBSOLETE.files}
 	${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}

Index: src/sys/arch/x86/acpi/Makefile.wakecode.inc
diff -u src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.3 src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.3.26.1
--- src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.3	Tue Dec 11 13:56:50 2007
+++ src/sys/arch/x86/acpi/Makefile.wakecode.inc	Fri Mar 27 14:50:36 2009
@@ -1,8 +1,12 @@
-# $NetBSD: Makefile.wakecode.inc,v 1.3 2007/12/11 13:56:50 lukem Exp $
+# $NetBSD: Makefile.wakecode.inc,v 1.3.26.1 2009/03/27 14:50:36 msaitoh Exp $
 # FreeBSD: src/sys/i386/acpica/Makefile,v 1.3 2002/05/01 21:54:07 peter Exp
 
 ACPI_WAKECODE_S=	${S}/arch/${MACHINE}/acpi/acpi_wakecode.S
 ACPI_GENWAKECODE=	${S}/arch/x86/acpi/genwakecode.sh
+ACPI_GENCMD=		AWK=${TOOL_AWK:Q} \
+			HEXDUMP=${TOOL_HEXDUMP:Q} \
+			SED=${TOOL_SED:Q} \
+			${HOST_SH}
 
 acpi_wakecode.h: ${ACPI_WAKECODE_S} ${ACPI_GENWAKECODE}
 	${_MKTARGET_CREATE}
@@ -10,7 +14,7 @@
 	${LD} -M -Map acpi_wakecode.bin.map -z defs -nostdlib \
 	    --oformat binary -e wakeup_16 -Ttext 0 \
 	    -o acpi_wakecode.bin acpi_wakecode.o
-	${HOST_SH} ${ACPI_GENWAKECODE} > acpi_wakecode.h
+	${ACPI_GENCMD} ${ACPI_GENWAKECODE} > acpi_wakecode.h
 	rm -f acpi_wakecode.bin acpi_wakecode.o acpi_wakecode.bin.map
 
 acpi_wakeup.o acpi_wakeup.d: acpi_wakecode.h

Index: src/sys/arch/x86/acpi/genwakecode.sh
diff -u src/sys/arch/x86/acpi/genwakecode.sh:1.2 src/sys/arch/x86/acpi/genwakecode.sh:1.2.28.1
--- src/sys/arch/x86/acpi/genwakecode.sh:1.2	Sun Dec  9 20:32:18 2007
+++ src/sys/arch/x86/acpi/genwakecode.sh	Fri Mar 27 14:50:36 2009
@@ -1,12 +1,16 @@
 #!/bin/sh
-# $NetBSD: genwakecode.sh,v 1.2 2007/12/09 20:32:18 jmcneill Exp $
+# $NetBSD: genwakecode.sh,v 1.2.28.1 2009/03/27 14:50:36 msaitoh Exp $
+
+AWK=${AWK:=awk}
+HEXDUMP=${HEXDUMP:=hexdump}
+SED=${SED:=sed}
 
 P='/WAKEUP_/ { printf("#define\t%s%s\t%s\n", $2, length($2) < 16 ? "\t" : "", $1); }'
-awk "$P" < acpi_wakecode.bin.map
+${AWK} "$P" < acpi_wakecode.bin.map
 
 echo 
 echo 'static const unsigned char wakecode[] = {';
-hexdump -v -e '"\t" 8/1 "0x%02x, " "\n"' < acpi_wakecode.bin | sed 's/0x  /0x00/g'
+${HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' < acpi_wakecode.bin | ${SED} 's/0x  /0x00/g'
 echo '};'
 
 exit 0

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.118.4.1 src/sys/conf/Makefile.kern.inc:1.118.4.2
--- src/sys/conf/Makefile.kern.inc:1.118.4.1	Sun Mar 15 19:43:48 2009
+++ src/sys/conf/Makefile.kern.inc	Fri Mar 27 14:50:36 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.118.4.1 2009/03/15 19:43:48 snj Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.118.4.2 2009/03/27 14:50:36 msaitoh Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -233,7 +233,7 @@
 .endif
 
 SYSTEM_LD_TAIL+=; \
-	if grep -q '^\#define.*SYMTAB_SPACE' opt_ddbparam.h; then \
+	if grep '^\#define.*SYMTAB_SPACE' opt_ddbparam.h > /dev/null; then \
 		echo "${DBSYM} $@"; \
 		${DBSYM} $@; \
 	fi

Index: src/usr.bin/hexdump/parse.c
diff -u src/usr.bin/hexdump/parse.c:1.24 src/usr.bin/hexdump/parse.c:1.24.24.1
--- src/usr.bin/hexdump/parse.c:1.24	Mon Oct  9 14:27:06 2006
+++ src/usr.bin/hexdump/parse.c	Fri Mar 27 14:50:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.24 2006/10/09 14:27:06 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.24.24.1 2009/03/27 14:50:36 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: parse.c,v 1.24 2006/10/09 14:27:06 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.24.24.1 2009/03/27 14:50:36 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -216,7 +216,7 @@
 	PR *pr, **nextpr;
 	FU *fu;
 	char *p1, *p2;
-	char savech, *fmtp, cs[3];
+	char savech, *fmtp, cs[4];
 	int nconv, prec;
 
 	prec = 0;
@@ -287,9 +287,10 @@
 				goto isint;
 			case 'o': case 'u': case 'x': case 'X':
 				pr->flags = F_UINT;
-isint:				cs[2] = '\0';
-				cs[1] = cs[0];
-				cs[0] = 'q';
+isint:				cs[3] = '\0';
+				cs[2] = cs[0];
+				cs[1] = 'l';
+				cs[0] = 'l';
 				switch(fu->bcnt) {
 				case 0: case 4:
 					pr->bcnt = 4;
@@ -347,9 +348,10 @@
 					++p2;
 					switch(p1[2]) {
 					case 'd': case 'o': case'x':
-						cs[0] = 'q';
-						cs[1] = p1[2];
-						cs[2] = '\0';
+						cs[0] = 'l';
+						cs[1] = 'l';
+						cs[2] = p1[2];
+						cs[3] = '\0';
 						break;
 					default:
 						p1[3] = '\0';

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.76.2.9 src/usr.sbin/postinstall/postinstall:1.76.2.10
--- src/usr.sbin/postinstall/postinstall:1.76.2.9	Sat Mar 14 04:51:25 2009
+++ src/usr.sbin/postinstall/postinstall	Fri Mar 27 14:50:36 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.76.2.9 2009/03/14 04:51:25 snj Exp $
+# $NetBSD: postinstall,v 1.76.2.10 2009/03/27 14:50:36 msaitoh Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -46,6 +46,13 @@
 #	- differentiate between "needs fix" versus "can't fix" issues
 #
 
+# This script is executed as part of a cross build.  Allow the build
+# environment to override the locations of some tools.
+: ${AWK:=awk}
+: ${FGREP:=fgrep}
+: ${GREP:=grep}
+: ${MAKE:=make}
+
 #
 #	helper functions
 #
@@ -183,7 +190,7 @@
 	if [ "${_op}" = "fix" ]; then
 		_notfixed="${NOT_FIXED}"
 	fi
-	_missing="$(awk -F: '
+	_missing="$(${AWK} -F: '
 		BEGIN {
 			for (x = 1; x < ARGC; x++)
 				idlist[ARGV[x]]++
@@ -406,7 +413,7 @@
 #
 file_exists_exact()
 {
-	[ -n "1" ] || err 3 "USAGE: file_exists_exact path"
+	[ -n "$1" ] || err 3 "USAGE: file_exists_exact path"
 	_path="${1#.}"
 	[ -h "${DEST_DIR}${_path}" ] || \
         	[ -e "${DEST_DIR}${_path}" ] || return 1
@@ -414,7 +421,7 @@
 		_dirname="$(dirname "${_path}" 2>/dev/null)"
 		_basename="$(basename "${_path}" 2>/dev/null)"
 		ls -fa "${DEST_DIR}${_dirname}" 2> /dev/null \
-			| grep -q -x -F "${_basename}" \
+			| ${FGREP} -x "${_basename}" >/dev/null \
 			|| return 1
 		_path="${_dirname}"
 	done
@@ -481,7 +488,7 @@
 	cd "${DEST_DIR}/${dir}" || err 2 "can't cd to ${DEST_DIR}/${dir}"
 	echo lib*.so.* \
 	| tr ' ' '\n' \
-	| awk -v LibDir="${dir}/" '
+	| ${AWK} -v LibDir="${dir}/" '
 #{
 
 function digit(v, c, n) { return (n <= c) ? v[n] : 0 }
@@ -542,7 +549,7 @@
 	_mfprog="$4"
 	_mffailed=0
 
-	awk "${_mfprog}" < "${_mffile}" > "${_mfscratch}"
+	${AWK} "${_mfprog}" < "${_mffile}" > "${_mfscratch}"
 	if ! cmp -s "${_mffile}" "${_mfscratch}"; then
 		diff "${_mffile}" "${_mfscratch}" > "${_mfscratch}.diffs"
 		if [ "${_mfop}" = "check" ]; then
@@ -601,7 +608,7 @@
 
 	for _var in "$@"; do
 		_value="$(echo '.include <bsd.own.mk>' | \
-		    ${MAKE:-make} -f - -V "${_var}")"
+		    ${MAKE} -f - -V "${_var}")"
 
 		eval ${_var}=\"${_value}\"
 	done
@@ -788,7 +795,7 @@
 		env MACHINE="${MACHINE}" \
 		    MACHINE_ARCH="${MACHINE_ARCH}" \
 		    NETBSDSRCDIR="${SRC_DIR}" \
-		    awk -f "${SRC_DIR}/etc/MAKEDEV.awk" \
+		    ${AWK} -f "${SRC_DIR}/etc/MAKEDEV.awk" \
 		    "${SRC_DIR}/etc/MAKEDEV.tmpl" > "${SCRATCHDIR}/MAKEDEV"
 	fi
 
@@ -807,9 +814,9 @@
 {
 	[ -n "$1" ] || err 3 "USAGE: do_motd  fix|check"
 
-	if grep -i 'http://www.NetBSD.org/Misc/send-pr.html' \
+	if ${GREP} -i 'http://www.NetBSD.org/Misc/send-pr.html' \
 		"${DEST_DIR}/etc/motd" >/dev/null 2>&1 \
-	    || grep -i 'http://www.NetBSD.org/support/send-pr.html' \
+	    || ${GREP} -i 'http://www.NetBSD.org/support/send-pr.html' \
 		"${DEST_DIR}/etc/motd" >/dev/null 2>&1
 	then
 		tmp1="$(mktemp /tmp/postinstall.motd.XXXXXXXX)"
@@ -1114,7 +1121,7 @@
 	op="$1"
 
 	failed=0
-	mta_path="$(awk '/^sendmail[ \t]/{print$2}' /etc/mailer.conf)"
+	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' /etc/mailer.conf)"
 	old_sendmail_path="/usr/libexec/sendmail/sendmail"
 	if [ "${mta_path}" = "${old_sendmail_path}" ]; then
 	    if [ "$op" = check ]; then

Reply via email to