MAKE_JOBS_UNSAFE (some more ports)
David Naylor
naylor.b.david at gmail.com
Mon May 25 08:10:26 UTC 2009
On Sunday 24 May 2009 21:55:56 Pav Lucistnik wrote:
> David Naylor píše v ne 24. 05. 2009 v 20:07 +0200:
> > On Sunday 24 May 2009 18:27:57 Pav Lucistnik wrote:
> > > Ion-Mihai Tetcu píše v ne 24. 05. 2009 v 19:01 +0300:
> > > > On Sun, 24 May 2009 16:10:23 +0200
> > > >
> > > > Pav Lucistnik <pav at FreeBSD.org> wrote:
> > > > > Ion-Mihai Tetcu píše v so 23. 05. 2009 v 13:51 +0300:
> > > > > > > > - MAKE_JOBS_NUMBER defaults (but user defined) to number of
> > > > > > > > cores
> > > > > >
> > > > > > This part looks OK, I wonder if there's any reason t ain't like
> > > > > > this now; Pav?
> > > > > > -.if defined(MAKE_JOBS_NUMBER)
> > > > > > +MAKE_JOBS_NUMBER?= `${SYSCTL} -n kern.smp.cpus`
> > > > > > _MAKE_JOBS= -j${MAKE_JOBS_NUMBER}
> > > > > > -.else
> > > > > > -_MAKE_JOBS= -j`${SYSCTL} -n kern.smp.cpus`
> > > > > > -.endif
> > > > >
> > > > > Wouldn't that mean an evaluation of the backtick command in every
> > > > > make(1) invocation? That would be highly undesirable.
> >
> > I don't believe that is the case.
> >
> > Here is what I get with the patch applied (MAKE_JOBS_NUMBER not defined):
> > /usr/ports/editors/openoffice.org-3# make -V MAKE_JOBS_NUMBER -V
> > _MAKE_JOBS `/sbin/sysctl -n kern.smp.cpus`
> > -j`/sbin/sysctl -n kern.smp.cpus`
> >
> > Wouldn't this indicate that the backtick command is not being evaluated?
>
> Seems correct. But explain again, why you need this change?
Not all ports use make but are concurrent capable and require different
arguments to be passed which is why I needed to expose MAKE_JOBS_NUMBER
(since it is just a number) and why _MAKE_JOBS was not an option.
The ooo* ports are an example of this, requiring -P. Some ports may even
require multiple arguments to be passed (I do not have an example of that).
> You cannot
> use it to evaluate single/multi-processor machine in Makefile, as it's
> not expanded there either.
To do the checking in a Makefile (in the ooo2 example):
.include <bsd.port.pre.mk>
.if !defined(NUMOFPROCESSES):
NUMOFPROCESSES!= echo ${MAKE_JOBS_NUMBER}
.endif
This example has some problems since MAKE_JOBS_NUMBER is defined in the post
section but if it where moved to the pre section then would work.
An alternative is to define a variable that would cause MAKE_JOBS_NUMBER to
resolve (but this still requires MAKE_JOBS_NUMBER to be moved to the pre
section):
.if defined(MAKE_JOBS_RESOLVE)
.if !defined(MAKE_JOBS_NUMBER)
MAKE_JOBS_NUMBER!= ${SYSCTL} -n kern.smk.cpus
.endif
.else
MAKE_JOBS_NUMBER?= `${SYSCTL} -n kern.smk.cpus`
.endif
_MAKE_JOBS= -j${MAKE_JOBS_NUMBER}
> And why should anything fail with -j1 but work with -j4? That is totally
> unexpected.
I agree but the ports exist. ooo2 is an example that handles the two cases
differently, also see (about halfway down)
http://lists.freebsd.org/pipermail/freebsd-ports/2009-May/054777.html.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20090525/bb118b9e/attachment.pgp
More information about the freebsd-ports
mailing list