Subject: Re: pkgsrc on SMP machines
To: Lars Nordlund <lars.nordlund@hem.utfors.se>
From: None <segv@netctl.net>
List: tech-pkg
Date: 12/21/2005 22:49:15
On Wed, 21 Dec 2005 23:23:45 +0100
Lars Nordlund <lars.nordlund@hem.utfors.se> wrote:

> On Tue, 20 Dec 2005 00:20:30 +0000
> segv@netctl.net wrote:
> > > Have you tried turning off WRAPPER_UPDATE_CACHE like I suggested
> > > earlier?
> > 
> > No, I didn't realise it would cause problems. I'll give it a try.
> > Thanks for the pointers.
> 
> Have you had time to test -j6 building on an SMP machin with the
> wrapper cache turned off? Did it work?
> 
> 
> Best regards,
> 	Lars Nordlund

Yes I did, it seems to have worked, i.e. I've been building packages and have
not yet encountered those errors (which previously originated from wrapper
scripts)

Below is what I have in my mk.conf to get make fork multiple jobs:

WRAPPER_UPDATE_CACHE=no
MAKE_FLAGS+=-j4

on a 4 CPU Sun machine, www/firefox build is using all CPUs most of the time.

To make this more automatic, we need to define a new variable MAKE_JOBS, so
that the users could put MAKE_JOBS=4 in mk.conf. Each package would need to
define MAKE_JOBS_SAFE=yes if it has been tested to support parallel make.

mk/bsd.pkg.mk would need to have something like:

.if ${MAKE_JOBS_SAFE} == "yes"
	MAKE_FLAGS+=${MAKE_JOBS}
.else
	MAKE_FLAGS+=-j1
.endif