Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2009 10:11:13 +0200
From:      David Naylor <naylor.b.david@gmail.com>
To:        pav@freebsd.org
Cc:        pgollucci@p6m7g8.com, Ion-Mihai Tetcu <itetcu@freebsd.org>, freebsd-ports@freebsd.org
Subject:   Re: MAKE_JOBS_UNSAFE (some more ports)
Message-ID:  <200905251011.16083.naylor.b.david@gmail.com>
In-Reply-To: <1243194956.21797.4.camel@hood.oook.cz>
References:  <20090522.195350.193746535.chat95@mac.com> <200905242007.06917.naylor.b.david@gmail.com> <1243194956.21797.4.camel@hood.oook.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2396821.52uAcJvRMW
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Sunday 24 May 2009 21:55:56 Pav Lucistnik wrote:
> David Naylor p=C3=AD=C5=A1e v ne 24. 05. 2009 v 20:07 +0200:
> > On Sunday 24 May 2009 18:27:57 Pav Lucistnik wrote:
> > > Ion-Mihai Tetcu p=C3=AD=C5=A1e v ne 24. 05. 2009 v 19:01 +0300:
> > > > On Sun, 24 May 2009 16:10:23 +0200
> > > >
> > > > Pav Lucistnik <pav@FreeBSD.org> wrote:
> > > > > Ion-Mihai Tetcu p=C3=AD=C5=A1e 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?=3D	`${SYSCTL} -n kern.smp.cpus`
> > > > > >  _MAKE_JOBS=3D		-j${MAKE_JOBS_NUMBER}
> > > > > > -.else
> > > > > > -_MAKE_JOBS=3D		-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?=20

Not all ports use make but are concurrent capable and require different=20
arguments to be passed which is why I needed to expose MAKE_JOBS_NUMBER=20
(since it is just a number) and why _MAKE_JOBS was not an option. =20

The ooo* ports are an example of this, requiring -P.  Some ports may even=20
require multiple arguments to be passed (I do not have an example of that).=
 =20

> You cannot=20
> 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):
=2Einclude <bsd.port.pre.mk>
=2Eif !defined(NUMOFPROCESSES):
NUMOFPROCESSES!=3D	echo ${MAKE_JOBS_NUMBER}
=2Eendif

This example has some problems since MAKE_JOBS_NUMBER is defined in the pos=
t=20
section but if it where moved to the pre section then would work. =20

An alternative is to define a variable that would cause MAKE_JOBS_NUMBER to=
=20
resolve (but this still requires MAKE_JOBS_NUMBER to be moved to the pre=20
section):
=2Eif defined(MAKE_JOBS_RESOLVE)
=2Eif !defined(MAKE_JOBS_NUMBER)
MAKE_JOBS_NUMBER!=3D	${SYSCTL} -n kern.smk.cpus
=2Eendif
=2Eelse
MAKE_JOBS_NUMBER?=3D	`${SYSCTL} -n kern.smk.cpus`
=2Eendif
_MAKE_JOBS=3D	-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=
=20
differently, also see (about halfway down)=20
http://lists.freebsd.org/pipermail/freebsd-ports/2009-May/054777.html. =20

--nextPart2396821.52uAcJvRMW
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEABECAAYFAkoaUqQACgkQUaaFgP9pFrJPywCfSnxf0RAEbsyeNDwKFGVwP13I
xOcAn0ONi/RSY6fLjazdfcfitRjZxnoK
=7JzY
-----END PGP SIGNATURE-----

--nextPart2396821.52uAcJvRMW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905251011.16083.naylor.b.david>