Treat DPB_PROPERTIES=parallel as a hint that a port is parallel-safe

for use in regular builds too; if that is present in a port, use
${PARALLEL_MAKE_JOBS} jobs in the build, defaulting to hw.ncpuonline.

Adjust PARALLEL_BUILD=No, this originally seemed intended to be a hint
that a port could NOT handle a parallel build, but current usage is
"don't pass make -jXX because this port has its own way to handle things",
instead change this to a slightly more understandable PARALLEL_MAKE_FLAGS
variable. This defaults to -j${PARALLEL_MAKE_JOBS} but can be reset for
build system requirements as needed (java/libreoffice have their own
mechanism) and is added automatically to MAKE_FLAGS where a build uses
>1 concurrent job.

Based on a diff from / ok espie@ - the default value may want revising
as hw.ncpuonline jobs will be too many in some cases (e.g. machines with
many cores or low RAM), but committing at this stage to avoid further
out-of-tree bikeshedding. If you need to restrict to a lower number of
jobs, set e.g. PARALLEL_MAKE_JOBS=2 in /etc/mk.conf, and please provide
feedback.
This commit is contained in:
sthen 2019-12-05 21:18:08 +00:00
parent d52f3b17d9
commit e506a46e80
5 changed files with 29 additions and 33 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.48 2019/11/21 17:39:08 tb Exp $
# $OpenBSD: Makefile,v 1.49 2019/12/05 21:18:08 sthen Exp $
ONLY_FOR_ARCHS= i386 amd64
USE_WXNEEDED= Yes
@ -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_MAKE_FLAGS=
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= --disable-option-checking \

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.11 2019/10/26 17:04:15 kurt Exp $
# $OpenBSD: Makefile,v 1.12 2019/12/05 21:18:08 sthen Exp $
ONLY_FOR_ARCHS= i386 amd64 aarch64
USE_WXNEEDED= Yes
@ -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_MAKE_FLAGS=
CONFIGURE_STYLE=gnu
CONFIGURE_ENV+= AUTOCONF_VERSION=${AUTOCONF_VERSION} \

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.221 2019/11/06 12:21:06 robert Exp $
# $OpenBSD: Makefile,v 1.222 2019/12/05 21:18:08 sthen Exp $
USE_WXNEEDED= Yes
@ -136,7 +136,7 @@ PERMIT_PACKAGE= Yes
MULTI_PACKAGES= -main -java -kde
PSEUDO_FLAVORS= parallel no_lang
PSEUDO_FLAVORS= no_lang
FLAVORS= debug no_java
FLAVOR?=
@ -354,15 +354,8 @@ CONFIGURE_ARGS+=--without-java
.endif
# XXX libreoffice has its own way to build things in parallel
PARALLEL_BUILD = No
.if defined(MAKE_JOBS)
NCPU= ${MAKE_JOBS}
.elif ${FLAVOR:Mparallel}
NCPU!= echo $$((`sysctl -n hw.ncpuonline` + 1))
.else
NCPU= 1
.endif
CONFIGURE_ARGS+=--with-parallelism=${NCPU}
PARALLEL_MAKE_FLAGS =
CONFIGURE_ARGS+=--with-parallelism=${MAKE_JOBS}
.if ${FLAVOR:Mdebug}
CONFIGURE_ARGS+=--enable-debug

View File

@ -1,4 +1,4 @@
$OpenBSD: README.internals,v 1.16 2019/12/01 09:36:29 espie Exp $
$OpenBSD: README.internals,v 1.17 2019/12/05 21:18:08 sthen Exp $
Copyright (C) 2011-2012 Marc Espie <espie@openbsd.org>
Permission to use, copy, modify, and distribute this software for any
@ -437,15 +437,16 @@ _PERL_FIX_SHAR make visible ?
TODO fully document:
MAKE_JOBS
PARALLEL_BUILD
PARALLEL_INSTALL
XAUTHORITY for interactive tests
MAKE_JOBS is set by dpb based on DPB_PROPERTIES=parallel
PARALLEL_BUILD is currently used to control passing MAKE_JOBS as make -j.
(some ports do MAKE_JOBS differently: libreoffice, jdk)
MAKE_JOBS is set by dpb based on DPB_PROPERTIES=parallel or can be set
by the user. When MAKE_JOBS is >1, PARALLEL_MAKE_FLAGS is added to
MAKE_FLAGS, by default this contains -j${MAKE_JOBS} which works for
most ports. Some ports do MAKE_JOBS differently (libreoffice, jdk),
in those cases "make -j" is not wanted, so PARALLEL_MAKE_FLAGS
should be explicitly cleared.
Probably time to rename that and really document it.
PARALLEL_INSTALL is unused.
fishy: FLAVORS tests ?
fishy: TEST_STATUS_IGNORE

View File

@ -1,6 +1,6 @@
#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# $OpenBSD: bsd.port.mk,v 1.1509 2019/12/02 18:59:03 espie Exp $
# $OpenBSD: bsd.port.mk,v 1.1510 2019/12/05 21:18:08 sthen Exp $
#
# bsd.port.mk - 940820 Jordan K. Hubbard.
# This file is in the public domain.
@ -454,21 +454,23 @@ ALL_FAKE_FLAGS= ${MAKE_FLAGS:N-j[0-9]*} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS}
_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.