Subject: Re: userland build-date?
To: Luke Mewburn <lukem@netbsd.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-userlevel
Date: 01/04/2004 02:44:54
On Sun, 4 Jan 2004, Luke Mewburn wrote:
> Interesting idea.  We could also consider adding the details of the
> build system as well (a la the kernel build string).
>
> Have you tried adding a rule to etc/Makefile to build this and seeing
> how well it works?

Updated patch that includes all variables from src/BUILDING below.


 - Hubert

Index: etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.265
diff -u -r1.265 Makefile
--- etc/Makefile	1 Jan 2004 12:28:22 -0000	1.265
+++ etc/Makefile	4 Jan 2004 01:40:16 -0000
@@ -46,6 +46,7 @@
 TZDIR=		/usr/share/zoneinfo
 LOCALTIME?=	UTC
 MAKESUMS=	CKSUM=${TOOL_CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
+DISTRIBREVL!=	${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh

 # Flags for creating ISO CDROM image
 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
@@ -144,19 +145,39 @@
 	(cd ${.CURDIR}; ${MAKE} install-etc-files)
 .endif	# !DISTRIBUTION_DONE

-.PHONY: MAKEDEV
+.PHONY: MAKEDEV release-info
 MAKEDEV:
 	${_MKTARGET_CREATE}
 	MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
 	    NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
 	    awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}

+RELEASEVARS= MACHINE MACHINE_ARCH MAKE MAKEFLAGS MAKEOBJDIR MAKEOBJDIRPREFIX \
+	BUILDID DESTDIR MAKECONF MAKEVERBOSE MKCATPAGES MKCRYPTO MKDOC \
+	MKHOSTOBJ MKINFO MKLINT MKMAN MKNLS MKOBJ MKPIC MKPICINSTALL MKPROFILE \
+	MKSHARE MKUNPRIVED MKUPDATE TOOLDIR USETOOLS INSTALLWORLDDIR MKOBJDIRS \
+	MKUPDATE NBUILDJOBS NOCLEANDIR NODISTRIBDIRS NOINCLUDES RELEASEDIR \
+
+release-info:
+	@( echo "NetBSD ${DISTRIBREVL}/${MACHINE} built on `date`" ; \
+	   echo "	by ${USER}@`hostname`"; \
+	   echo ""; \
+	   echo "Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004" ; \
+           echo "	The NetBSD Foundation, Inc.  All rights reserved."; \
+	   echo "Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994"; \
+	   echo "	The Regents of the University of California.  All rights reserved."; \
+	   echo ""; \
+	   echo "Build settings:"; \
+	) >${.TARGET}
+.for var in ${RELEASEVARS}
+	@echo "	${var}=${${var}:Q}" >>${.TARGET}
+.endfor


 # install-etc-files --
 #	Install etc (config) files; not performed by "make build"
 #
-install-etc-files: check_DESTDIR MAKEDEV
+install-etc-files: check_DESTDIR MAKEDEV release-info
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
 	    ${BIN1} ${DESTDIR}/etc
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
@@ -182,6 +203,8 @@
 .endif	# MKUNPRIVED != no
 	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
 	    MAKEDEV ${DESTDIR}/dev
+	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
+	    release-info ${DESTDIR}/etc/release
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
 	    MAKEDEV.local ${DESTDIR}/dev
 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
Index: distrib/sets/lists/etc/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/etc/mi,v
retrieving revision 1.130
diff -u -r1.130 mi
--- distrib/sets/lists/etc/mi	3 Jan 2004 14:17:06 -0000	1.130
+++ distrib/sets/lists/etc/mi	4 Jan 2004 01:40:16 -0000
@@ -208,6 +208,7 @@
 ./etc/rc.shutdown			etc-sys-rc
 ./etc/rc.subr				etc-sys-rc
 ./etc/rc.wscons				etc-obsolete	obsolete
+./etc/release				etc-sys-etc
 ./etc/remote				etc-uucp-etc
 ./etc/rmt				etc-sysutil-etc
 ./etc/rpc				etc-net-etc

-- 
Hubert Feyrer <hubert@feyrer.de>