On 2019/12/04 12:43, Christian Weisgerber wrote:
> On 2019-12-03, Antoine Jacoutot <ajacou...@bsdfrog.org> wrote:
> 
> >> # XXX libreoffice has its own way to build things in parallel
> >> USES_PARALLEL_MAKE = No
> >> 
> >> ?
> >
> > +1
> 
> Like USES_GMAKE, USES_GROFF, USES_LIBTOOL, ...?

hmm, fair point.

Perhaps we could do something like this instead, and set PARALLEL_MAKE_FLAGS
to nothing in libreoffice etc.

(I'm unsure about ALL_FAKE_FLAGS, I don't think anything currently
uses PARALLEL_INSTALL=No, but there have been cases before where
parallel-build is OK but parallel-install isn't).


Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1509
diff -u -p -r1.1509 bsd.port.mk
--- bsd.port.mk 2 Dec 2019 18:59:03 -0000       1.1509
+++ bsd.port.mk 4 Dec 2019 12:51:40 -0000
@@ -454,21 +454,23 @@ ALL_FAKE_FLAGS=   ${MAKE_FLAGS:N-j[0-9]*} 
 _PKG_ADD += -L ${LOCALBASE}
 .endif
 
-# XXX this stuff is not production-ready, because there are too many bugs in
-# parallel make yet.  MAKE_JOBS>1 is known to work on a few ports and used
-# sparingly by dpb (DPB_PROPERTIES=parallel) for obvious gains.
+# XXX there are still many bugs in parallel make.
+# so MAKE_JOBS is used sparingly by dpb for obvious gains.
 #
-PARALLEL_BUILD ?= Yes
-PARALLEL_INSTALL ?= ${PARALLEL_BUILD}
+PARALLEL_MAKE_FLAGS ?= -j${MAKE_JOBS}
+
+.if !defined(MAKE_JOBS) && ${DPB_PROPERTIES:Mparallel})
+.  if defined(PARALLEL_MAKE_JOBS)
+MAKE_JOBS = ${PARALLEL_MAKE_JOBS}
+.  else
+MAKE_JOBS !!= sysctl -n hw.ncpuonline
+.  endif
+.endif
 MAKE_JOBS ?= 1
 
 .if ${MAKE_JOBS} != 1
-.  if ${PARALLEL_BUILD:L} == "yes"
-MAKE_FLAGS += -j${MAKE_JOBS}
-.  endif
-.  if ${PARALLEL_INSTALL:L} == "yes"
-ALL_FAKE_FLAGS += -j${MAKE_JOBS}
-.  endif
+MAKE_FLAGS += ${PARALLEL_MAKE_FLAGS}
+ALL_FAKE_FLAGS += ${PARALLEL_MAKE_FLAGS}
 .endif
 
 # Here comes the part that sets BUILD_PACKAGES and various IGNORE* up.

Reply via email to