Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/4] Add go host support
Date: Wed, 2 Mar 2016 23:50:12 +0100	[thread overview]
Message-ID: <20160302235012.419a6ec2@free-electrons.com> (raw)
In-Reply-To: <518d5cfb3bd5897ea408888e6c105388fccff5c2.1456946494.git.geoff@infradead.org>

Geoff,

On Wed, 02 Mar 2016 19:23:33 +0000, Geoff Levand wrote:
> Add a new package 'go' which builds the host cross compiler and libraries for the
> go programming language.
> 
> Signed-off-by: Geoff Levand <geoff@infradead.org>

Like the previous commit, the title should be:

	go: new host package

> diff --git a/package/Config.in.host b/package/Config.in.host
> index 7cacef9..158fbca 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -13,6 +13,7 @@ menu "Host utilities"
>  	source "package/genext2fs/Config.in.host"
>  	source "package/genimage/Config.in.host"
>  	source "package/genpart/Config.in.host"
> +	source "package/go/Config.in.host"
>  	source "package/go-bootstrap/Config.in.host"
>  	source "package/gptfdisk/Config.in.host"
>  	source "package/imx-usb-loader/Config.in.host"
> diff --git a/package/go/Config.in.host b/package/go/Config.in.host
> new file mode 100644
> index 0000000..928944b
> --- /dev/null
> +++ b/package/go/Config.in.host
> @@ -0,0 +1,14 @@
> +config BR2_PACKAGE_GO_ARCH_SUPPORTS
> +	bool
> +	default y
> +	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64 || BR2_powerpc
> +	depends on !BR2_ARM_CPU_ARMV4
> +
> +config BR2_PACKAGE_HOST_GO
> +	bool "host go"
> +	depends on BR2_PACKAGE_GO_ARCH_SUPPORTS
> +	select BR2_PACKAGE_HOST_GO_BOOTSTRAP

Due to the removal of Config.in.host for the go-bootstrap package, this
line has become useless.

> +	help
> +	  The Go Programming Language.
> +
> +	  https://golang.org

We normally don't have Config.in for host packages, as they are just
build dependencies. In this case, we could also decide to not have any
package/go/Config.in.host, and simply have the flannel package use
"host-go" in its <pkg>_DEPENDENCIES variable.

However, we may consider that some users may want to build the host Go
compiler even if they don't have a package that uses it, so maybe it's
acceptable.

I'm still a bit bothered by the fact that a Config.in option describing
a *host* package depends on BR2_PACKAGE_GO_ARCH_SUPPORTS. But I guess
it's fine since the Go compiler is really going to be a cross-compiler.

> diff --git a/package/go/go.mk b/package/go/go.mk
> new file mode 100644
> index 0000000..95168a7
> --- /dev/null
> +++ b/package/go/go.mk
> @@ -0,0 +1,73 @@
> +################################################################################
> +#
> +# golang
> +#
> +################################################################################
> +
> +GO_VERSION = 1.5.3
> +GO_SITE = https://storage.googleapis.com/golang
> +GO_SOURCE = go$(GO_VERSION).src.tar.gz
> +
> +GO_LICENSE = BSD-3c
> +GO_LICENSE_FILES = LICENSE
> +
> +GO_BOOTSTRAP = $(HOST_DIR)/usr/lib/go-1.4.2

Why don't you use $(GO_BOOTSTRAP_FINAL) instead ?

> +
> +ifeq ($(BR2_arm),y)
> +	GO_GOARCH = arm

Please don't indent such variable definitions.

> +else ifeq ($(BR2_aarch64),y)
> +	GO_GOARCH = arm64
> +else ifeq ($(BR2_i386),y)
> +	GO_GOARCH = 386
> +else ifeq ($(BR2_x86_64),y)
> +	GO_GOARCH = amd64
> +else ifeq ($(BR2_powerpc),y)
> +	GO_GOARCH = ppc64
> +else
> +	GO_GOARCH = unknown
> +endif
> +
> +ifeq ($(BR2_arm)$(BR2_ARM_CPU_HAS_VFPV3),yy)
> +	GO_GOARM = 7
> +else ifeq ($(BR2_arm)$(BR2_ARM_CPU_HAS_VFPV2),yy)
> +	GO_GOARM = 6
> +else ifeq ($(BR2_arm),y)
> +	GO_GOARM = 5
> +endif

You should use BR2_ARM_CPU_ARMV5, BR2_ARM_CPU_ARMV6 and
BR2_ARM_CPU_ARMV7 here.

> GO_HOST_DEPENDENCIES = host-go-bootstrap

Wrong variable name, it should be HOST_GO_DEPENDENCIES.

> GO_HOST_FINAL = $(HOST_DIR)/usr/lib/go

Ditto: HOST_GO_<...>

> GO_HOST_MAKE_ENV = \

Same.

> +define HOST_GO_INSTALL_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/bin/go $(GO_HOST_FINAL)/bin/go
> +	$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(GO_HOST_FINAL)/bin/gofmt
> +
> +	ln -sf ../lib/go/bin/go $(HOST_DIR)/usr/bin/
> +	ln -sf ../lib/go/bin/gofmt $(HOST_DIR)/usr/bin/
> +
> +	cp -a $(@D)/lib $(GO_HOST_FINAL)/
> +	cp -a $(@D)/src $(GO_HOST_FINAL)/

Same question: why do we install source code ?

> +
> +	mkdir -p $(GO_HOST_FINAL)/pkg
> +	cp -a $(@D)/pkg/include $(@D)/pkg/linux_* $(GO_HOST_FINAL)/pkg/
> +	cp -a $(@D)/pkg/tool $(GO_HOST_FINAL)/pkg/
> +	chmod -R +x $(GO_HOST_FINAL)/pkg/tool

Same question :-)

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2016-03-02 22:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 19:23 [Buildroot] [PATCH 0/4] Add go language support Geoff Levand
2016-03-02 19:23 ` [Buildroot] [PATCH 3/4] Add go target support Geoff Levand
2016-03-02 22:51   ` Thomas Petazzoni
2016-03-03  1:11     ` Geoff Levand
2016-03-02 19:23 ` [Buildroot] [PATCH 1/4] Add package go-bootstrap Geoff Levand
2016-03-02 22:43   ` Thomas Petazzoni
2016-03-03  1:11     ` Geoff Levand
2016-03-03  8:15       ` Thomas Petazzoni
2016-03-02 19:23 ` [Buildroot] [PATCH 4/4] Add package flannel Geoff Levand
2016-03-02 22:53   ` Thomas Petazzoni
2016-03-03  1:11     ` Geoff Levand
2016-03-02 19:23 ` [Buildroot] [PATCH 2/4] Add go host support Geoff Levand
2016-03-02 22:50   ` Thomas Petazzoni [this message]
2016-03-03  1:11     ` Geoff Levand
2016-03-02 20:49 ` [Buildroot] [PATCH 0/4] Add go language support Thomas Petazzoni
2016-03-02 21:47   ` Geoff Levand
2016-03-02 21:52     ` Christian Stewart
2016-03-02 22:31       ` Geoff Levand
2016-03-02 22:40         ` Christian Stewart
2016-03-21 16:32           ` Geoff Levand
2016-03-22 18:09             ` Christian Stewart
2016-03-02 22:18     ` Thomas Petazzoni
2016-03-02 22:43       ` Geoff Levand
2016-03-02 22:54         ` Thomas Petazzoni
2016-03-03  1:09           ` Geoff Levand

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=20160302235012.419a6ec2@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox