Sunday, December 01, 2019

patch: make dpb and ports more uniform

So dpb has been using MAKE_JOBS for a while, and landry said it would be
cool to actually have it work with regular builds as well.

This patch:
- admits that parallel make is going to be used;
- renames PARALLEL_BUILD to something that reflects its actual usage
(and consumers as well): PARALLEL_USES_MAKE
- adds a PARALLEL_MAKE_JOBS that allows the user to tweak the number
of MAKE_JOBS used if they want (set to hw.ncpuonline)


The names are somewhat straightforward, though not particularly inspired,
so I'm game for suggestions.

The logic itself is also possibly improvable...




Index: infrastructure/mk/bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1505
diff -u -p -r1.1505 bsd.port.mk
--- infrastructure/mk/bsd.port.mk 26 Nov 2019 11:49:02 -0000 1.1505
+++ infrastructure/mk/bsd.port.mk 1 Dec 2019 10:26:58 -0000
@@ -454,19 +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_USES_MAKE ?= Yes
+
+.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"
+. if ${PARALLEL_USES_MAKE:L} == "yes"
MAKE_FLAGS += -j${MAKE_JOBS}
-. endif
-. if ${PARALLEL_INSTALL:L} == "yes"
ALL_FAKE_FLAGS += -j${MAKE_JOBS}
. endif
.endif
Index: editors/libreoffice/Makefile
===================================================================
RCS file: /cvs/ports/editors/libreoffice/Makefile,v
retrieving revision 1.221
diff -u -p -r1.221 Makefile
--- editors/libreoffice/Makefile 6 Nov 2019 12:21:06 -0000 1.221
+++ editors/libreoffice/Makefile 1 Dec 2019 10:26:58 -0000
@@ -354,11 +354,11 @@ CONFIGURE_ARGS+=--without-java
.endif

# XXX libreoffice has its own way to build things in parallel
-PARALLEL_BUILD = No
+PARALLEL_USES_MAKE = No
.if defined(MAKE_JOBS)
NCPU= ${MAKE_JOBS}
.elif ${FLAVOR:Mparallel}
-NCPU!= echo $$((`sysctl -n hw.ncpuonline` + 1))
+NCPU!!= echo $$((`sysctl -n hw.ncpuonline` + 1))
.else
NCPU= 1
.endif
Index: devel/jdk/1.8/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/1.8/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- devel/jdk/1.8/Makefile 21 Nov 2019 17:39:08 -0000 1.48
+++ devel/jdk/1.8/Makefile 1 Dec 2019 10:26:58 -0000
@@ -84,7 +84,7 @@ USE_GMAKE= Yes
GMAKE= ${LOCALBASE}/bin/gmake

# Don't call make -jN, instead pass MAKE_JOBS to --with-jobs
-PARALLEL_BUILD= No
+PARALLEL_USES_MAKE= No

CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= --disable-option-checking \
Index: devel/jdk/11/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/11/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- devel/jdk/11/Makefile 26 Oct 2019 17:04:15 -0000 1.11
+++ devel/jdk/11/Makefile 1 Dec 2019 10:26:58 -0000
@@ -84,7 +84,7 @@ USE_GMAKE= Yes
GMAKE= ${LOCALBASE}/bin/gmake

# Don't call make -jN, instead pass MAKE_JOBS to --with-jobs
-PARALLEL_BUILD= No
+PARALLEL_USES_MAKE= No

CONFIGURE_STYLE=gnu
CONFIGURE_ENV+= AUTOCONF_VERSION=${AUTOCONF_VERSION} \

No comments:

Post a Comment