MAKE_JOBS_ARG

Jonathan Perkin <[email protected]> Sun, 26 Jul 2026 13:00:51 +0100
Newsgroups gmane.os.netbsd.devel.packages
Message-ID <[email protected]>
--v2LoFpBAw5I2x4ou
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline

Some packages such as openjdk have custom methods for specifying 
parallel builds.  Currently they use what I consider to be a bodge where 
MAKE_JOBS_SAFE=no is set and then they append MAKE_JOBS manually.  This 
is simply to avoid the default BUILD_MAKE_CMD hardcoding "-jN".

This isn't compatible with bob's dynamic scheduler, which uses 
MAKE_JOBS_SAFE in its purest form where "no" means to not assign the 
package multiple jobs, and thus openjdk* currently get MAKE_JOBS=1.

I'd like to introduce a better mechanism, currently named MAKE_JOBS_ARG, 
where packages can set this to "no" which prunes the default "-jN" but 
they are still marked as supporting parallel builds.

Diff is attached, bikeshed away.

Cheers,

-- 
Jonathan Perkin                    pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com

--v2LoFpBAw5I2x4ou
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=make-jobs-arg.diff

diff --git a/mk/build/build.mk b/mk/build/build.mk
index aba7c5d1bec5..ebea5ab4a5d1 100644
--- a/mk/build/build.mk
+++ b/mk/build/build.mk
@@ -17,6 +17,14 @@
 # BUILD_TARGET is the target from ${MAKE_FILE} that should be invoked
 #	to build the sources.
 #
+# MAKE_JOBS_ARG
+#	Whether to pass -j.  Some packages have their own mechanism for
+#	specifying parallel builds, in which case this should be set to "no"
+#	and the custom arguments constructed manually.  The default value is
+#	"yes".
+#
+#	Keywords: parallel
+#
 # MAKE_JOBS_SAFE
 #	Whether the package supports parallel builds. If set to yes,
 #	at most MAKE_JOBS jobs are carried out in parallel. The default
@@ -40,13 +48,15 @@
 _VARGROUPS+=		build
 _DEF_VARS.build=	_MAKE_JOBS_N
 _USER_VARS.build=	MAKE_JOBS BUILD_ENV_SHELL
-_PKG_VARS.build=	MAKE_ENV MAKE_FLAGS BUILD_MAKE_FLAGS BUILD_TARGET MAKE_JOBS_SAFE
+_PKG_VARS.build=	MAKE_ENV MAKE_FLAGS BUILD_MAKE_FLAGS BUILD_TARGET
+_PKG_VARS.build+=	MAKE_JOBS_ARG MAKE_JOBS_SAFE
 _SYS_VARS.build=	BUILD_MAKE_CMD
 _SORTED_VARS.build=	*_ENV
 _LISTED_VARS.build=	*_FLAGS *_CMD
 
 BUILD_MAKE_FLAGS?=	# none
 BUILD_TARGET?=		all
+MAKE_JOBS_ARG?=		yes
 
 BUILD_MAKE_CMD= \
 	${PKGSRC_SETENV} ${MAKE_ENV}					\
@@ -58,10 +68,14 @@ BUILD_MAKE_CMD= \
 _MAKE_JOBS=	# nothing
 _MAKE_JOBS_N=	1
 .elif defined(MAKE_JOBS.${PKGPATH})
+.  if ${MAKE_JOBS_ARG} == "yes"
 _MAKE_JOBS=	-j${MAKE_JOBS.${PKGPATH}}
+.  endif
 _MAKE_JOBS_N=	${MAKE_JOBS.${PKGPATH}}
 .elif defined(MAKE_JOBS)
+.  if ${MAKE_JOBS_ARG} == "yes"
 _MAKE_JOBS=	-j${MAKE_JOBS}
+.  endif
 _MAKE_JOBS_N=	${MAKE_JOBS}
 .else
 _MAKE_JOBS_N=	1

--v2LoFpBAw5I2x4ou--