git: 00d241bb50a1 - main - java/openjdk17: pass --with-jobs to honour MAKE_JOBS_NUMBER

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Sat, 13 Sep 2025 19:33:23 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=00d241bb50a1e8ec79bff2ec6f0127126079e03d

commit 00d241bb50a1e8ec79bff2ec6f0127126079e03d
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2025-09-13 12:38:14 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2025-09-13 19:32:54 +0000

    java/openjdk17: pass --with-jobs to honour MAKE_JOBS_NUMBER
    
    The configure script detects cores and memory and calculates itself how many jobs it uses.
    
    checking for number of cores... 28
    checking for memory size... 130926 MB
    checking for appropriate number of jobs to run in parallel... 28
    
    Override this by the variables of our ports framework.
    
    If this fixes the flapping builds I want to apply it to the other openjdk* ports.
    
    Bump portrevision so future failures are easy to trace back.
    
    Suggested in: https://lists.freebsd.org/archives/freebsd-java/2025-September/003304.html
---
 java/openjdk17/Makefile | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/java/openjdk17/Makefile b/java/openjdk17/Makefile
index 9549ff9b0984..8e4fb466e6f0 100644
--- a/java/openjdk17/Makefile
+++ b/java/openjdk17/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	openjdk
 DISTVERSIONPREFIX=	jdk-
 DISTVERSION=	${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_PATCH_VERSION}+${JDK_BUILD_NUMBER}-${BSD_JDK_VERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	java devel
 PKGNAMESUFFIX?=	${JDK_MAJOR_VERSION}
 
@@ -48,7 +48,6 @@ MAKE_ENV=	LANG="C" \
 		CXX=${CXX} \
 		CPP=${CPP} \
 		MAKEFLAGS=""
-MAKE_JOBS_UNSAFE=	yes
 
 JDK_OSARCH=	bsd-${ARCH:S/amd64/x86_64/:S/i386/x86/:S/powerpc64/ppc64/}
 JDK_BUILDDIR=	${WRKSRC}/build/${JDK_OSARCH}-${JDK_BUILD_JVM}-${JDK_BUILD_TYPE}
@@ -102,6 +101,12 @@ CONFIGURE_ARGS=	--with-boot-jdk=${BOOTSTRAPJDKDIR} \
 		--with-vendor-bug-url="${JDK_BUG_URL}" \
 		--with-vendor-vm-bug-url="${JDK_BUG_URL}"
 
+.if defined(MAKE_JOBS_UNSAFE)
+CONFIGURE_ARGS+=	--with-jobs=1
+.elif defined(MAKE_JOBS_NUMBER)
+CONFIGURE_ARGS+=	--with-jobs=${MAKE_JOBS_NUMBER}
+.endif
+
 JAVAVMS_COMMENT=	OpenJDK${JDK_MAJOR_VERSION}
 
 .if defined(BUILD_JRE)
@@ -113,6 +118,11 @@ JDK_BUILD_TYPE=		release
 
 .include <bsd.port.pre.mk>
 
+# portsfallout.com shows flapping builds on 13.5 and 14.2
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1403000
+MAKE_JOBS_UNSAFE=	yes
+.endif
+
 BOOTSTRAP_JDKS=	${LOCALBASE}/openjdk17 ${LOCALBASE}/bootstrap-openjdk17
 
 # do we have valid native jdk installed?