Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Athaariq Ardhiansyah <foss@athaariq.my.id>
Cc: Thomas Perale <thomas.perale@mind.be>,
	Anisse Astier <anisse@astier.eu>,
	Christian Stewart <christian@aperture.us>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 2/3] package/go: move source-specific to go-src
Date: Sat, 14 Sep 2024 18:27:55 +0200	[thread overview]
Message-ID: <ZuW5i2Hudvb0rsK-@landeda> (raw)
In-Reply-To: <20240610154028.792440-2-foss@athaariq.my.id>

Athaariq, All,

On 2024-06-10 22:40 +0700, Athaariq Ardhiansyah spake thusly:
> Some of package/go/go.mk includes source compilation specific
> requirements, which are not effective for prebuilt Go compiler option.
> Therefore, I moved some of source-specific conditionals and variables to
> the host-go-src before adding host-go-bin support.

In fact, a lot of those variables are going to be needed for both cases,
like GO_GOARCH, GO_GOARM, et al, so we do want to keep a songle place
where they aredefined, even if some of them are only used once in the
go-src case.

Regards,
Yann E. MORIN.

> Signed-off-by: Athaariq Ardhiansyah <foss@athaariq.my.id>
> ---
>  package/go/go-src/go-src.mk | 68 +++++++++++++++++++++++++++++++++++
>  package/go/go.mk            | 71 -------------------------------------
>  2 files changed, 68 insertions(+), 71 deletions(-)
> 
> diff --git a/package/go/go-src/go-src.mk b/package/go/go-src/go-src.mk
> index 1e061e20bc..a0c903282f 100644
> --- a/package/go/go-src/go-src.mk
> +++ b/package/go/go-src/go-src.mk
> @@ -16,6 +16,67 @@ HOST_GO_SRC_DEPENDENCIES = host-go-bootstrap-stage3
>  
>  ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
>  
> +ifeq ($(BR2_arm),y)
> +GO_GOARCH = arm
> +ifeq ($(BR2_ARM_CPU_ARMV5),y)
> +GO_GOARM = 5
> +else ifeq ($(BR2_ARM_CPU_ARMV6),y)
> +GO_GOARM = 6
> +else ifeq ($(BR2_ARM_CPU_ARMV7A),y)
> +GO_GOARM = 7
> +else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
> +# Go doesn't support 32-bit GOARM=8 (https://github.com/golang/go/issues/29373)
> +# but can still benefit from armv7 optimisations
> +GO_GOARM = 7
> +endif
> +else ifeq ($(BR2_aarch64),y)
> +GO_GOARCH = arm64
> +else ifeq ($(BR2_i386),y)
> +GO_GOARCH = 386
> +# i386: use softfloat if no SSE2: https://golang.org/doc/go1.16#386
> +ifneq ($(BR2_X86_CPU_HAS_SSE2),y)
> +GO_GO386 = softfloat
> +endif
> +else ifeq ($(BR2_x86_64),y)
> +GO_GOARCH = amd64
> +else ifeq ($(BR2_powerpc64),y)
> +GO_GOARCH = ppc64
> +else ifeq ($(BR2_powerpc64le),y)
> +GO_GOARCH = ppc64le
> +else ifeq ($(BR2_mips64),y)
> +GO_GOARCH = mips64
> +else ifeq ($(BR2_mips64el),y)
> +GO_GOARCH = mips64le
> +else ifeq ($(BR2_riscv),y)
> +GO_GOARCH = riscv64
> +else ifeq ($(BR2_s390x),y)
> +GO_GOARCH = s390x
> +endif
> +
> +# For the convienience of target packages.
> +HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH)
> +HOST_GO_TARGET_ENV = \
> +	$(HOST_GO_COMMON_ENV) \
> +	GOOS="linux" \
> +	GOARCH=$(GO_GOARCH) \
> +	CC="$(TARGET_CC)" \
> +	CXX="$(TARGET_CXX)" \
> +	CGO_CFLAGS="$(TARGET_CFLAGS)" \
> +	CGO_CXXFLAGS="$(TARGET_CXXFLAGS)" \
> +	CGO_LDFLAGS="$(TARGET_LDFLAGS)" \
> +	GOTOOLDIR="$(HOST_GO_TOOLDIR)"
> +
> +# The go compiler's cgo support uses threads.  If BR2_TOOLCHAIN_HAS_THREADS is
> +# set, build in cgo support for any go programs that may need it.  Note that
> +# any target package needing cgo support must include
> +# 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file.
> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> +HOST_GO_DEPENDENCIES += toolchain
> +HOST_GO_CGO_ENABLED = 1
> +else
> +HOST_GO_CGO_ENABLED = 0
> +endif
> +
>  HOST_GO_SRC_CROSS_ENV = \
>  	CC_FOR_TARGET="$(TARGET_CC)" \
>  	CXX_FOR_TARGET="$(TARGET_CXX)" \
> @@ -25,6 +86,11 @@ HOST_GO_SRC_CROSS_ENV = \
>  	$(if $(GO_GOARM),GOARM=$(GO_GOARM)) \
>  	GO_ASSUME_CROSSCOMPILING=1
>  
> +else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
> +# host-go can still be used to build packages for the host. No need to set all
> +# the arch stuff since we will not be cross-compiling.
> +HOST_GO_CGO_ENABLED = 1
> +
>  endif
>  
>  # The go build system is not compatible with ccache, so use
> @@ -52,3 +118,5 @@ define HOST_GO_SRC_INSTALL_CMDS
>  endef
>  
>  $(eval $(host-generic-package))
> +
> +include $(sort $(wildcard package/go/go-bootstrap-*/*.mk))
> diff --git a/package/go/go.mk b/package/go/go.mk
> index dfcb633aa7..489d749d46 100644
> --- a/package/go/go.mk
> +++ b/package/go/go.mk
> @@ -26,75 +26,6 @@ HOST_GO_COMMON_ENV = \
>  	GOBIN= \
>  	CGO_ENABLED=$(HOST_GO_CGO_ENABLED)
>  
> -ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
> -
> -ifeq ($(BR2_arm),y)
> -GO_GOARCH = arm
> -ifeq ($(BR2_ARM_CPU_ARMV5),y)
> -GO_GOARM = 5
> -else ifeq ($(BR2_ARM_CPU_ARMV6),y)
> -GO_GOARM = 6
> -else ifeq ($(BR2_ARM_CPU_ARMV7A),y)
> -GO_GOARM = 7
> -else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
> -# Go doesn't support 32-bit GOARM=8 (https://github.com/golang/go/issues/29373)
> -# but can still benefit from armv7 optimisations
> -GO_GOARM = 7
> -endif
> -else ifeq ($(BR2_aarch64),y)
> -GO_GOARCH = arm64
> -else ifeq ($(BR2_i386),y)
> -GO_GOARCH = 386
> -# i386: use softfloat if no SSE2: https://golang.org/doc/go1.16#386
> -ifneq ($(BR2_X86_CPU_HAS_SSE2),y)
> -GO_GO386 = softfloat
> -endif
> -else ifeq ($(BR2_x86_64),y)
> -GO_GOARCH = amd64
> -else ifeq ($(BR2_powerpc64),y)
> -GO_GOARCH = ppc64
> -else ifeq ($(BR2_powerpc64le),y)
> -GO_GOARCH = ppc64le
> -else ifeq ($(BR2_mips64),y)
> -GO_GOARCH = mips64
> -else ifeq ($(BR2_mips64el),y)
> -GO_GOARCH = mips64le
> -else ifeq ($(BR2_riscv),y)
> -GO_GOARCH = riscv64
> -else ifeq ($(BR2_s390x),y)
> -GO_GOARCH = s390x
> -endif
> -
> -# For the convienience of target packages.
> -HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH)
> -HOST_GO_TARGET_ENV = \
> -	$(HOST_GO_COMMON_ENV) \
> -	GOOS="linux" \
> -	GOARCH=$(GO_GOARCH) \
> -	CC="$(TARGET_CC)" \
> -	CXX="$(TARGET_CXX)" \
> -	CGO_CFLAGS="$(TARGET_CFLAGS)" \
> -	CGO_CXXFLAGS="$(TARGET_CXXFLAGS)" \
> -	CGO_LDFLAGS="$(TARGET_LDFLAGS)" \
> -	GOTOOLDIR="$(HOST_GO_TOOLDIR)"
> -
> -# The go compiler's cgo support uses threads.  If BR2_TOOLCHAIN_HAS_THREADS is
> -# set, build in cgo support for any go programs that may need it.  Note that
> -# any target package needing cgo support must include
> -# 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file.
> -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> -HOST_GO_DEPENDENCIES += toolchain
> -HOST_GO_CGO_ENABLED = 1
> -else
> -HOST_GO_CGO_ENABLED = 0
> -endif
> -
> -else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
> -# host-go can still be used to build packages for the host. No need to set all
> -# the arch stuff since we will not be cross-compiling.
> -HOST_GO_CGO_ENABLED = 1
> -endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
> -
>  # For the convenience of host golang packages
>  HOST_GO_HOST_ENV = \
>  	$(HOST_GO_COMMON_ENV) \
> @@ -130,5 +61,3 @@ define GO_BINARIES_INSTALL
>  endef
>  
>  $(eval $(host-virtual-package))
> -
> -include $(sort $(wildcard package/go/*/*.mk))
> -- 
> 2.45.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-09-14 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 15:40 [Buildroot] [PATCH 1/3] package/go: expose option to enable via configurator Athaariq Ardhiansyah
2024-06-10 15:40 ` [Buildroot] [PATCH 2/3] package/go: move source-specific to go-src Athaariq Ardhiansyah
2024-09-14 16:27   ` Yann E. MORIN [this message]
2024-06-10 15:40 ` [Buildroot] [PATCH 3/3] package/go: add prebuilt Go compiler option Athaariq Ardhiansyah
2024-09-14 16:31   ` Yann E. MORIN
2024-09-14 16:24 ` [Buildroot] [PATCH 1/3] package/go: expose option to enable via configurator Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZuW5i2Hudvb0rsK-@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=anisse@astier.eu \
    --cc=buildroot@buildroot.org \
    --cc=christian@aperture.us \
    --cc=foss@athaariq.my.id \
    --cc=thomas.perale@mind.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox