git: 181cc65dc462 - stable/14 - pkgbase: set a default set of kernel for when PACKAGE_BUILDING=1

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Sat, 02 Dec 2023 09:45:32 UTC
The branch stable/14 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=181cc65dc4625ee114a89786d72ec07366c39873

commit 181cc65dc4625ee114a89786d72ec07366c39873
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-11-02 13:20:11 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-12-02 09:44:58 +0000

    pkgbase: set a default set of kernel for when PACKAGE_BUILDING=1
    
    PACKAGE_BUILDING is already known in the ports tree as a variable
    use to defined when the packages is being actually built in an
    automation process, reuse that variable to define the default set
    of kernel we plan to build for the default pkgbase.
    
    Reviewed by:    manu, jrtc27
    Accepted by:    manu
    MFC After:      1 week
    Differential Revision:  https://reviews.freebsd.org/D42444
    
    (cherry picked from commit df6e7e11c5f660cbd5381819718e3c947325fa2e)
---
 Makefile.inc1 | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 9f3f15a3194a..7e62894405df 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1678,15 +1678,10 @@ NO_KERNELOBJ=		t
 KERNCONF=${KERNFAST}
 .endif
 .endif
-.if ${TARGET_ARCH} == "powerpc64"
-KERNCONF?=	GENERIC64
-.elif ${TARGET_ARCH} == "powerpc64le"
-KERNCONF?=	GENERIC64LE
-.elif ${TARGET_ARCH} == "powerpcspe"
-KERNCONF?=	MPC85XXSPE
-.else
-KERNCONF?=	GENERIC
-.endif
+GENERIC_KERNCONF_SUFX_powerpc64=	64
+GENERIC_KERNCONF_SUFX_powerpc64le=	64LE
+GENERIC_KERNCONF_powerpcspe=	MPC85XXSPE
+GENERIC_KERNCONF?=	${GENERIC_KERNCONF_${TARGET_ARCH}:UGENERIC${GENERIC_KERNCONF_SUFX_${TARGET_ARCH}}}
 INSTKERNNAME?=	kernel
 
 KERNSRCDIR?=	${.CURDIR}/sys
@@ -1694,6 +1689,23 @@ KRNLCONFDIR=	${KERNSRCDIR}/${TARGET}/conf
 KRNLOBJDIR=	${OBJTOP}${KERNSRCDIR:C,^${.CURDIR},,}
 KERNCONFDIR?=	${KRNLCONFDIR}
 
+.for _k in ${GENERIC_KERNCONF} MINIMAL${GENERIC_KERNCONF_SUFX_${TARGET_ARCH}} ${GENERIC_KERNCONF}-MMCCAM
+.if exists(${KERNCONFDIR}/${_k})
+PKG_KERNCONF+=	${_k}
+.for _dbg in NODEBUG DEBUG
+.if exists(${KERNCONFDIR}/${_k}-${_dbg})
+PKG_KERNCONF+= ${_k}-${_dbg}
+.endif
+.endfor
+.endif
+.endfor
+
+.if defined(PACKAGE_BUILDING)
+KERNCONF?=	${PKG_KERNCONF}
+.else
+KERNCONF?=	${GENERIC_KERNCONF}
+.endif
+
 BUILDKERNELS=
 INSTALLKERNEL=
 .if defined(NO_INSTALLKERNEL)