Adding a Go package infrastructure
cover Adding a Go package infrastructure
Hi everyone,
I would like to have your feedbacks about this serie of patches which experiments with Go packages.
There are two related issues when packaging Go programs:
1. The Go community have not come up with a prefered way to package Go applications. Here is a quick overview of the situation:
https://github.com/golang/go/wiki/PackageManagementTools
2. Often Go packages have dependencies that are not well expressed with Buildroot packages. For example, the go program github.com/rapidloop/rtop depends on golang.org/x/crypto/ssh but not on golang.org/x/crypto/ssh/terminal.
In this serie of patch, I experiment with gb (http://getgb.io) a tool from Dave Cheney which focuses on reproducable builds.
Dependencies are expressed using a macro (fetch-golang-package) to fetch them consistently. See patches 6 to 8 for examples.
The general idea is the following: GOPATH is set to $(@D) and the dependencies are downloaded into $(@D)/vendor.
You may wonder, why using gb? Well, I found gb easy to use and mature enough for the task. It is an implementation detail which is invisible to golang-package .mk files.
If the direction is correct, i will continue to experiement with mixed package that have Go code and Makefiles.
Patch 1 to 2
Host packages needed to fetch and build Go packages.
Patch 3
Allow custom extraction location.
Patch 4 and 5
Introduce a golang-package infrastructure.
Patch 6 to 8
Examples of golang-packages, just for illustration.
Your feedback is highly appreciated!
Regards,
Ludovic
Ludovic Guegan (8):
package/golang: create Go 1.5 host compiler package package/golang-gb: create gb package to build and fetch go packages package/pkg-generic.mk: allow custom extract directory package/pkg-golang.mk: infrastructure for Go packages docs/manual: documents the golang-package infrastructure package/rtop: add rtop package in Go
package/embd: add embd package (embedded programming framework) package/bolt: add bolt package (persistent key-value store)
docs/manual/adding-packages-generic.txt | 3 + docs/manual/adding-packages-golang.txt | 73 +++++++++++++++ package/Config.in | 3 + package/Config.in.host | 2 + package/Makefile.in | 1 + package/bolt/Config.in | 7 ++ package/bolt/bolt.hash | 1 + package/bolt/bolt.mk | 13 +++ package/embd/Config.in | 8 ++ package/embd/embd.hash | 1 + package/embd/embd.mk | 16 ++++ package/golang-gb/Config.in.host | 8 ++ package/golang-gb/golang-gb.mk | 30 ++++++ package/golang/Config.in.host | 7 ++ package/golang/golang.hash | 2 + package/golang/golang.mk | 72 +++++++++++++++ package/pkg-generic.mk | 12 ++- package/pkg-golang.mk | 156 ++++++++++++++++++++++++++++++++ package/rtop/Config.in | 8 ++ package/rtop/rtop.hash | 1 + package/rtop/rtop.mk | 16 ++++ support/scripts/pkg-stats | 11 +++ 22 files changed, 449 insertions(+), 2 deletions(-) create mode 100644 docs/manual/adding-packages-golang.txt create mode 100644 package/bolt/Config.in create mode 100644 package/bolt/bolt.hash create mode 100644 package/bolt/bolt.mk create mode 100644 package/embd/Config.in create mode 100644 package/embd/embd.hash create mode 100644 package/embd/embd.mk create mode 100644 package/golang-gb/Config.in.host create mode 100644 package/golang-gb/golang-gb.mk create mode 100644 package/golang/Config.in.host create mode 100644 package/golang/golang.hash create mode 100644 package/golang/golang.mk create mode 100644 package/pkg-golang.mk create mode 100644 package/rtop/Config.in create mode 100644 package/rtop/rtop.hash create mode 100644 package/rtop/rtop.mk
Signature · 1 line
2.7.0
RFC PATCH 1/8 package/golang: create Go 1.5 host compiler package
This compiler is bootstraped using a Go 1.4 compiler.
--- package/Config.in.host | 1 + package/golang/Config.in.host | 7 +++++ package/golang/golang.hash | 2 ++ package/golang/golang.mk | 72 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 package/golang/Config.in.host create mode 100644 package/golang/golang.hash create mode 100644 package/golang/golang.mk
package/Config.in.host +1 -0
@@ -12,6 +12,7 @@ menu "Host utilities" source "package/genext2fs/Config.in.host" source "package/genimage/Config.in.host" source "package/genpart/Config.in.host" + source "package/golang/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imx-usb-loader/Config.in.host" source "package/jq/Config.in.host"
package/golang/Config.in.host new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_HOST_GOLANG + bool "golang" + depends on BR2_TOOLCHAIN_HAS_THREADS + help + Go build system. It is used to cros-compile Go programs for the target. + + http://golang.org/
package/golang/golang.hash new file +2 -0
@@ -0,0 +1,2 @@ +sha256 754e06dab1c31ab168fc9db9e32596734015ea9e24bc44cae7f237f417ce4efe go1.5.3.src.tar.gz +sha256 299a6fd8f8adfdce15bc06bde926e7b252ae8e24dd5b16b7d8791ed79e7b5e9b go1.4.2.src.tar.gz
package/golang/golang.mk new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.7.0
RFC PATCH 2/8 package/golang-gb: create gb package to build and fetch go packages
In reply to Ludovic Guegan--- package/Config.in.host | 1 + package/golang-gb/Config.in.host | 8 ++++++++ package/golang-gb/golang-gb.mk | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 package/golang-gb/Config.in.host create mode 100644 package/golang-gb/golang-gb.mk
package/Config.in.host +1 -0
@@ -13,6 +13,7 @@ menu "Host utilities" source "package/genimage/Config.in.host" source "package/genpart/Config.in.host" source "package/golang/Config.in.host" + source "package/golang-gb/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imx-usb-loader/Config.in.host" source "package/jq/Config.in.host"
package/golang-gb/Config.in.host new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_GOLANG_GB + bool "golang-gb" + depends on BR2_PACKAGE_HOST_GOLANG + help + gb is an alternative build tool for the Go programming language. + + https://getgb.io +
package/golang-gb/golang-gb.mk new file +30 -0
@@ -0,0 +1,30 @@ +################################################################################ +# +# golang-gb +# +################################################################################ + +GOLANG_GB_VERSION = 0.4.0 +GOLANG_GB_TAG = v$(GOLANG_GB_VERSION) +GOLANG_GB_SITE = $(call github,constabulary,gb,$(GOLANG_GB_TAG)) +GOLANG_GB_LICENSE = MIT + +GOLANG_GB_ENV = GOPATH=$(@D) + +define HOST_GOLANG_GB_EXTRACT_CMDS + mkdir -p $(@D)/src/github.com/constabulary + tar xvaf $(DL_DIR)/golang-gb-$(GOLANG_GB_VERSION).tar.gz -C $(@D) + mv $(@D)/gb-$(GOLANG_GB_VERSION) $(@D)/src/github.com/constabulary/gb +endef + +define HOST_GOLANG_GB_BUILD_CMDS + env -i $(GOLANG_GB_ENV) $(GO_HOST_BINARY) install -v github.com/constabulary/gb/cmd/gb + env -i $(GOLANG_GB_ENV) $(GO_HOST_BINARY) install -v github.com/constabulary/gb/cmd/gb-vendor +endef + +define HOST_GOLANG_GB_INSTALL_CMDS + $(INSTALL) -m 755 $(@D)/bin/gb $(HOST_DIR)/usr/bin + $(INSTALL) -m 755 $(@D)/bin/gb-vendor $(HOST_DIR)/usr/bin +endef + +$(eval $(host-generic-package))
Signature · 1 line
2.7.0
RFC PATCH 2/8 package/golang-gb: create gb package to build and fetch go packages
Hello,
Quoted 27 lines · Ludovic Guegan
Signed-off-by Ludovic Guegan <[email protected]>--- package/Config.in.host | 1 + package/golang-gb/Config.in.host | 8 ++++++++ package/golang-gb/golang-gb.mk | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 package/golang-gb/Config.in.host create mode 100644 package/golang-gb/golang-gb.mkpackage/Config.in.host +1
-0@@ -13,6 +13,7 @@ menu "Host utilities" source "package/genimage/Config.in.host" source "package/genpart/Config.in.host" source "package/golang/Config.in.host" + source "package/golang-gb/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imx-usb-loader/Config.in.host" source "package/jq/Config.in.host"package/golang-gb/Config.in.host new file +0
-0
package/golang-gb/Config.in.host line 7
Quoted 7 lines
package/golang-gb/Config.in.host new file +7
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_GOLANG_GB + bool "golang-gb" + depends on BR2_PACKAGE_HOST_GOLANG + help + gb is an alternative build tool for the Go programming language. + + https://getgb.io
I'm completely ignorant about Go. Why do we need this alternative build tool? The flannel package contributed by Geoff, and the three packages contributed by Christian don't need this alternative build tool.
What are the benefits of using this as opposed to what Geoff/Christian are doing in their Go packages?
package/golang-gb/Config.in.host
Quoted 4 lines
package/golang-gb/Config.in.host new file +4
-0+define HOST_GOLANG_GB_EXTRACT_CMDS + mkdir -p $(@D)/src/github.com/constabulary + tar xvaf $(DL_DIR)/golang-gb-$(GOLANG_GB_VERSION).tar.gz -C $(@D) + mv $(@D)/gb-$(GOLANG_GB_VERSION) $(@D)/src/github.com/constabulary/gb
It is not clear why you are doing this here.
package/golang-gb/Config.in.host
Quoted 5 lines
package/golang-gb/Config.in.host new file +5
-0+endef + +define HOST_GOLANG_GB_BUILD_CMDS + env -i $(GOLANG_GB_ENV) $(GO_HOST_BINARY) install -v github.com/constabulary/gb/cmd/gb + env -i $(GOLANG_GB_ENV) $(GO_HOST_BINARY) install -v github.com/constabulary/gb/cmd/gb-vendor
Why env -i ?
package/golang-gb/Config.in.host
Quoted 5 lines
package/golang-gb/Config.in.host new file +5
-0+endef + +define HOST_GOLANG_GB_INSTALL_CMDS + $(INSTALL) -m 755 $(@D)/bin/gb $(HOST_DIR)/usr/bin + $(INSTALL) -m 755 $(@D)/bin/gb-vendor $(HOST_DIR)/usr/bin
We normally want:
$(INSTALL) -D -m 0755 $(@D)/bin/gb $(HOST_DIR)/usr/bin/gb
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
RFC PATCH 3/8 package/pkg-generic.mk: allow custom extract directory
In reply to Ludovic Guegan--- docs/manual/adding-packages-generic.txt | 3 +++ package/pkg-generic.mk | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
docs/manual/adding-packages-generic.txt +3 -0
@@ -444,6 +444,9 @@ different steps of the build process. tarball with a non-standard organization, this variable allows to override the package infrastructure default behavior. +* +LIBFOO_EXTRACT_DIR+ can be set to change the directory where the + package is extracted. + * +LIBFOO_CONFIGURE_CMDS+ lists the actions to be performed to configure the package before its compilation.
package/pkg-generic.mk +10 -2
@@ -128,7 +128,7 @@ $(BUILD_DIR)/%/.stamp_extracted: @$(call step_start,extract) @$(call MESSAGE,"Extracting") $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep)) - $(Q)mkdir -p $(@D) + $(Q)mkdir -p $(@D) $($(PKG)_EXTRACT_DIR) $($(PKG)_EXTRACT_CMDS) # some packages have messed up permissions inside $(Q)chmod -R +rw $(@D)
@@ -396,6 +396,14 @@ $(2)_BASE_NAME = $(1)-$$($(2)_VERSION) $(2)_DL_DIR = $$(DL_DIR)/$$($(2)_BASE_NAME) $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASE_NAME) +ifndef $(2)_EXTRACT_DIR + ifdef $(3)_EXTRACT_DIR + $(2)_EXTRACT_DIR = $$($(3)_EXTRACT_DIR) + else + $(2)_EXTRACT_DIR ?= $$($(3)_DIR) + endif +endif + ifndef $(2)_SUBDIR ifdef $(3)_SUBDIR $(2)_SUBDIR = $$($(3)_SUBDIR)
@@ -525,7 +533,7 @@ $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned $(2)_EXTRACT_CMDS ?= \ $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \ $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \ - -C $$($(2)_DIR) \ + -C $$($(2)_EXTRACT_DIR) \ $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \ $$(TAR_OPTIONS) -)
Signature · 1 line
2.7.0
RFC PATCH 3/8 package/pkg-generic.mk: allow custom extract directory
Hello,
Quoted 5 lines · Ludovic Guegan
Signed-off-by Ludovic Guegan <[email protected]>--- docs/manual/adding-packages-generic.txt | 3 +++ package/pkg-generic.mk | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
Do we need to allow a custom extract directory? The problem I see is that with this change, the stamp files are no longer with the package source code, which is a bit annoying.
Geoff and Christian instead create symlink to ensure that the Go package source code appears at the right place in the "Go workspace". I think it's a better approach (at least that's my feeling at the moment, we'll see down the road if it causes problems or not).
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
RFC PATCH 4/8 package/pkg-golang.mk: infrastructure for Go packages
In reply to Ludovic Guegan--- package/Makefile.in | 1 + package/pkg-golang.mk | 156 ++++++++++++++++++++++++++++++++++++++++++++++ support/scripts/pkg-stats | 11 ++++ 3 files changed, 168 insertions(+) create mode 100644 package/pkg-golang.mk
package/Makefile.in +1 -0
@@ -393,6 +393,7 @@ include package/pkg-download.mk include package/pkg-autotools.mk include package/pkg-cmake.mk include package/pkg-luarocks.mk +include package/pkg-golang.mk include package/pkg-perl.mk include package/pkg-python.mk include package/pkg-virtual.mk
package/pkg-golang.mk new file +156 -0
156 lines not on this page · raw message
support/scripts/pkg-stats +11 -0
@@ -112,6 +112,7 @@ for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do $i = "package/pkg-cmake.mk" -o \ $i = "package/pkg-kconfig.mk" -o \ $i = "package/pkg-luarocks.mk" -o \ + $i = "package/pkg-golang.mk" -o \ $i = "package/pkg-perl.mk" -o \ $i = "package/pkg-python.mk" -o \ $i = "package/pkg-rebar.mk" -o \
@@ -145,6 +146,16 @@ for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do hastarget=1 fi + if grep -E "\(host-golang-package\)" $i > /dev/null ; then + infratype="golang" + hashost=1 + fi + + if grep -E "\(golang-package\)" $i > /dev/null ; then + infratype="golang" + hastarget=1 + fi + if grep -E "\(host-luarocks-package\)" $i > /dev/null ; then infratype="luarocks" hashost=1
Signature · 1 line
2.7.0
RFC PATCH 4/8 package/pkg-golang.mk: infrastructure for Go packages
Hello,
Quoted 12 lines · Ludovic Guegan
package/pkg-golang.mk new file +12
-0+ +GO_ENV = PATH=$(BR_PATH) GOPATH=$($PKGDIR) + +# +# If compiling for the target then set GOARCH accordingly. +# + +ifeq ($(4),target) + +ifeq ($(BR2_i386),y) +GOLANG_ARCH = 386 +endif # i386
package/pkg-golang.mk line 43
Quoted 10 lines
package/pkg-golang.mk new file +10
-0+ +ifeq ($(BR2_x86_64),y) +GOLANG_ARCH = amd64 +endif # x86_64 + +ifeq ($(BR2_arm),y) +GOLANG_ARCH = arm +endif # arm + +GO_ENV += GOARCH=$(GOLANG_ARCH)
This should all be rebased on top of the Go support that has been merged, which already exposes some environment variables that can be used to build Go packages.
Quoted 6 lines
package/pkg-golang.mk new file +6
-0+endif # ($(4),target) + +################################################################################ +# +# Go packages are normally fetch using "go get", unfortunatly this method +# fetch the HEAD reference of the package. We use golang-gb in order to
package/pkg-golang.mk line 60
Quoted 10 lines
package/pkg-golang.mk new file +10
-0+# implement reproducible builds. +# +# argument 1 is the package name to fetch as specified in the source code +# argument 2 is the revision reference +################################################################################ + +define fetch-golang-package + cd $($(PKG)_SRCDIR); \ + env -i $(GO_ENV) gb vendor fetch -no-recurse -revision $(2) $(1); +endef
This is not good. Fetching additional stuff within a package is not correct, as it works around the Buildroot download and legal-info mechanisms. If a Go package has a dependency, then a proper Buildroot package should be created for it.
package/pkg-golang.mk line 93
Quoted 12 lines
package/pkg-golang.mk new file +12
-0+# +# Fetch go package if $($(PKG)_DEPS) is defined +# +ifdef $(2)_DEPS + +define $(2)_FETCH_DEPS + mkdir -p $$($$(PKG)_DIR)/{src,vendor} + cd $$($$(PKG)_SRCDIR); env -i $(GO_ENV) gb vendor delete --all + $$($$(PKG)_DEPS) +endef + +$(2)_POST_DOWNLOAD_HOOKS += $(2)_FETCH_DEPS
See my comment above.
package/pkg-golang.mk line 104
Quoted 11 lines
package/pkg-golang.mk new file +11
-0+ +endif # $(2)_DEPS + +# +# Build step. Only define it if not already defined by the package .mk file. +# There is no differences between host and target packages. +# +ifndef $(2)_BUILD_CMDS +define $(2)_BUILD_CMDS + $(foreach p,$$($$(PKG)_BUILD_PACKAGES), cd $$($$(PKG)_SRCDIR); \ + env -i $(GO_ENV) gb build $(p))
We don't use "env -i" anywhere else in Buildroot, so I don't see why you're using it everywhere here.
package/pkg-golang.mk line 115
Quoted 11 lines
package/pkg-golang.mk new file +11
-0+endef +endif + +# +# The variable $(2)_INSTALL_BINARIES list the binaries to install. Go programs +# are named after the last part of their package. If $(2)_INSTALL_BINARIES is +# not define, it is created from $(2)_BUILD_PACKAGES. +# +ifndef $(2)_INSTALL_BINARIES + ifdef $(3)_INSTALL_BINARIES + $(2)_INSTALL_BINARIES = $$($(3)_INSTALL_BINARIES)
So here, if we are a host package, and HOST_<pkg>_INSTALL_BINARIES is not defined, we inherit the value of <pkg>_INSTALL_BINARIES (i.e the value of the target package). Looks good.
Quoted 2 lines
+ else
+ $(2)_INSTALL_BINARIES = $(foreach p, $($(2)_BUILD_PACKAGES), $(lastword $(subst /, ,$(p))))
What if $(2)_BUILD_PACKAGES is empty, but not $(3)_BUILD_PACKAGES? Shouldn't $(2)_BUILD_PACKAGES inherit from $(3)_BUILD_PACKAGES when $(2)_BUILD_PACKAGES is not defined?
package/pkg-golang.mk line 128
Quoted 11 lines
+ endif
package/pkg-golang.mk new file +10
-0+endif + +# +# Host installation step. Only define it if not already defined by the +# package .mk file. +# +ifndef $(2)_INSTALL_CMDS +define $(2)_INSTALL_CMDS + $(foreach p,$$($$(PKG)_INSTALL_BINARIES), \ + $(INSTALL) -m 755 $$($$(PKG)_DIR)/bin/$(p) $(HOST_DIR)/usr/bin)
$(INSTALL) -D -m 0755 <origin> <full destination path>
So Go packages will only ever install programs in $(HOST_DIR)/usr/bin. They never install icons, data files, configuration files, etc. ?
package/pkg-golang.mk line 139
Quoted 11 lines
package/pkg-golang.mk new file +11
-0+endef +endif + +# +# Target installation step. Only define it if not already defined by the +# package .mk file. +# +ifndef $(2)_INSTALL_TARGET_CMDS +define $(2)_INSTALL_TARGET_CMDS + $(foreach p,$$($$(PKG)_INSTALL_BINARIES), \ + $(INSTALL) -m 755 $$($$(PKG)_DIR)/bin/$(p) $(TARGET_DIR)/usr/bin)
Same comments as above.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
RFC PATCH 5/8 docs/manual: documents the golang-package infrastructure
In reply to Ludovic Guegan--- docs/manual/adding-packages-golang.txt | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/manual/adding-packages-golang.txt
docs/manual/adding-packages-golang.txt new file +73 -0
@@ -0,0 +1,73 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +=== Infrastructure for Go packages + +[[golang-package-tutorial]] + +==== +golang-package+ tutorial + +First, let's see how to write a +.mk+ file for a Go package, with an +example : + +------------------------ +01: ################################################################################ +02: # +03: # foo-bar +04: # +05: ################################################################################ +06: +07: FOO_LICENSE = MIT +08: FOO_VERSION = release_1.0 +09: FOO_SITE = $(call github,foo,bar,$(FOO_VERSION)) +10: FOO_EXTRACT_DIR = $(@D)/src/github.com/foo/bar +11: +12: FOO_DEPS += $(call fetch-golang-package, github.com/other/package, \ +13: 1f22c0103821b9390939b6776727195525381532) +14: +16: FOO_BUILD_PACKAGES = github.com/foo/bar/cmd/foo +17: +18: $(eval $(golang-package)) +------------------------ + +On line 7, we declare the license of the package. + +On line 8 and 9, we declare the version and the method to download the +sources. + +On line 10, we declare where to extract the sources. The GOPATH variable is +set to $(@D) when building the package so the Go source files must be placed +accordingly into $(@D)/src. + +On line 11 and 12, we declare the package dependencies to install. All the +package dependencies should be added this way. + +On line 16, we declare the list of packages to build and to install. + +Finally, on line 18, we invoke the +golang-package+ macro that +generates all the Makefile rules that actually allow the package to be +built. + +[[golang-package-reference]] + +==== +golang-package+ reference + +As a policy, each Go package declares all its dependencies using the +fetch-golang-package macro in order to produce reproducible builds. + +The main macro of the golang package infrastructure is +golang-package+. It +is similar to the +generic-package+ macro. The ability to have target and +host packages is also available, with the +host-golang-package+ macro. + +Just like the generic infrastructure, the golang infrastructure works by +defining a number of variables before calling the +golang-package+ macro. + +First, all the package metadata information variables that exist in the +generic infrastructure also exist in the golang infrastructure: ++FOO_FOO_VERSION+, +FOO_FOO_SOURCE+, +FOO_FOO_PATCH+, +FOO_FOO_SITE+, ++FOO_FOO_SUBDIR+, +FOO_FOO_DEPENDENCIES+, +FOO_FOO_INSTALL_TARGET+. + +Note that setting +FOO_INSTALL_STAGING+ to +YES+ has no effect unless a ++FOO_INSTALL_STAGING_CMDS+ variable is defined. The golang infrastructure +doesn't define these commands since Go pakages don't need to be installed to +the +staging+ directory.
Signature · 1 line
2.7.0
RFC PATCH 5/8 docs/manual: documents the golang-package infrastructure
Hello,
Quoted 10 lines · Ludovic Guegan
+01: ################################################################################ +02: #
+03: # foo-bar
+04: #
+05: ################################################################################ +06:
+07:FOO_LICENSE= MIT
+08:FOO_VERSION= release_1.0
+09:FOO_SITE= $(call github,foo,bar,$(FOO_VERSION))
+10:FOO_EXTRACT_DIR= $(@D)/src/github.com/foo/bar
Shouldn't this be just where the symlink should be created in the Go workspace ?
FOO_WORKSPACE_LOCATION or something like that?
Quoted 3 lines
+11:
+12:FOO_DEPS+= $(call fetch-golang-package, github.com/other/package, \
+13:1f22c0103821b9390939b6776727195525381532)
As said in my review of patch 4/8, it is not good when one package fetches another. github.com/other/package should be another package.
Quoted 2 lines
+14:
+16:FOO_BUILD_PACKAGES= github.com/foo/bar/cmd/foo
Couldn't this be expressed in terms of FOO_WORKSPACE_LOCATION, like:
FOO_BUILD_PACKAGES = $(FOO_WORKSPACE_LOCATION)/cmd/foo
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
RFC PATCH 6/8 package/rtop: add rtop package in Go
In reply to Ludovic Guegan--- package/Config.in | 1 + package/rtop/Config.in | 8 ++++++++ package/rtop/rtop.hash | 1 + package/rtop/rtop.mk | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 package/rtop/Config.in create mode 100644 package/rtop/rtop.hash create mode 100644 package/rtop/rtop.mk
package/Config.in +1 -0
@@ -483,6 +483,7 @@ menu "Erlang libraries/modules" endmenu endif source "package/gauche/Config.in" + source "package/rtop/Config.in" source "package/guile/Config.in" source "package/haserl/Config.in" source "package/jamvm/Config.in"
package/rtop/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_RTOP + bool "rtop" + depends on BR2_PACKAGE_HOST_GOLANG + help + rtop is an interactive, remote system monitoring tool based on SSH + + https://github.com/rapidloop/rtop +
package/rtop/rtop.hash new file +1 -0
@@ -0,0 +1 @@ +sha256 44ab02299a204befe49d725bdb76a249db419807e13b7ca451ba14ea5d3de1c2 rtop-release_1.0.tar.gz
package/rtop/rtop.mk new file +16 -0
@@ -0,0 +1,16 @@ +################################################################################ +# +# rtop +# +################################################################################ + +RTOP_LICENSE = MIT +RTOP_VERSION = release_1.0 +RTOP_SITE = $(call github,rapidloop,rtop,$(RTOP_VERSION)) +RTOP_EXTRACT_DIR = $(@D)/src/github.com/rapidloop/rtop +RTOP_BUILD_PACKAGES = github.com/rapidloop/rtop + +RTOP_DEPS += $(call fetch-golang-package, golang.org/x/crypto/curve25519, 1f22c0103821b9390939b6776727195525381532) +RTOP_DEPS += $(call fetch-golang-package, golang.org/x/crypto/ssh, 1f22c0103821b9390939b6776727195525381532) + +$(eval $(golang-package))
Signature · 1 line
2.7.0
RFC PATCH 7/8 package/embd: add embd package (embedded programming framework)
In reply to Ludovic Guegan--- package/Config.in | 1 + package/embd/Config.in | 8 ++++++++ package/embd/embd.hash | 1 + package/embd/embd.mk | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 package/embd/Config.in create mode 100644 package/embd/embd.hash create mode 100644 package/embd/embd.mk
package/Config.in +1 -0
@@ -1152,6 +1152,7 @@ menu "Other" source "package/ding-libs/Config.in" source "package/eigen/Config.in" source "package/elfutils/Config.in" + source "package/embd/Config.in" source "package/fftw/Config.in" source "package/flann/Config.in" source "package/gflags/Config.in"
package/embd/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_EMBD + bool "embd" + depends on BR2_PACKAGE_HOST_GOLANG + help + Golang Embedded Programming Framework + + http://embd.io +
package/embd/embd.hash new file +1 -0
@@ -0,0 +1 @@ +sha256 b3a7885855920fc915ee7075996bd064be20e95381dbe9cf5aa1f82b133dbf82 embd-bfcd1345fe4e3d17ca82475c0c2f3d53120f87a9.tar.gz
package/embd/embd.mk new file +16 -0
@@ -0,0 +1,16 @@ +################################################################################ +# +# embd +# +################################################################################ + +EMBD_LICENSE = MIT +EMBD_VERSION = bfcd1345fe4e3d17ca82475c0c2f3d53120f87a9 +EMBD_SITE = $(call github,kidoman,embd,$(EMBD_VERSION)) +EMBD_EXTRACT_DIR = $(@D)/src/github.com/kidoman/embd +EMBD_BUILD_PACKAGES = github.com/kidoman/embd/embd + +EMBD_DEPS += $(call fetch-golang-package, github.com/codegangsta/cli, cf1f63a7274872768d4037305d572b70b1199397) +EMBD_DEPS += $(call fetch-golang-package, github.com/golang/glog, 23def4e6c14b4da8ac2ed8007337bc5eb5007998) + +$(eval $(golang-package))
Signature · 1 line
2.7.0
RFC PATCH 8/8 package/bolt: add bolt package (persistent key-value store)
In reply to Ludovic Guegan--- package/Config.in | 1 + package/bolt/Config.in | 7 +++++++ package/bolt/bolt.hash | 1 + package/bolt/bolt.mk | 13 +++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 package/bolt/Config.in create mode 100644 package/bolt/bolt.hash create mode 100644 package/bolt/bolt.mk
package/Config.in +1 -0
@@ -815,6 +815,7 @@ endmenu menu "Database" source "package/berkeleydb/Config.in" + source "package/bolt/Config.in" source "package/cppdb/Config.in" source "package/gdbm/Config.in" source "package/kompexsqlite/Config.in"
package/bolt/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_BOLT + bool "bolt" + depends on BR2_PACKAGE_HOST_GOLANG + help + An embedded key/value database for Go. + + https://github.com/boltdb/bolt
package/bolt/bolt.hash new file +1 -0
@@ -0,0 +1 @@ +sha256 f426e649dd7c0838efe7bedff1010dfd047d0f354b264af6a030440543c42bd1 bolt-v1.1.0.tar.gz
package/bolt/bolt.mk new file +13 -0
@@ -0,0 +1,13 @@ +################################################################################ +# +# bolt +# +################################################################################ + +BOLT_LICENSE = MIT +BOLT_VERSION = v1.1.0 +BOLT_SITE = $(call github,boltdb,bolt,$(BOLT_VERSION)) +BOLT_EXTRACT_DIR = $(@D)/src/github.com/boltdb/bolt +BOLT_BUILD_PACKAGES = github.com/boltdb/bolt/cmd/bolt + +$(eval $(golang-package))
Signature · 1 line
2.7.0
cover Adding a Go package infrastructure
In reply to Ludovic GueganHello Ludovic,
Quoted 9 lines · Ludovic Guegan
Ludovic Guegan (8):
package/golang: create Go 1.5 host compiler package package/golang-gb: create gb package to build and fetch go packagespackage/pkg-generic.mk: allow custom extract directorypackage/pkg-golang.mk: infrastructure for Go packages docs/manual: documents the golang-package infrastructure package/rtop: add rtop package in Go
package/embd: add embd package (embedded programming framework) package/bolt: add bolt package (persistent key-value store)
Sorry for the slow feedback on this. We now have Go support in Buildroot. For the moment, we only have one package in the tree (flannel), but Christian Stewart has already submitted three more. And indeed, the build procedure for each of them look very similar, so a package infrastructure might very well be useful.
Would you be interested in respining your patch series against the latest master, so that we can move forward with this topic?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com