git: 89f361f742ae - main - kern.post.mk allow NEWVERS_{ENV,ARGS}
Date: Mon, 17 Jul 2023 19:04:21 UTC
The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=89f361f742aeae11c8b2e28eae3d015882b6c0ee commit 89f361f742aeae11c8b2e28eae3d015882b6c0ee Author: Simon J. Gerraty <sjg@FreeBSD.org> AuthorDate: 2023-07-17 19:03:35 +0000 Commit: Simon J. Gerraty <sjg@FreeBSD.org> CommitDate: 2023-07-17 19:03:35 +0000 kern.post.mk allow NEWVERS_{ENV,ARGS} Allow makefiles better control of newvers.sh env and args. Also allow variable overrides on command line. Reviewed by: imp, stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D41012 --- sys/conf/kern.post.mk | 5 +++-- sys/conf/newvers.sh | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index c368d5f40df8..45df83e2d16b 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -444,11 +444,12 @@ config.o env.o hints.o vers.o vnode_if.o: ${NORMAL_C} ${NORMAL_CTFCONVERT} +NEWVERS_ENV+= MAKE="${MAKE}" .if ${MK_REPRODUCIBLE_BUILD} != "no" -REPRO_FLAG="-R" +NEWVERS_ARGS+= -R .endif vers.c: .NOMETA_CMP $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP:Nvers.*} - MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} + ${NEWVERS_ENV} sh $S/conf/newvers.sh ${NEWVERS_ARGS} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 85346b1cdc29..e21b3f5ce2e2 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -58,13 +58,23 @@ BRANCH="CURRENT" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi -RELEASE="${REVISION}-${BRANCH}" -VERSION="${TYPE} ${RELEASE}" if [ -z "${SYSDIR}" ]; then - SYSDIR=$(dirname $0)/.. + SYSDIR=$(dirname $0)/.. fi +# allow random overrides +while : +do + case "$1" in + *=*) eval "$1"; shift;; + *) break;; + esac +done + +RELEASE="${RELEASE:-${REVISION}-${BRANCH}}" +VERSION="${VERSION:-${TYPE} ${RELEASE}}" + RELDATE=$(awk '/^#define[[:space:]]*__FreeBSD_version/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h}) if [ -r "${SYSDIR}/../COPYRIGHT" ]; then