git: d7d5c9efef03 - main - pkgbase: Let source packages be built in parallel

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 19 Aug 2024 14:37:37 UTC
The branch main has been updated by markj:

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

commit d7d5c9efef031aa11a841d1836f7c937dcbe4ec8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-19 14:08:05 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-19 14:37:27 +0000

    pkgbase: Let source packages be built in parallel
    
    To build the packages target, we build src and src-sys packages
    containing the source code from which the repo was built.  These
    packages take significantly longer than the others, presumably because
    they contain many more files.  Because both source packages are built
    to satisfy the same target, they end up being built serially.  Split
    them into separate subtargets so that they can run in parallel.  This
    saves a couple of minutes on my build machine.
    
    Reviewed by:    manu, emaste
    MFC after:      1 month
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D46288
---
 Makefile.inc1 | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 62296134f7d8..4df7f1900cf4 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2119,17 +2119,13 @@ create-packages-source:	_pkgbootstrap _repodir .PHONY
 
 create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source
 
-create-source-packages: _pkgbootstrap .PHONY
+create-source-src-package: _pkgbootstrap .PHONY
 	rm -f ${SSTAGEDIR}/*.plist 2>/dev/null || :
 .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
 	@cd ${SRCDIR}; \
 		( echo "@override_prefix /usr/src" ;  \
 		${GIT_CMD} ls-files --recurse-submodules ":!:sys/" ) \
 		> ${SSTAGEDIR}/src.plist
-	@cd ${SRCDIR}; \
-		( echo "@override_prefix /usr/src" ; \
-		${GIT_CMD} ls-files --recurse-submodules "sys/" ) \
-		> ${SSTAGEDIR}/src-sys.plist
 	${SRCDIR}/release/packages/generate-ucl.lua \
 		PKGNAME "src" \
 		PKGGENNAME "src" \
@@ -2141,6 +2137,22 @@ create-source-packages: _pkgbootstrap .PHONY
 		PKG_WWW "${PKG_WWW}" \
 		${SRCDIR}/release/packages/template.ucl \
 		${SSTAGEDIR}/src.ucl
+	${PKG_CMD} -o ABI=${PKG_ABI} \
+		-o OSVERSION="${SRCRELDATE}" \
+		create -f ${PKG_FORMAT} \
+		-M ${SSTAGEDIR}/src.ucl \
+		-p ${SSTAGEDIR}/src.plist \
+		-r ${SRCDIR} \
+		-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
+.endif
+
+create-source-src-sys-package: _pkgbootstrap .PHONY
+	rm -f ${SSTAGEDIR}/*.plist 2>/dev/null || :
+.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
+	@cd ${SRCDIR}; \
+		( echo "@override_prefix /usr/src" ; \
+		${GIT_CMD} ls-files --recurse-submodules "sys/" ) \
+		> ${SSTAGEDIR}/src-sys.plist
 	${SRCDIR}/release/packages/generate-ucl.lua \
 		PKGNAME "src-sys" \
 		PKGGENNAME "src" \
@@ -2152,13 +2164,6 @@ create-source-packages: _pkgbootstrap .PHONY
 		PKG_WWW "${PKG_WWW}" \
 		${SRCDIR}/release/packages/template.ucl \
 		${SSTAGEDIR}/src-sys.ucl
-	${PKG_CMD} -o ABI=${PKG_ABI} \
-		-o OSVERSION="${SRCRELDATE}" \
-		create -f ${PKG_FORMAT} \
-		-M ${SSTAGEDIR}/src.ucl \
-		-p ${SSTAGEDIR}/src.plist \
-		-r ${SRCDIR} \
-		-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
 	${PKG_CMD} -o ABI=${PKG_ABI} \
 		-o OSVERSION="${SRCRELDATE}" \
 		create -f ${PKG_FORMAT} \
@@ -2168,6 +2173,8 @@ create-source-packages: _pkgbootstrap .PHONY
 		-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
 .endif
 
+create-source-packages: .PHONY _pkgbootstrap create-source-src-package create-source-src-sys-package
+
 create-world-packages:	_pkgbootstrap .PHONY
 	@rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || :
 	@cd ${WSTAGEDIR} ; \