git: 59f4abfaac8b - main - pkgbase: Allow to specify PKG_ABI on the command line

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 08 Dec 2021 07:40:41 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=59f4abfaac8b14a857625c5495284fced0c51fd6

commit 59f4abfaac8b14a857625c5495284fced0c51fd6
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-12-07 17:02:58 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2021-12-08 07:40:22 +0000

    pkgbase: Allow to specify PKG_ABI on the command line
    
    This is useful for creating kernel package without having to buildworld
    before as we use uname from the world stage dir to get the ABI.
    
    Reviewed by:    emaste, imp
    Differential Revision:  https://reviews.freebsd.org/D33323
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 Makefile.inc1 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 2f7d98341793..ee4f9b0dad4b 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1896,7 +1896,12 @@ _pkgbootstrap: .PHONY
 	@env ASSUME_ALWAYS_YES=YES pkg bootstrap
 .endif
 
-.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages)
+#
+# Allow overriding PKG_ABI, this allow to create kernel packages without having
+# to build world first.
+# If it's not provided resolv it from the uname binary in the world stage.
+#
+.if !defined(PKG_ABI) && (make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages))
 PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
 .endif
 PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\
@@ -2061,7 +2066,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap
 		/name/ { printf("===> Creating %s-", $$2); next } \
 		/version/ {print $$2; next } ' \
 		${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
-	${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \
+	${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
 		create -f ${PKG_FORMAT} \
 		-M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
 		-p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \