From 0210509acd4bcf53b116da01deb0f25b1d16da89 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 28 Sep 2013 16:39:46 +0000 Subject: [PATCH] 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. Using dirname $0 does not yield the path to the script if it was sourced in from another script in another directory; you end up with the parent script's path. That was causing newvers.sh to look one level below the FreeBSD src/ directory when building osreldate.h and it may find something like a git or svn repo there that has nothing to do with FreeBSD. PR: 174422 Approved by: re () MFC after: 2 weeks --- include/Makefile | 6 ++++-- sys/conf/newvers.sh | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/Makefile b/include/Makefile index cfe46201a12e..fd15613b2621 100644 --- a/include/Makefile +++ b/include/Makefile @@ -104,8 +104,9 @@ SHARED?= copies INCS+= osreldate.h -NEWVERS_SH= ${.CURDIR}/../sys/conf/newvers.sh -PARAM_H= ${.CURDIR}/../sys/sys/param.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} @@ -113,6 +114,7 @@ osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} MAKE="${MAKE}" \ NEWVERS_SH=${NEWVERS_SH} \ PARAM_H=${PARAM_H} \ + SYSDIR=${SYSDIR} \ sh ${MK_OSRELDATE_SH} .for i in ${LHDRS} diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 6a0c18c702d7..2f23b12edf63 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -38,7 +38,10 @@ if [ "X${BRANCH_OVERRIDE}" != "X" ]; then 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}' \