From: Chris Morgan Subject: Re: [PATCH 2/2] wineinstall - Add support for parallel builds using 'nproc' to detect cpu count Message-Id: Date: Sat, 25 Feb 2017 00:55:11 +0000 In-Reply-To: References: <20170225003026.4695-1-chmorgan@gmail.com> <20170225003026.4695-2-chmorgan@gmail.com> On Fri, Feb 24, 2017 at 7:41 PM Austin English wrote: > On Fri, Feb 24, 2017 at 6:30 PM, Chris Morgan wrote: > > Parallel builds can greatly reduce the overall build time on modern > multi-core processors. > > > > Fall back to two parallel builds in the case where nproc is unavailable, > most modern > > processors have at least two cores. > > > > Use the 'NPROC' value defined by the environment if it is not null. > > > > Signed-off-by: Chris Morgan > > --- > > tools/wineinstall | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/tools/wineinstall b/tools/wineinstall > > index bfd62e3..080d590 100755 > > --- a/tools/wineinstall > > +++ b/tools/wineinstall > > @@ -143,10 +143,19 @@ echo "in the meantime..." > > echo > > std_sleep > > > > +# If the NPROC environment variable isn't set use nproc, if available, > to determine > > +# the number of processors in the system, if not, fall back to a > default NPROC value > > +if type nproc2 &>/dev/null > > I don't think this will do what you want ;) > > Also, I'm pretty sure &> isn't Posix. You'd want something like: > if type nproc > /dev/null 2>&1 > > -- > -Austin > GPG: 14FB D7EA A041 937B Dammit. Left that in from testing like a dope. I'll check on the redirect and resubmit... again... Chris
On Fri, Feb 24, 2017 at 7:41 PM Austin English <austinenglish@gmail.com> wrote:
On Fri, Feb 24, 2017 at 6:30 PM, Chris Morgan <chmorgan@gmail.com> wrote:
> Parallel builds can greatly reduce the overall build time on modern multi-core processors.
>
> Fall back to two parallel builds in the case where nproc is unavailable, most modern
> processors have at least two cores.
>
> Use the 'NPROC' value defined by the environment if it is not null.
>
> Signed-off-by: Chris Morgan <chmorgan@gmail.com>
> ---
>  tools/wineinstall | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tools/wineinstall b/tools/wineinstall
> index bfd62e3..080d590 100755
> --- a/tools/wineinstall
> +++ b/tools/wineinstall
> @@ -143,10 +143,19 @@ echo "in the meantime..."
>  echo
>  std_sleep
>
> +# If the NPROC environment variable isn't set use nproc, if available, to determine
> +# the number of processors in the system, if not, fall back to a default NPROC value
> +if type nproc2 &>/dev/null

I don't think this will do what you want ;)

Also, I'm pretty sure &> isn't Posix. You'd want something like:
if type nproc > /dev/null 2>&1

--
-Austin
GPG: 14FB D7EA A041 937B


Dammit. Left that in from testing like a dope.

I'll check on the redirect and resubmit... again...

Chris