mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
package/go: add a HOST_GO_HOST_ENV variable
package/go/go.mk provides a HOST_GO_TARGET_ENV which provides a useful set of environment variables needed to build target Go packages. For host packages, we simply have package/pkg-golang.mk defining GO_HOST_ENV to specify CFLAGS/LDFLAGS, but that's it: we don't pass an explicit path to the compiler, we don't pass GO111MODULE, GOCACHE, GOROOT, etc. This commit introduces a HOST_GO_HOST_ENV variable that provides the appropriate set of environment variables to use when building host golang packages. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
@@ -77,6 +77,18 @@ else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
|||||||
HOST_GO_CGO_ENABLED = 1
|
HOST_GO_CGO_ENABLED = 1
|
||||||
endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||||
|
|
||||||
|
# For the convenience of host golang packages
|
||||||
|
HOST_GO_HOST_ENV = \
|
||||||
|
GO111MODULE=off \
|
||||||
|
GOARCH="" \
|
||||||
|
GOCACHE="$(HOST_GO_HOST_CACHE)" \
|
||||||
|
GOROOT="$(HOST_GO_ROOT)" \
|
||||||
|
CC="$(HOST_CCNOCCACHE)" \
|
||||||
|
CXX="$(HOST_CXXNOCCACHE)" \
|
||||||
|
CGO_CFLAGS="$(HOST_CFLAGS)" \
|
||||||
|
CGO_CXXFLAGS="$(HOST_CXXFLAGS)" \
|
||||||
|
CGO_LDFLAGS="$(HOST_LDFLAGS)"
|
||||||
|
|
||||||
# The go build system is not compatible with ccache, so use
|
# The go build system is not compatible with ccache, so use
|
||||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||||
HOST_GO_MAKE_ENV = \
|
HOST_GO_MAKE_ENV = \
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ GO_TARGET_ENV = \
|
|||||||
$(GO_COMMON_ENV)
|
$(GO_COMMON_ENV)
|
||||||
|
|
||||||
GO_HOST_ENV = \
|
GO_HOST_ENV = \
|
||||||
CGO_CFLAGS="$(HOST_CFLAGS)" \
|
$(HOST_GO_HOST_ENV) \
|
||||||
CGO_LDFLAGS="$(HOST_LDFLAGS)" \
|
|
||||||
$(GO_COMMON_ENV)
|
$(GO_COMMON_ENV)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user