All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [git commit branch/next] package/go: add a HOST_GO_HOST_ENV variable
Date: Sat, 29 Aug 2020 14:35:48 +0200	[thread overview]
Message-ID: <20200829124232.8B45C815E9@busybox.osuosl.org> (raw)

commit: https://git.buildroot.net/buildroot/commit/?id=7c3e3cbcf215c56c378a912a6a6ca40edc61d7ad
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

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>
---
 package/go/go.mk      | 12 ++++++++++++
 package/pkg-golang.mk |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/package/go/go.mk b/package/go/go.mk
index 72604a250b..9e9679ccd2 100644
--- a/package/go/go.mk
+++ b/package/go/go.mk
@@ -77,6 +77,18 @@ else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 HOST_GO_CGO_ENABLED = 1
 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
 # HOSTCC_NOCCACHE.  See https://github.com/golang/go/issues/11685.
 HOST_GO_MAKE_ENV = \
diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index 2494ce028c..79c27b855f 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -35,8 +35,7 @@ GO_TARGET_ENV = \
 	$(GO_COMMON_ENV)
 
 GO_HOST_ENV = \
-	CGO_CFLAGS="$(HOST_CFLAGS)" \
-	CGO_LDFLAGS="$(HOST_LDFLAGS)" \
+	$(HOST_GO_HOST_ENV) \
 	$(GO_COMMON_ENV)
 
 ################################################################################

                 reply	other threads:[~2020-08-29 12:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200829124232.8B45C815E9@busybox.osuosl.org \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.