[Buildroot] [PATCH 1/3 v2] infra/pkg-golang: enforce number of parallel jobs

Arnout Vandecappelle arnout at mind.be
Tue Nov 27 17:42:14 UTC 2018



On 25/11/2018 10:19, Yann E. MORIN wrote:
> By default, the go compiler will spawn as many jobs as there are CPUs
> available, thus possibily over-shooting the limits set by the user.
> 
> Make it abide by the user's wish, and specify the number of jobs allowed
> to run.
> 
> We can do so without fear of a package failing to build in parallel,
> because they were already all building in parallel, as that is the
> default for the go compiler.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
> ---
>  package/pkg-golang.mk | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
> index 6eacd14180..4f2c7e77e1 100644
> --- a/package/pkg-golang.mk
> +++ b/package/pkg-golang.mk
> @@ -55,8 +55,10 @@ ifeq ($(BR2_STATIC_LIBS),y)
>  $(2)_LDFLAGS += -extldflags '-static'
>  endif
>  
> -$(2)_BUILD_OPTS += -ldflags "$$($(2)_LDFLAGS)"
> -$(2)_BUILD_OPTS += -tags "$$($(2)_TAGS)"
> +$(2)_BUILD_OPTS += \
> +	-ldflags "$$($(2)_LDFLAGS)" \
> +	-tags "$$($(2)_TAGS)" \
> +	-p $(PARALLEL_JOBS)

 I wonder, if BR2_LEVEL == 0, if it wouldn't be more appropriate to not pass any
option. That said, it probably needlessly complicates things.

 [I also wonder but don't want to think about: what will happen in top-level
parallel build...]

 Regards,
 Arnout

>  
>  # Target packages need the Go compiler on the host.
>  $(2)_DEPENDENCIES += host-go
> 


More information about the buildroot mailing list