summaryrefslogtreecommitdiffstats
path: root/package/go
diff options
context:
space:
mode:
authorAngelo Compagnucci <angelo.compagnucci@gmail.com>2017-10-16 19:08:45 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-10-21 21:58:12 +0200
commit80ea21bc3c2147adf810731b0b242e94a3ad294e (patch)
treee7b418b0256268e8539dc71ac933e06ecddcb5c9 /package/go
parente7e71c0124a998893962e5fcc3500206f3b57a59 (diff)
downloadbuildroot-80ea21bc3c2147adf810731b0b242e94a3ad294e.tar.gz
buildroot-80ea21bc3c2147adf810731b0b242e94a3ad294e.zip
package/go: fix cross-compilation settings
This patch fixes a bug with the BR2_TOOLCHAIN_HAS_THREADS variable handling which causes CGO_ENABLED to be always 0. Furthermore, it fixes the cross compilation options for the go compiler: setting CGO_ENABLED should be done only for the target compiler not the host one. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Christian Stewart <christian@paral.in>
Diffstat (limited to 'package/go')
-rw-r--r--package/go/go.mk14
1 files changed, 8 insertions, 6 deletions
diff --git a/package/go/go.mk b/package/go/go.mk
index 0781dff035..6035164a0e 100644
--- a/package/go/go.mk
+++ b/package/go/go.mk
@@ -52,7 +52,7 @@ HOST_GO_TARGET_ENV = \
# 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)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
HOST_GO_CGO_ENABLED = 1
else
HOST_GO_CGO_ENABLED = 0
@@ -74,8 +74,8 @@ HOST_GO_MAKE_ENV = \
GOARCH=$(GO_GOARCH) \
$(if $(GO_GOARM),GOARM=$(GO_GOARM)) \
GOOS=linux \
- CGO_ENABLED=$(HOST_GO_CGO_ENABLED) \
- CC=$(HOSTCC_NOCCACHE)
+ CC=$(HOSTCC_NOCCACHE) \
+ CXX=$(HOSTCXX_NOCCACHE)
HOST_GO_TARGET_CC = \
CC_FOR_TARGET="$(TARGET_CC)" \
@@ -83,16 +83,18 @@ HOST_GO_TARGET_CC = \
HOST_GO_HOST_CC = \
CC_FOR_TARGET=$(HOSTCC_NOCCACHE) \
- CXX_FOR_TARGET=$(HOSTCC_NOCCACHE)
+ CXX_FOR_TARGET=$(HOSTCXX_NOCCACHE)
HOST_GO_TMP = $(@D)/host-go-tmp
define HOST_GO_BUILD_CMDS
- cd $(@D)/src && $(HOST_GO_MAKE_ENV) $(HOST_GO_HOST_CC) ./make.bash
+ cd $(@D)/src && \
+ $(HOST_GO_MAKE_ENV) $(HOST_GO_HOST_CC) CGO_ENABLED=0 ./make.bash
mkdir -p $(HOST_GO_TMP)
mv $(@D)/pkg/tool $(HOST_GO_TMP)/
mv $(@D)/bin/ $(HOST_GO_TMP)/
- cd $(@D)/src && $(HOST_GO_MAKE_ENV) $(HOST_GO_TARGET_CC) ./make.bash
+ cd $(@D)/src && \
+ $(HOST_GO_MAKE_ENV) $(HOST_GO_TARGET_CC) CGO_ENABLED=$(HOST_GO_CGO_ENABLED) ./make.bash
endef
define HOST_GO_INSTALL_CMDS
OpenPOWER on IntegriCloud