svn commit: r256386 - in stable/9: include sys/conf

Ian Lepore ian at FreeBSD.org
Sat Oct 12 17:31:22 UTC 2013


Author: ian
Date: Sat Oct 12 17:31:21 2013
New Revision: 256386
URL: http://svnweb.freebsd.org/changeset/base/256386

Log:
  MFC r255775 r255796 r255807 r255930 r255929 r255957:
  
  Create a separate script to generate osreldate.h rather than sourcing
  newvers.sh into a temporary subshell with inline make rules.
  Fixes PR 160646.
  
  Allow the path to the system source directory to be passed in to
  newvers.sh.  Pass it in from include/Makefile.  If it isn't passed in,
  fall back to the old logic of using dirname $0.  Fixes PR 174422.
  
  PR:		160646 174422

Added:
  stable/9/include/mk-osreldate.sh
     - copied, changed from r255775, head/include/mk-osreldate.sh
Modified:
  stable/9/include/Makefile
  stable/9/sys/conf/newvers.sh
Directory Properties:
  stable/9/include/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)

Modified: stable/9/include/Makefile
==============================================================================
--- stable/9/include/Makefile	Sat Oct 12 17:27:59 2013	(r256385)
+++ stable/9/include/Makefile	Sat Oct 12 17:31:21 2013	(r256386)
@@ -99,19 +99,18 @@ SHARED?=	copies
 
 INCS+=	osreldate.h
 
-osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
-    ${.CURDIR}/Makefile
-	@${ECHO} creating osreldate.h from newvers.sh
-	@MAKE=${MAKE}; \
-	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
-	. ${.CURDIR}/../sys/conf/newvers.sh; \
-	echo "$$COPYRIGHT" > osreldate.h; \
-	echo "#ifdef _KERNEL" >> osreldate.h; \
-	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
-	echo "#else" >> osreldate.h; \
-	echo "#undef __FreeBSD_version" >> osreldate.h; \
-	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
-	echo "#endif" >> osreldate.h
+SYSDIR=			${.CURDIR}/../sys
+NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
+PARAM_H=		${SYSDIR}/sys/param.h
+MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
+
+osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
+	env ECHO="${ECHO}" \
+	    MAKE="${MAKE}" \
+	    NEWVERS_SH=${NEWVERS_SH} \
+	    PARAM_H=${PARAM_H} \
+	    SYSDIR=${SYSDIR} \
+	    sh ${MK_OSRELDATE_SH}
 
 .for i in ${LHDRS}
 INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i

Copied and modified: stable/9/include/mk-osreldate.sh (from r255775, head/include/mk-osreldate.sh)
==============================================================================
--- head/include/mk-osreldate.sh	Sat Sep 21 22:36:07 2013	(r255775, copy source)
+++ stable/9/include/mk-osreldate.sh	Sat Oct 12 17:31:21 2013	(r256386)
@@ -36,7 +36,9 @@ trap "rm -f $tmpfile" EXIT
 ${ECHO} creating osreldate.h from newvers.sh
 
 export PARAMFILE="${PARAM_H:=$CURDIR/../sys/sys/param.h}"
-. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}"
+set +e
+. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}" || exit 1
+set -e
 cat > $tmpfile <<EOF
 $COPYRIGHT
 #ifdef _KERNEL
@@ -46,4 +48,5 @@ $COPYRIGHT
 #define __FreeBSD_version $RELDATE
 #endif
 EOF
+chmod 644 $tmpfile
 mv $tmpfile osreldate.h

Modified: stable/9/sys/conf/newvers.sh
==============================================================================
--- stable/9/sys/conf/newvers.sh	Sat Oct 12 17:27:59 2013	(r256385)
+++ stable/9/sys/conf/newvers.sh	Sat Oct 12 17:31:21 2013	(r256386)
@@ -38,7 +38,10 @@ if [ "X${BRANCH_OVERRIDE}" != "X" ]; the
 fi
 RELEASE="${REVISION}-${BRANCH}"
 VERSION="${TYPE} ${RELEASE}"
-SYSDIR=$(dirname $0)/..
+
+if [ "X${SYSDIR}" = "X" ]; then
+    SYSDIR=$(dirname $0)/..
+fi
 
 if [ "X${PARAMFILE}" != "X" ]; then
 	RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \


More information about the svn-src-stable-9 mailing list