All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure
@ 2018-03-31 13:27 Thomas Petazzoni
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR) Thomas Petazzoni
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

Hello,

This v4 is a new iteration of the work done by Angelo Compagnucci to
introduce a golang package infrastructure. Note that in its v3 of the
series, Angelo had a PATCH 7/7 that was adding 'mender' as a new
package, but this specific patch is not part of this series.

Changes since v3:

 - Removed the "unexport GOBIN" and instead pass an empty GOBIN in
   <foo>_GO_ENV.

 - Renamed <foo>_GOPATH to <foo>_WORKSPACE, because the variable
   didn't contain a path, but just a sub-directory, and this
   sub-directory in the Go terminology is called the "workspace"

 - Rename <foo>_GO_LDFLAGS and <foo>_GO_TAGS to just <foo>_LDFLAGS and
   <foo>_TAGS.

 - Generally speaking the _GO_ component of the variables has been
   removed, to be more consistent with what other infrastructures
   do. It has been kept for <foo>_GO_ENV because it is really what we
   pass in the environment when calling "go".

 - Rename <foo>_GO_SRC_PATH to <foo>_SRC_SUBDIR, because it's actually
   a sub-directory and not a path. Also, the way it's calculated has
   been changed to use the second component of the URL instead of the
   package name, as it matches more often with the value that is
   needed. In addition, to make its definition clearer, some
   intermediate variable were introduced: <foo>_SRC_DOMAIN,
   <foo>_SRC_VENDOR and <foo>_SRC_SOFTWARE.

 - Introduce <foo>_BUILD_TARGETS as a list of targets to be built,
   which allows to support packages that need to build several
   targets.

 - Introduce <foo>_INSTALL_BINS as a list of binaries to be installed,
   which allows to support packages that need to install several
   binaries.

 - All packages and the documentation were adjusted according to the
   changes made to the infrastructure.

 - The docker-proxy package was converted to the golang package
   infrastructure (this package didn't exist back when Angelo sent his
   v3).

 - An initial preparation patch cleaning up some useless step in the
   docker-containerd package was introduced. Details in the commit
   log.

Thanks!

Thomas

Angelo Compagnucci (6):
  package/pkg-golang: new package infrastructure
  docs/manual: add documentation for the golang infrastructure
  package/flannel: convert to golang infrastructure
  package/runc: convert to golang infrastructure
  package/docker-containerd: convert to golang infrastructure
  package/docker-engine: convert to golang infrastructure

Thomas Petazzoni (2):
  docker-containerd: remove symlink to $(RUNC_SRCDIR)
  package/docker-proxy: convert to golang infrastructure

 docs/manual/adding-packages-golang.txt         | 110 ++++++++++++++++++++
 docs/manual/adding-packages.txt                |   2 +
 package/Makefile.in                            |   1 +
 package/docker-containerd/docker-containerd.mk |  35 ++-----
 package/docker-engine/docker-engine.mk         |  67 ++++--------
 package/docker-proxy/docker-proxy.mk           |  31 +-----
 package/flannel/flannel.mk                     |  32 +-----
 package/pkg-golang.mk                          | 136 +++++++++++++++++++++++++
 package/runc/runc.mk                           |  37 +------
 9 files changed, 287 insertions(+), 164 deletions(-)
 create mode 100644 docs/manual/adding-packages-golang.txt
 create mode 100644 package/pkg-golang.mk

-- 
2.14.3

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR)
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 13:34   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure Thomas Petazzoni
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

The DOCKER_CONTAINERD_CONFIGURE_CMDS creates a symlink to runc's
source directory, but it does not build depend on runc, which means
that the runc package may not have been extracted/built before
docker-containerd.

Therefore, when doing a build with "make docker-containerd", this
symbolic link is broken, but it doesn't prevent docker-containerd from
building.

Therefore, this symlink is not necessary and be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/docker-containerd/docker-containerd.mk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
index ffbadb0c3f..8f0822b77f 100644
--- a/package/docker-containerd/docker-containerd.mk
+++ b/package/docker-containerd/docker-containerd.mk
@@ -27,8 +27,6 @@ endif
 define DOCKER_CONTAINERD_CONFIGURE_CMDS
 	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
 	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
-	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers
-	ln -s $(RUNC_SRCDIR) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc
 endef
 
 define DOCKER_CONTAINERD_BUILD_CMDS
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR) Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 14:17   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure Thomas Petazzoni
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

This patch adds a new infrastructure for golang based packages.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/Makefile.in   |   1 +
 package/pkg-golang.mk | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+)
 create mode 100644 package/pkg-golang.mk

diff --git a/package/Makefile.in b/package/Makefile.in
index 0af79dfb63..be7a48f647 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -452,3 +452,4 @@ include package/pkg-kconfig.mk
 include package/pkg-rebar.mk
 include package/pkg-kernel-module.mk
 include package/pkg-waf.mk
+include package/pkg-golang.mk
diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
new file mode 100644
index 0000000000..a11e7e9e3f
--- /dev/null
+++ b/package/pkg-golang.mk
@@ -0,0 +1,136 @@
+################################################################################
+# Golang package infrastructure
+#
+# This file implements an infrastructure that eases development of
+# package .mk files for Go packages. It should be used for all
+# packages that are written in go.
+#
+# See the Buildroot documentation for details on the usage of this
+# infrastructure
+#
+#
+# In terms of implementation, this golang infrastructure requires
+# the .mk file to only specify metadata information about the
+# package: name, version, download URL, etc.
+#
+# We still allow the package .mk file to override what the different
+# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
+# already defined, it is used as the list of commands to perform to
+# build the package, instead of the default golang behavior. The
+# package can also define some post operation hooks.
+#
+################################################################################
+
+GO_BIN = $(HOST_DIR)/bin/go
+
+################################################################################
+# inner-golang-package -- defines how the configuration, compilation and
+# installation of a Go package should be done, implements a few hooks to
+# tune the build process for Go specificities and calls the generic package
+# infrastructure to generate the necessary make targets
+#
+#  argument 1 is the lowercase package name
+#  argument 2 is the uppercase package name, including a HOST_ prefix
+#             for host packages
+#  argument 3 is the uppercase package name, without the HOST_ prefix
+#             for host packages
+#  argument 4 is the type (target or host)
+################################################################################
+
+define inner-golang-package
+
+$(2)_WORKSPACE ?= _gopath
+
+# We pass an empty GOBIN, otherwise "go install: cannot install
+# cross-compiled binaries when GOBIN is set"
+$(2)_GO_ENV ?= $$(HOST_GO_TARGET_ENV) \
+	GOPATH="$$(@D)/$$($(2)_WORKSPACE)" \
+	GOBIN= \
+	CGO_ENABLED=$$(HOST_GO_CGO_ENABLED)
+
+ifeq ($(BR2_STATIC_LIBS),y)
+$(2)_LDFLAGS += -extldflags '-static'
+endif
+
+$(2)_BUILD_OPTS += -ldflags "$$($(2)_LDFLAGS)"
+$(2)_BUILD_OPTS += -tags "$$($(2)_TAGS)"
+
+# Target packages need the Go compiler on the host.
+$(2)_DEPENDENCIES += host-go
+
+$(2)_BUILD_TARGETS ?= .
+
+$(2)_INSTALL_BINS ?= $(1)
+
+#
+# The go build/install command installs the binaries inside
+# gopath/bin/linux_GOARCH/ when cross compilation is enabled. We set
+# this variable here to be used by packages if needed.
+#
+$(2)_BINDIR = $$($(2)_WORKSPACE)/bin/linux_$$(GO_GOARCH)
+
+#
+# Source files in Go should be uncompressed in a precise folder in the
+# hierarchy of GOPATH. It usually resolves around
+# domain/vendor/software. By default, we derive domain/vendor/software
+# from the upstream URL of the project, but we allow $(2)_SRC_SUBDIR
+# to be overridden if needed.
+#
+$(2)_SRC_DOMAIN = $$(call domain,$($(2)_SITE))
+$(2)_SRC_VENDOR = $$(word 1,$$(subst /, ,$$(call notdomain,$($(2)_SITE))))
+$(2)_SRC_SOFTWARE = $$(word 2,$$(subst /, ,$$(call notdomain,$($(2)_SITE))))
+
+$(2)_SRC_SUBDIR ?= $$($(2)_SRC_DOMAIN)/$$($(2)_SRC_VENDOR)/$$($(2)_SRC_SOFTWARE)
+$(2)_SRC_PATH = $$(@D)/$$($(2)_WORKSPACE)/src/$$($(2)_SRC_SUBDIR)
+
+#
+# Configure step. Only define it if not already defined by the package
+# .mk file.
+#
+ifndef $(2)_CONFIGURE_CMDS
+define $(2)_CONFIGURE_CMDS
+	mkdir -p $$(@D)/$$($(2)_WORKSPACE)/bin
+	mkdir -p $$(dir $$($(2)_SRC_PATH))
+	ln -sf $$(@D) $$($(2)_SRC_PATH)
+endef
+endif
+
+#
+# Build step. Only define it if not already defined by the package .mk
+# file. We use the install command instead of build command here
+# because the install command also moves the package binaries in
+# <workspace>/bin/linux_GOARCH/. Using the install command also
+# leverages the go build infrastructure for building and installing
+# multiple binaries.
+#
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+	$$(foreach d,$$($(2)_BUILD_TARGETS),\
+		cd $$($(2)_SRC_PATH) && $$($(2)_GO_ENV) $$(GO_BIN) install -v $$($(2)_BUILD_OPTS) ./$$(d)
+	)
+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 d,$$($(2)_INSTALL_BINS),\
+		$(INSTALL) -D -m 0755 $$(@D)/$$($(2)_BINDIR)/$$(d) $(TARGET_DIR)/usr/bin/$$(d)
+	)
+endef
+endif
+
+# Call the generic package infrastructure to generate the necessary
+# make targets
+$(call inner-generic-package,$(1),$(2),$(3),$(4))
+
+endef # inner-golang-package
+
+################################################################################
+# golang-package -- the target generator macro for Go packages
+################################################################################
+
+golang-package = $(call inner-golang-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR) Thomas Petazzoni
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 14:28   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 4/8] package/flannel: convert to " Thomas Petazzoni
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

This patch adds the documentation for the golang infrastructure.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 docs/manual/adding-packages-golang.txt | 110 +++++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt        |   2 +
 2 files changed, 112 insertions(+)
 create mode 100644 docs/manual/adding-packages-golang.txt

diff --git a/docs/manual/adding-packages-golang.txt b/docs/manual/adding-packages-golang.txt
new file mode 100644
index 0000000000..418da5fa4f
--- /dev/null
+++ b/docs/manual/adding-packages-golang.txt
@@ -0,0 +1,110 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+=== Infrastructure for Go packages
+
+This infrastructure applies to Go packages that use the standard
+build system and use bundled dependencies.
+
+[[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
+04: #
+05: ################################################################################
+06:
+07: FOO_VERSION = 1.0
+08: FOO_SITE = $(call github,bar,foo,$(FOO_VERSION))
+09: FOO_LICENSE = BSD-3-Clause
+10: FOO_LICENSE_FILES = LICENSE
+11:
+12: $(eval $(golang-package))
+------------------------
+
+On line 7, we declare the version of the package.
+
+On line 8, we declare the upstream location of the package, here
+fetched from Github, since a large number of Go packages are hosted on
+Github.
+
+On line 9 and 10, we give licensing details about the package.
+
+Finally, on line 12, 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
+
+In their +Config.in+ file, packages using the +golang-package+
+infrastructure should depend on +BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS+
+and +BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS+ because Buildroot will
+automatically add a dependency on +host-go+ to such packages.
+
+The main macro of the Go package infrastructure is
++golang-package+. It is similar to the +generic-package+ macro. Only
+target packages are supported with +golang-package+.
+
+Just like the generic infrastructure, the Go infrastructure works
+by defining a number of variables before calling the +golang-package+.
+
+All the package metadata information variables that exist in the
+xref:generic-package-reference[generic package infrastructure] also
+exist in the Go infrastructure: +FOO_VERSION+, +FOO_SOURCE+,
++FOO_PATCH+, +FOO_SITE+, +FOO_SUBDIR+, +FOO_DEPENDENCIES+,
++FOO_LICENSE+, +FOO_LICENSE_FILES+, +FOO_INSTALL_STAGING+, etc.
+
+Note that:
+
+ * It is not necessary to add +go+ or +host-go+ in the
+   +FOO_DEPENDENCIES+ variable of a package, since these basic
+   dependencies are automatically added as needed by the Go package
+   infrastructure.
+
+A few additional variables, specific to the Go infrastructure, can
+optionally be defined, depending on the package's needs. Many of them
+are only useful in very specific cases, typical packages will
+therefore only use a few of them, or none.
+
+* If your package need a custom +GOPATH+ to be compiled in, you can
+  use the +FOO_WORKSPACE+ variable. The +GOPATH+ being used will be
+  +<package-srcdir>/<FOO_WORKSPACE>+. If +FOO_WORKSPACE+ is not
+  specified, it defaults to +_gopath+.
+
+* +FOO_SRC_SUBDIR+ is the sub-directory where your source will be
+  compiled relatively to the +GOPATH+. An example value is
+  +github.com/bar/foo+. If +FOO_SRC_SUBDIR+ is not specified, it
+  defaults to a value infered from the +FOO_SITE+ variable.
+
+* +FOO_LDFLAGS+ and +FOO_TAGS+ can be used to pass respectively the
+  +LDFLAGS+ or the +TAGS+ to the +go+ build command.
+
+* +FOO_BUILD_TARGETS+ can be used to pass the list of targets that
+  should be built. If +FOO_BUILD_TARGETS+ is not specified, it
+  defaults to +.+.
+
+* +FOO_INSTALL_BINS+ can be used to pass the list of binaries that
+  should be installed +/usr/bin+ on the target. If +FOO_INSTALL_BINS+
+  is not specified, it defaults to the lower-case name of package.
+
+With the Go infrastructure, all the steps required to build and
+install the packages are already defined, and they generally work well
+for most Go-based packages. However, when required, it is still
+possible to customize what is done in any particular step:
+
+* By adding a post-operation hook (after extract, patch, configure,
+  build or install). See xref:hooks[] for details.
+
+* By overriding one of the steps. For example, even if the Go
+  infrastructure is used, if the package +.mk+ file defines its own
+  +FOO_BUILD_CMDS+ variable, it will be used instead of the default Go
+  one. However, using this method should be restricted to very
+  specific cases. Do not use it in the general case.
diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
index e8d40daee4..c642146287 100644
--- a/docs/manual/adding-packages.txt
+++ b/docs/manual/adding-packages.txt
@@ -38,6 +38,8 @@ include::adding-packages-meson.txt[]
 
 include::adding-packages-cargo.txt[]
 
+include::adding-packages-golang.txt[]
+
 include::adding-packages-kernel-module.txt[]
 
 include::adding-packages-asciidoc.txt[]
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 4/8] package/flannel: convert to golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 14:55   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 5/8] package/runc: " Thomas Petazzoni
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/flannel/flannel.mk | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/package/flannel/flannel.mk b/package/flannel/flannel.mk
index bbb2c72a72..07d5d0dfd6 100644
--- a/package/flannel/flannel.mk
+++ b/package/flannel/flannel.mk
@@ -11,36 +11,12 @@ FLANNEL_SOURCE = $(FLANNEL_VERSION).tar.gz
 FLANNEL_LICENSE = Apache-2.0
 FLANNEL_LICENSE_FILES = LICENSE
 
-FLANNEL_DEPENDENCIES = host-go
-
-FLANNEL_MAKE_ENV = \
-	$(HOST_GO_TARGET_ENV) \
-	GOBIN="$(@D)/bin" \
-	GOPATH="$(@D)/gopath" \
-	CGO_ENABLED=1
-
-FLANNEL_GLDFLAGS = \
-	-X github.com/coreos/flannel/version.Version=$(FLANNEL_VERSION)
-
-ifeq ($(BR2_STATIC_LIBS),y)
-FLANNEL_GLDFLAGS += -extldflags '-static'
-endif
-
-define FLANNEL_CONFIGURE_CMDS
-	# Put sources at prescribed GOPATH location.
-	mkdir -p $(@D)/gopath/src/github.com/coreos
-	ln -s $(@D) $(@D)/gopath/src/github.com/coreos/flannel
-endef
-
-define FLANNEL_BUILD_CMDS
-	cd $(@D) && $(FLANNEL_MAKE_ENV) $(HOST_DIR)/bin/go \
-		build -v -o $(@D)/bin/flanneld -ldflags "$(FLANNEL_GLDFLAGS)" .
-endef
+FLANNEL_LDFLAGS = -X github.com/coreos/flannel/version.Version=$(FLANNEL_VERSION)
 
+# Install flannel to its well known location.
 define FLANNEL_INSTALL_TARGET_CMDS
-	# Install flannel to its well known location.
-	$(INSTALL) -D -m 0755 $(@D)/bin/flanneld $(TARGET_DIR)/opt/bin/flanneld
+	$(INSTALL) -D -m 0755 $(@D)/$(FLANNEL_BINDIR)/flannel $(TARGET_DIR)/opt/bin/flanneld
 	$(INSTALL) -D -m 0755 $(@D)/dist/mk-docker-opts.sh $(TARGET_DIR)/opt/bin/mk-docker-opts.sh
 endef
 
-$(eval $(generic-package))
+$(eval $(golang-package))
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 5/8] package/runc: convert to golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 4/8] package/flannel: convert to " Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 14:56   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 6/8] package/docker-containerd: " Thomas Petazzoni
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/runc/runc.mk | 37 +++++--------------------------------
 1 file changed, 5 insertions(+), 32 deletions(-)

diff --git a/package/runc/runc.mk b/package/runc/runc.mk
index fb3fec20f5..f1586f32b2 100644
--- a/package/runc/runc.mk
+++ b/package/runc/runc.mk
@@ -9,42 +9,15 @@ RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION))
 RUNC_LICENSE = Apache-2.0
 RUNC_LICENSE_FILES = LICENSE
 
-RUNC_DEPENDENCIES = host-go
+RUNC_WORKSPACE = Godeps/_workspace
 
-RUNC_GOPATH = "$(@D)/Godeps/_workspace"
-RUNC_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
-	CGO_ENABLED=1 \
-	GOBIN="$(@D)/bin" \
-	GOPATH="$(RUNC_GOPATH)" \
-	PATH=$(BR_PATH)
+RUNC_LDFLAGS = -X main.gitCommit=$(RUNC_VERSION)
 
-RUNC_GLDFLAGS = \
-	-X main.gitCommit=$(RUNC_VERSION)
-
-ifeq ($(BR2_STATIC_LIBS),y)
-RUNC_GLDFLAGS += -extldflags '-static'
-endif
-
-RUNC_GOTAGS = cgo static_build
+RUNC_TAGS = cgo static_build
 
 ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
-RUNC_GOTAGS += seccomp
+RUNC_TAGS += seccomp
 RUNC_DEPENDENCIES += libseccomp host-pkgconf
 endif
 
-define RUNC_CONFIGURE_CMDS
-	mkdir -p $(RUNC_GOPATH)/src/github.com/opencontainers
-	ln -s $(@D) $(RUNC_GOPATH)/src/github.com/opencontainers/runc
-endef
-
-define RUNC_BUILD_CMDS
-	cd $(@D) && $(RUNC_MAKE_ENV) $(HOST_DIR)/bin/go \
-		build -v -o $(@D)/bin/runc \
-		-tags "$(RUNC_GOTAGS)" -ldflags "$(RUNC_GLDFLAGS)" .
-endef
-
-define RUNC_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/bin/runc $(TARGET_DIR)/usr/bin/runc
-endef
-
-$(eval $(generic-package))
+$(eval $(golang-package))
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 6/8] package/docker-containerd: convert to golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 5/8] package/runc: " Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 14:59   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 7/8] package/docker-engine: " Thomas Petazzoni
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/docker-containerd/docker-containerd.mk | 33 +++++++-------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
index 8f0822b77f..88e27b5ed4 100644
--- a/package/docker-containerd/docker-containerd.mk
+++ b/package/docker-containerd/docker-containerd.mk
@@ -9,37 +9,20 @@ DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VER
 DOCKER_CONTAINERD_LICENSE = Apache-2.0
 DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
 
-DOCKER_CONTAINERD_DEPENDENCIES = host-go
+DOCKER_CONTAINERD_WORKSPACE = vendor
 
-DOCKER_CONTAINERD_GOPATH = "$(@D)/vendor"
-DOCKER_CONTAINERD_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
-	CGO_ENABLED=1 \
-	GOBIN="$(@D)/bin" \
-	GOPATH="$(DOCKER_CONTAINERD_GOPATH)"
-
-DOCKER_CONTAINERD_GLDFLAGS = \
+DOCKER_CONTAINERD_LDFLAGS = \
 	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION)
 
-ifeq ($(BR2_STATIC_LIBS),y)
-DOCKER_CONTAINERD_GLDFLAGS += -extldflags '-static'
-endif
+DOCKER_CONTAINERD_BUILD_TARGETS = ctr containerd containerd-shim
 
-define DOCKER_CONTAINERD_CONFIGURE_CMDS
-	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
-	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
-endef
+DOCKER_CONTAINERD_INSTALL_BINS = containerd containerd-shim
 
-define DOCKER_CONTAINERD_BUILD_CMDS
-	$(foreach d,ctr containerd containerd-shim,\
-		cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/bin/go build \
-			-v -o $(@D)/bin/$(d) -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./$(d)$(sep))
-endef
-
-define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
+define DOCKER_CONTAINERD_INSTALL_SYMLINKS
 	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
-	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
-	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
 	ln -fs containerd-shim $(TARGET_DIR)/usr/bin/docker-containerd-shim
 endef
 
-$(eval $(generic-package))
+DOCKER_CONTAINERD_POST_INSTALL_TARGET_HOOKS += DOCKER_CONTAINERD_INSTALL_SYMLINKS
+
+$(eval $(golang-package))
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 7/8] package/docker-engine: convert to golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 6/8] package/docker-containerd: " Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 15:04   ` Yann E. MORIN
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 8/8] package/docker-proxy: " Thomas Petazzoni
  2018-03-31 18:00 ` [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Arnout Vandecappelle
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

From: Angelo Compagnucci <angelo@amarulasolutions.com>

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/docker-engine/docker-engine.mk | 67 +++++++++-------------------------
 1 file changed, 17 insertions(+), 50 deletions(-)

diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
index 8928f072e7..feb47d4994 100644
--- a/package/docker-engine/docker-engine.mk
+++ b/package/docker-engine/docker-engine.mk
@@ -13,70 +13,53 @@ DOCKER_ENGINE_LICENSE_FILES = LICENSE
 
 DOCKER_ENGINE_DEPENDENCIES = host-go host-pkgconf
 
-DOCKER_ENGINE_GOPATH = "$(@D)/gopath"
-DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
-	CGO_ENABLED=1 \
-	CGO_NO_EMULATION=1 \
-	GOBIN="$(@D)/bin" \
-	GOPATH="$(DOCKER_ENGINE_GOPATH)" \
-	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-	$(TARGET_MAKE_ENV)
-
-DOCKER_ENGINE_GLDFLAGS = \
+DOCKER_ENGINE_LDFLAGS = \
 	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
 	-X main.Version=$(DOCKER_ENGINE_VERSION)
 
-ifeq ($(BR2_STATIC_LIBS),y)
-DOCKER_ENGINE_GLDFLAGS += -extldflags '-static'
-else
-ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT),y)
-DOCKER_ENGINE_GLDFLAGS_DOCKER += -extldflags '-static'
-endif
-endif
-
-DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs autogen
-DOCKER_ENGINE_BUILD_TARGETS = docker
+DOCKER_ENGINE_TAGS = cgo exclude_graphdriver_zfs autogen
+DOCKER_ENGINE_BUILD_TARGETS = cmd/docker
 
 ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
-DOCKER_ENGINE_BUILD_TAGS += seccomp
+DOCKER_ENGINE_TAGS += seccomp
 DOCKER_ENGINE_DEPENDENCIES += libseccomp
 endif
 
 ifeq ($(BR2_INIT_SYSTEMD),y)
-DOCKER_ENGINE_BUILD_TAGS += journald
+DOCKER_ENGINE_TAGS += journald
 DOCKER_ENGINE_DEPENDENCIES += systemd
 endif
 
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
-DOCKER_ENGINE_BUILD_TAGS += daemon
-DOCKER_ENGINE_BUILD_TARGETS += dockerd
+DOCKER_ENGINE_TAGS += daemon
+DOCKER_ENGINE_BUILD_TARGETS += cmd/dockerd
 endif
 
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y)
-DOCKER_ENGINE_BUILD_TAGS += experimental
+DOCKER_ENGINE_TAGS += experimental
 endif
 
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
 DOCKER_ENGINE_DEPENDENCIES += btrfs-progs
 else
-DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_btrfs
+DOCKER_ENGINE_TAGS += exclude_graphdriver_btrfs
 endif
 
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
 DOCKER_ENGINE_DEPENDENCIES += lvm2
 else
-DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_devicemapper
+DOCKER_ENGINE_TAGS += exclude_graphdriver_devicemapper
 endif
 
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
 DOCKER_ENGINE_DEPENDENCIES += gvfs
 else
-DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_vfs
+DOCKER_ENGINE_TAGS += exclude_graphdriver_vfs
 endif
 
-define DOCKER_ENGINE_CONFIGURE_CMDS
-	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/docker
-	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
+DOCKER_ENGINE_INSTALL_BINS = $(notdir $(DOCKER_ENGINE_BUILD_TARGETS))
+
+define DOCKER_ENGINE_RUN_AUTOGEN
 	cd $(@D) && \
 		GITCOMMIT="$$(echo $(DOCKER_ENGINE_COMMIT) | head -c7)" \
 		BUILDTIME="$$(date)" \
@@ -85,6 +68,8 @@ define DOCKER_ENGINE_CONFIGURE_CMDS
 		bash ./hack/make/.go-autogen
 endef
 
+DOCKER_ENGINE_POST_CONFIGURE_HOOKS += DOCKER_ENGINE_RUN_AUTOGEN
+
 ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
 
 define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
@@ -103,22 +88,4 @@ endef
 
 endif
 
-define DOCKER_ENGINE_BUILD_CMDS
-	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
-		cd $(@D)/gopath/src/github.com/docker/docker; \
-		$(DOCKER_ENGINE_MAKE_ENV) \
-		$(HOST_DIR)/bin/go build -v \
-			-o $(@D)/bin/$(target) \
-			-tags "$(DOCKER_ENGINE_BUILD_TAGS)" \
-			-ldflags "$(DOCKER_ENGINE_GLDFLAGS) $(DOCKER_ENGINE_GLDFLAGS_$(call UPPERCASE,$(target)))" \
-			github.com/docker/docker/cmd/$(target)
-	)
-endef
-
-define DOCKER_ENGINE_INSTALL_TARGET_CMDS
-	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
-		$(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target)
-	)
-endef
-
-$(eval $(generic-package))
+$(eval $(golang-package))
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 8/8] package/docker-proxy: convert to golang infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 7/8] package/docker-engine: " Thomas Petazzoni
@ 2018-03-31 13:27 ` Thomas Petazzoni
  2018-03-31 15:13   ` Yann E. MORIN
  2018-03-31 18:00 ` [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Arnout Vandecappelle
  8 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 13:27 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/docker-proxy/docker-proxy.mk | 31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/package/docker-proxy/docker-proxy.mk b/package/docker-proxy/docker-proxy.mk
index 3bf6546d26..46cbcc3b91 100644
--- a/package/docker-proxy/docker-proxy.mk
+++ b/package/docker-proxy/docker-proxy.mk
@@ -12,35 +12,12 @@ DOCKER_PROXY_LICENSE_FILES = LICENSE
 
 DOCKER_PROXY_DEPENDENCIES = host-go host-pkgconf
 
-DOCKER_PROXY_GOPATH = "$(@D)/gopath"
-DOCKER_PROXY_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
-	CGO_ENABLED=1 \
-	CGO_NO_EMULATION=1 \
-	GOBIN="$(@D)/bin" \
-	GOPATH="$(DOCKER_PROXY_GOPATH)" \
-	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-	$(TARGET_MAKE_ENV)
+DOCKER_PROXY_WORKSPACE = gopath
 
-ifeq ($(BR2_STATIC_LIBS),y)
-DOCKER_PROXY_GLDFLAGS += -extldflags '-static'
-endif
-
-define DOCKER_PROXY_CONFIGURE_CMDS
-	mkdir -p $(DOCKER_PROXY_GOPATH)/src/github.com/docker
-	ln -fs $(@D) $(DOCKER_PROXY_GOPATH)/src/github.com/docker/libnetwork
-endef
-
-define DOCKER_PROXY_BUILD_CMDS
-	cd $(@D)/gopath/src/github.com/docker/libnetwork; \
-	$(DOCKER_PROXY_MAKE_ENV) \
-	$(HOST_DIR)/usr/bin/go build -v \
-		-o $(@D)/bin/docker-proxy \
-		-ldflags "$(DOCKER_PROXY_GLDFLAGS)" \
-		github.com/docker/libnetwork/cmd/proxy
-endef
+DOCKER_PROXY_BUILD_TARGETS = cmd/proxy
 
 define DOCKER_PROXY_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/bin/docker-proxy $(TARGET_DIR)/usr/bin/docker-proxy
+	$(INSTALL) -D -m 0755 $(@D)/$(DOCKER_PROXY_BINDIR)/proxy $(TARGET_DIR)/usr/bin/docker-proxy
 endef
 
-$(eval $(generic-package))
+$(eval $(golang-package))
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR) Thomas Petazzoni
@ 2018-03-31 13:34   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 13:34 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> The DOCKER_CONTAINERD_CONFIGURE_CMDS creates a symlink to runc's
> source directory, but it does not build depend on runc, which means
> that the runc package may not have been extracted/built before
> docker-containerd.
> 
> Therefore, when doing a build with "make docker-containerd", this
> symbolic link is broken, but it doesn't prevent docker-containerd from
> building.
> 
> Therefore, this symlink is not necessary and be dropped.

*can be dropped

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/docker-containerd/docker-containerd.mk | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
> index ffbadb0c3f..8f0822b77f 100644
> --- a/package/docker-containerd/docker-containerd.mk
> +++ b/package/docker-containerd/docker-containerd.mk
> @@ -27,8 +27,6 @@ endif
>  define DOCKER_CONTAINERD_CONFIGURE_CMDS
>  	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
>  	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
> -	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers
> -	ln -s $(RUNC_SRCDIR) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc
>  endef
>  
>  define DOCKER_CONTAINERD_BUILD_CMDS
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure Thomas Petazzoni
@ 2018-03-31 14:17   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 14:17 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> This patch adds a new infrastructure for golang based packages.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/Makefile.in   |   1 +
>  package/pkg-golang.mk | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 137 insertions(+)
>  create mode 100644 package/pkg-golang.mk
[--SNIP--]
> +#
> +# The go build/install command installs the binaries inside
> +# gopath/bin/linux_GOARCH/ when cross compilation is enabled. We set
> +# this variable here to be used by packages if needed.
> +#
> +$(2)_BINDIR = $$($(2)_WORKSPACE)/bin/linux_$$(GO_GOARCH)
> +
> +#
> +# Source files in Go should be uncompressed in a precise folder in the

s/uncompressed/extracted/

> +# hierarchy of GOPATH. It usually resolves around
> +# domain/vendor/software. By default, we derive domain/vendor/software
> +# from the upstream URL of the project, but we allow $(2)_SRC_SUBDIR
> +# to be overridden if needed.
> +#
> +$(2)_SRC_DOMAIN = $$(call domain,$($(2)_SITE))

I was a bit surprised not to see the definition of 'domain' here, but it
is infact a generic macro, from the download infra...

OK, so:

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> +$(2)_SRC_VENDOR = $$(word 1,$$(subst /, ,$$(call notdomain,$($(2)_SITE))))
> +$(2)_SRC_SOFTWARE = $$(word 2,$$(subst /, ,$$(call notdomain,$($(2)_SITE))))
> +
> +$(2)_SRC_SUBDIR ?= $$($(2)_SRC_DOMAIN)/$$($(2)_SRC_VENDOR)/$$($(2)_SRC_SOFTWARE)
> +$(2)_SRC_PATH = $$(@D)/$$($(2)_WORKSPACE)/src/$$($(2)_SRC_SUBDIR)
> +
> +#
> +# Configure step. Only define it if not already defined by the package
> +# .mk file.
> +#
> +ifndef $(2)_CONFIGURE_CMDS
> +define $(2)_CONFIGURE_CMDS
> +	mkdir -p $$(@D)/$$($(2)_WORKSPACE)/bin
> +	mkdir -p $$(dir $$($(2)_SRC_PATH))
> +	ln -sf $$(@D) $$($(2)_SRC_PATH)
> +endef
> +endif
> +
> +#
> +# Build step. Only define it if not already defined by the package .mk
> +# file. We use the install command instead of build command here
> +# because the install command also moves the package binaries in
> +# <workspace>/bin/linux_GOARCH/. Using the install command also
> +# leverages the go build infrastructure for building and installing
> +# multiple binaries.
> +#
> +ifndef $(2)_BUILD_CMDS
> +define $(2)_BUILD_CMDS
> +	$$(foreach d,$$($(2)_BUILD_TARGETS),\
> +		cd $$($(2)_SRC_PATH) && $$($(2)_GO_ENV) $$(GO_BIN) install -v $$($(2)_BUILD_OPTS) ./$$(d)
> +	)
> +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 d,$$($(2)_INSTALL_BINS),\
> +		$(INSTALL) -D -m 0755 $$(@D)/$$($(2)_BINDIR)/$$(d) $(TARGET_DIR)/usr/bin/$$(d)
> +	)
> +endef
> +endif
> +
> +# Call the generic package infrastructure to generate the necessary
> +# make targets
> +$(call inner-generic-package,$(1),$(2),$(3),$(4))
> +
> +endef # inner-golang-package
> +
> +################################################################################
> +# golang-package -- the target generator macro for Go packages
> +################################################################################
> +
> +golang-package = $(call inner-golang-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure Thomas Petazzoni
@ 2018-03-31 14:28   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 14:28 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> This patch adds the documentation for the golang infrastructure.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  docs/manual/adding-packages-golang.txt | 110 +++++++++++++++++++++++++++++++++
>  docs/manual/adding-packages.txt        |   2 +
>  2 files changed, 112 insertions(+)
>  create mode 100644 docs/manual/adding-packages-golang.txt
> 
> diff --git a/docs/manual/adding-packages-golang.txt b/docs/manual/adding-packages-golang.txt
> new file mode 100644
> index 0000000000..418da5fa4f
> --- /dev/null
> +++ b/docs/manual/adding-packages-golang.txt
> @@ -0,0 +1,110 @@
> +// -*- mode:doc; -*-
> +// vim: set syntax=asciidoc:
> +
> +=== Infrastructure for Go packages
> +
> +This infrastructure applies to Go packages that use the standard
> +build system and use bundled dependencies.
> +
> +[[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
> +04: #
> +05: ################################################################################
> +06:
> +07: FOO_VERSION = 1.0
> +08: FOO_SITE = $(call github,bar,foo,$(FOO_VERSION))
> +09: FOO_LICENSE = BSD-3-Clause
> +10: FOO_LICENSE_FILES = LICENSE
> +11:
> +12: $(eval $(golang-package))
> +------------------------
> +
> +On line 7, we declare the version of the package.
> +
> +On line 8, we declare the upstream location of the package, here
> +fetched from Github, since a large number of Go packages are hosted on
> +Github.
> +
> +On line 9 and 10, we give licensing details about the package.
> +
> +Finally, on line 12, 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
> +
> +In their +Config.in+ file, packages using the +golang-package+
> +infrastructure should depend on +BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS+
> +and +BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS+ because Buildroot will
> +automatically add a dependency on +host-go+ to such packages.
> +
> +The main macro of the Go package infrastructure is
> ++golang-package+. It is similar to the +generic-package+ macro. Only
> +target packages are supported with +golang-package+.
> +
> +Just like the generic infrastructure, the Go infrastructure works
> +by defining a number of variables before calling the +golang-package+.
> +
> +All the package metadata information variables that exist in the
> +xref:generic-package-reference[generic package infrastructure] also
> +exist in the Go infrastructure: +FOO_VERSION+, +FOO_SOURCE+,
> ++FOO_PATCH+, +FOO_SITE+, +FOO_SUBDIR+, +FOO_DEPENDENCIES+,
> ++FOO_LICENSE+, +FOO_LICENSE_FILES+, +FOO_INSTALL_STAGING+, etc.
> +
> +Note that:
> +
> + * It is not necessary to add +go+ or +host-go+ in the
> +   +FOO_DEPENDENCIES+ variable of a package, since these basic
> +   dependencies are automatically added as needed by the Go package
> +   infrastructure.
> +
> +A few additional variables, specific to the Go infrastructure, can
> +optionally be defined, depending on the package's needs. Many of them
> +are only useful in very specific cases, typical packages will
> +therefore only use a few of them, or none.
> +
> +* If your package need a custom +GOPATH+ to be compiled in, you can
> +  use the +FOO_WORKSPACE+ variable. The +GOPATH+ being used will be
> +  +<package-srcdir>/<FOO_WORKSPACE>+. If +FOO_WORKSPACE+ is not
> +  specified, it defaults to +_gopath+.
> +
> +* +FOO_SRC_SUBDIR+ is the sub-directory where your source will be
> +  compiled relatively to the +GOPATH+. An example value is
> +  +github.com/bar/foo+. If +FOO_SRC_SUBDIR+ is not specified, it
> +  defaults to a value infered from the +FOO_SITE+ variable.
> +
> +* +FOO_LDFLAGS+ and +FOO_TAGS+ can be used to pass respectively the
> +  +LDFLAGS+ or the +TAGS+ to the +go+ build command.
> +
> +* +FOO_BUILD_TARGETS+ can be used to pass the list of targets that
> +  should be built. If +FOO_BUILD_TARGETS+ is not specified, it
> +  defaults to +.+.
> +
> +* +FOO_INSTALL_BINS+ can be used to pass the list of binaries that
> +  should be installed +/usr/bin+ on the target. If +FOO_INSTALL_BINS+
> +  is not specified, it defaults to the lower-case name of package.
> +
> +With the Go infrastructure, all the steps required to build and
> +install the packages are already defined, and they generally work well
> +for most Go-based packages. However, when required, it is still
> +possible to customize what is done in any particular step:
> +
> +* By adding a post-operation hook (after extract, patch, configure,
> +  build or install). See xref:hooks[] for details.
> +
> +* By overriding one of the steps. For example, even if the Go
> +  infrastructure is used, if the package +.mk+ file defines its own
> +  +FOO_BUILD_CMDS+ variable, it will be used instead of the default Go
> +  one. However, using this method should be restricted to very
> +  specific cases. Do not use it in the general case.
> diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
> index e8d40daee4..c642146287 100644
> --- a/docs/manual/adding-packages.txt
> +++ b/docs/manual/adding-packages.txt
> @@ -38,6 +38,8 @@ include::adding-packages-meson.txt[]
>  
>  include::adding-packages-cargo.txt[]
>  
> +include::adding-packages-golang.txt[]
> +
>  include::adding-packages-kernel-module.txt[]
>  
>  include::adding-packages-asciidoc.txt[]
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 4/8] package/flannel: convert to golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 4/8] package/flannel: convert to " Thomas Petazzoni
@ 2018-03-31 14:55   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 14:55 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/flannel/flannel.mk | 32 ++++----------------------------
>  1 file changed, 4 insertions(+), 28 deletions(-)
> 
> diff --git a/package/flannel/flannel.mk b/package/flannel/flannel.mk
> index bbb2c72a72..07d5d0dfd6 100644
> --- a/package/flannel/flannel.mk
> +++ b/package/flannel/flannel.mk
> @@ -11,36 +11,12 @@ FLANNEL_SOURCE = $(FLANNEL_VERSION).tar.gz
>  FLANNEL_LICENSE = Apache-2.0
>  FLANNEL_LICENSE_FILES = LICENSE
>  
> -FLANNEL_DEPENDENCIES = host-go
> -
> -FLANNEL_MAKE_ENV = \
> -	$(HOST_GO_TARGET_ENV) \
> -	GOBIN="$(@D)/bin" \
> -	GOPATH="$(@D)/gopath" \
> -	CGO_ENABLED=1
> -
> -FLANNEL_GLDFLAGS = \
> -	-X github.com/coreos/flannel/version.Version=$(FLANNEL_VERSION)
> -
> -ifeq ($(BR2_STATIC_LIBS),y)
> -FLANNEL_GLDFLAGS += -extldflags '-static'
> -endif
> -
> -define FLANNEL_CONFIGURE_CMDS
> -	# Put sources at prescribed GOPATH location.
> -	mkdir -p $(@D)/gopath/src/github.com/coreos
> -	ln -s $(@D) $(@D)/gopath/src/github.com/coreos/flannel
> -endef
> -
> -define FLANNEL_BUILD_CMDS
> -	cd $(@D) && $(FLANNEL_MAKE_ENV) $(HOST_DIR)/bin/go \
> -		build -v -o $(@D)/bin/flanneld -ldflags "$(FLANNEL_GLDFLAGS)" .
> -endef
> +FLANNEL_LDFLAGS = -X github.com/coreos/flannel/version.Version=$(FLANNEL_VERSION)
>  
> +# Install flannel to its well known location.
>  define FLANNEL_INSTALL_TARGET_CMDS
> -	# Install flannel to its well known location.
> -	$(INSTALL) -D -m 0755 $(@D)/bin/flanneld $(TARGET_DIR)/opt/bin/flanneld
> +	$(INSTALL) -D -m 0755 $(@D)/$(FLANNEL_BINDIR)/flannel $(TARGET_DIR)/opt/bin/flanneld
>  	$(INSTALL) -D -m 0755 $(@D)/dist/mk-docker-opts.sh $(TARGET_DIR)/opt/bin/mk-docker-opts.sh
>  endef
>  
> -$(eval $(generic-package))
> +$(eval $(golang-package))
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 5/8] package/runc: convert to golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 5/8] package/runc: " Thomas Petazzoni
@ 2018-03-31 14:56   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 14:56 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/runc/runc.mk | 37 +++++--------------------------------
>  1 file changed, 5 insertions(+), 32 deletions(-)
> 
> diff --git a/package/runc/runc.mk b/package/runc/runc.mk
> index fb3fec20f5..f1586f32b2 100644
> --- a/package/runc/runc.mk
> +++ b/package/runc/runc.mk
> @@ -9,42 +9,15 @@ RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION))
>  RUNC_LICENSE = Apache-2.0
>  RUNC_LICENSE_FILES = LICENSE
>  
> -RUNC_DEPENDENCIES = host-go
> +RUNC_WORKSPACE = Godeps/_workspace
>  
> -RUNC_GOPATH = "$(@D)/Godeps/_workspace"
> -RUNC_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> -	CGO_ENABLED=1 \
> -	GOBIN="$(@D)/bin" \
> -	GOPATH="$(RUNC_GOPATH)" \
> -	PATH=$(BR_PATH)
> +RUNC_LDFLAGS = -X main.gitCommit=$(RUNC_VERSION)
>  
> -RUNC_GLDFLAGS = \
> -	-X main.gitCommit=$(RUNC_VERSION)
> -
> -ifeq ($(BR2_STATIC_LIBS),y)
> -RUNC_GLDFLAGS += -extldflags '-static'
> -endif
> -
> -RUNC_GOTAGS = cgo static_build
> +RUNC_TAGS = cgo static_build
>  
>  ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
> -RUNC_GOTAGS += seccomp
> +RUNC_TAGS += seccomp
>  RUNC_DEPENDENCIES += libseccomp host-pkgconf
>  endif
>  
> -define RUNC_CONFIGURE_CMDS
> -	mkdir -p $(RUNC_GOPATH)/src/github.com/opencontainers
> -	ln -s $(@D) $(RUNC_GOPATH)/src/github.com/opencontainers/runc
> -endef
> -
> -define RUNC_BUILD_CMDS
> -	cd $(@D) && $(RUNC_MAKE_ENV) $(HOST_DIR)/bin/go \
> -		build -v -o $(@D)/bin/runc \
> -		-tags "$(RUNC_GOTAGS)" -ldflags "$(RUNC_GLDFLAGS)" .
> -endef
> -
> -define RUNC_INSTALL_TARGET_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/bin/runc $(TARGET_DIR)/usr/bin/runc
> -endef
> -
> -$(eval $(generic-package))
> +$(eval $(golang-package))
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 6/8] package/docker-containerd: convert to golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 6/8] package/docker-containerd: " Thomas Petazzoni
@ 2018-03-31 14:59   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 14:59 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/docker-containerd/docker-containerd.mk | 33 +++++++-------------------
>  1 file changed, 8 insertions(+), 25 deletions(-)
> 
> diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
> index 8f0822b77f..88e27b5ed4 100644
> --- a/package/docker-containerd/docker-containerd.mk
> +++ b/package/docker-containerd/docker-containerd.mk
> @@ -9,37 +9,20 @@ DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VER
>  DOCKER_CONTAINERD_LICENSE = Apache-2.0
>  DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
>  
> -DOCKER_CONTAINERD_DEPENDENCIES = host-go
> +DOCKER_CONTAINERD_WORKSPACE = vendor
>  
> -DOCKER_CONTAINERD_GOPATH = "$(@D)/vendor"
> -DOCKER_CONTAINERD_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> -	CGO_ENABLED=1 \
> -	GOBIN="$(@D)/bin" \
> -	GOPATH="$(DOCKER_CONTAINERD_GOPATH)"
> -
> -DOCKER_CONTAINERD_GLDFLAGS = \
> +DOCKER_CONTAINERD_LDFLAGS = \
>  	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION)
>  
> -ifeq ($(BR2_STATIC_LIBS),y)
> -DOCKER_CONTAINERD_GLDFLAGS += -extldflags '-static'
> -endif
> +DOCKER_CONTAINERD_BUILD_TARGETS = ctr containerd containerd-shim
>  
> -define DOCKER_CONTAINERD_CONFIGURE_CMDS
> -	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
> -	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
> -endef
> +DOCKER_CONTAINERD_INSTALL_BINS = containerd containerd-shim
>  
> -define DOCKER_CONTAINERD_BUILD_CMDS
> -	$(foreach d,ctr containerd containerd-shim,\
> -		cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/bin/go build \
> -			-v -o $(@D)/bin/$(d) -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./$(d)$(sep))
> -endef
> -
> -define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
> +define DOCKER_CONTAINERD_INSTALL_SYMLINKS
>  	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
> -	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
> -	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
>  	ln -fs containerd-shim $(TARGET_DIR)/usr/bin/docker-containerd-shim
>  endef
>  
> -$(eval $(generic-package))
> +DOCKER_CONTAINERD_POST_INSTALL_TARGET_HOOKS += DOCKER_CONTAINERD_INSTALL_SYMLINKS
> +
> +$(eval $(golang-package))
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 7/8] package/docker-engine: convert to golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 7/8] package/docker-engine: " Thomas Petazzoni
@ 2018-03-31 15:04   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 15:04 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> From: Angelo Compagnucci <angelo@amarulasolutions.com>
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/docker-engine/docker-engine.mk | 67 +++++++++-------------------------
>  1 file changed, 17 insertions(+), 50 deletions(-)
> 
> diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
> index 8928f072e7..feb47d4994 100644
> --- a/package/docker-engine/docker-engine.mk
> +++ b/package/docker-engine/docker-engine.mk
> @@ -13,70 +13,53 @@ DOCKER_ENGINE_LICENSE_FILES = LICENSE
>  
>  DOCKER_ENGINE_DEPENDENCIES = host-go host-pkgconf
>  
> -DOCKER_ENGINE_GOPATH = "$(@D)/gopath"
> -DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> -	CGO_ENABLED=1 \
> -	CGO_NO_EMULATION=1 \
> -	GOBIN="$(@D)/bin" \
> -	GOPATH="$(DOCKER_ENGINE_GOPATH)" \
> -	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
> -	$(TARGET_MAKE_ENV)
> -
> -DOCKER_ENGINE_GLDFLAGS = \
> +DOCKER_ENGINE_LDFLAGS = \
>  	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
>  	-X main.Version=$(DOCKER_ENGINE_VERSION)
>  
> -ifeq ($(BR2_STATIC_LIBS),y)
> -DOCKER_ENGINE_GLDFLAGS += -extldflags '-static'
> -else
> -ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT),y)
> -DOCKER_ENGINE_GLDFLAGS_DOCKER += -extldflags '-static'
> -endif
> -endif

So, where do you now enforce a static build when
BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT is set?

Regards,
Yann E. MORIN.

> -DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs autogen
> -DOCKER_ENGINE_BUILD_TARGETS = docker
> +DOCKER_ENGINE_TAGS = cgo exclude_graphdriver_zfs autogen
> +DOCKER_ENGINE_BUILD_TARGETS = cmd/docker
>  
>  ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
> -DOCKER_ENGINE_BUILD_TAGS += seccomp
> +DOCKER_ENGINE_TAGS += seccomp
>  DOCKER_ENGINE_DEPENDENCIES += libseccomp
>  endif
>  
>  ifeq ($(BR2_INIT_SYSTEMD),y)
> -DOCKER_ENGINE_BUILD_TAGS += journald
> +DOCKER_ENGINE_TAGS += journald
>  DOCKER_ENGINE_DEPENDENCIES += systemd
>  endif
>  
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
> -DOCKER_ENGINE_BUILD_TAGS += daemon
> -DOCKER_ENGINE_BUILD_TARGETS += dockerd
> +DOCKER_ENGINE_TAGS += daemon
> +DOCKER_ENGINE_BUILD_TARGETS += cmd/dockerd
>  endif
>  
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y)
> -DOCKER_ENGINE_BUILD_TAGS += experimental
> +DOCKER_ENGINE_TAGS += experimental
>  endif
>  
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
>  DOCKER_ENGINE_DEPENDENCIES += btrfs-progs
>  else
> -DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_btrfs
> +DOCKER_ENGINE_TAGS += exclude_graphdriver_btrfs
>  endif
>  
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
>  DOCKER_ENGINE_DEPENDENCIES += lvm2
>  else
> -DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_devicemapper
> +DOCKER_ENGINE_TAGS += exclude_graphdriver_devicemapper
>  endif
>  
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
>  DOCKER_ENGINE_DEPENDENCIES += gvfs
>  else
> -DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_vfs
> +DOCKER_ENGINE_TAGS += exclude_graphdriver_vfs
>  endif
>  
> -define DOCKER_ENGINE_CONFIGURE_CMDS
> -	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/docker
> -	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
> +DOCKER_ENGINE_INSTALL_BINS = $(notdir $(DOCKER_ENGINE_BUILD_TARGETS))
> +
> +define DOCKER_ENGINE_RUN_AUTOGEN
>  	cd $(@D) && \
>  		GITCOMMIT="$$(echo $(DOCKER_ENGINE_COMMIT) | head -c7)" \
>  		BUILDTIME="$$(date)" \
> @@ -85,6 +68,8 @@ define DOCKER_ENGINE_CONFIGURE_CMDS
>  		bash ./hack/make/.go-autogen
>  endef
>  
> +DOCKER_ENGINE_POST_CONFIGURE_HOOKS += DOCKER_ENGINE_RUN_AUTOGEN
> +
>  ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
>  
>  define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
> @@ -103,22 +88,4 @@ endef
>  
>  endif
>  
> -define DOCKER_ENGINE_BUILD_CMDS
> -	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
> -		cd $(@D)/gopath/src/github.com/docker/docker; \
> -		$(DOCKER_ENGINE_MAKE_ENV) \
> -		$(HOST_DIR)/bin/go build -v \
> -			-o $(@D)/bin/$(target) \
> -			-tags "$(DOCKER_ENGINE_BUILD_TAGS)" \
> -			-ldflags "$(DOCKER_ENGINE_GLDFLAGS) $(DOCKER_ENGINE_GLDFLAGS_$(call UPPERCASE,$(target)))" \
> -			github.com/docker/docker/cmd/$(target)
> -	)
> -endef
> -
> -define DOCKER_ENGINE_INSTALL_TARGET_CMDS
> -	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
> -		$(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target)
> -	)
> -endef
> -
> -$(eval $(generic-package))
> +$(eval $(golang-package))
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 8/8] package/docker-proxy: convert to golang infrastructure
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 8/8] package/docker-proxy: " Thomas Petazzoni
@ 2018-03-31 15:13   ` Yann E. MORIN
  0 siblings, 0 replies; 19+ messages in thread
From: Yann E. MORIN @ 2018-03-31 15:13 UTC (permalink / raw)
  To: buildroot

Thomas, Angelo, All,

On 2018-03-31 15:27 +0200, Thomas Petazzoni spake thusly:
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/docker-proxy/docker-proxy.mk | 31 ++++---------------------------
>  1 file changed, 4 insertions(+), 27 deletions(-)
> 
> diff --git a/package/docker-proxy/docker-proxy.mk b/package/docker-proxy/docker-proxy.mk
> index 3bf6546d26..46cbcc3b91 100644
> --- a/package/docker-proxy/docker-proxy.mk
> +++ b/package/docker-proxy/docker-proxy.mk
> @@ -12,35 +12,12 @@ DOCKER_PROXY_LICENSE_FILES = LICENSE
>  
>  DOCKER_PROXY_DEPENDENCIES = host-go host-pkgconf
>  
> -DOCKER_PROXY_GOPATH = "$(@D)/gopath"
> -DOCKER_PROXY_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> -	CGO_ENABLED=1 \
> -	CGO_NO_EMULATION=1 \
> -	GOBIN="$(@D)/bin" \
> -	GOPATH="$(DOCKER_PROXY_GOPATH)" \
> -	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
> -	$(TARGET_MAKE_ENV)
> +DOCKER_PROXY_WORKSPACE = gopath
>  
> -ifeq ($(BR2_STATIC_LIBS),y)
> -DOCKER_PROXY_GLDFLAGS += -extldflags '-static'
> -endif
> -
> -define DOCKER_PROXY_CONFIGURE_CMDS
> -	mkdir -p $(DOCKER_PROXY_GOPATH)/src/github.com/docker
> -	ln -fs $(@D) $(DOCKER_PROXY_GOPATH)/src/github.com/docker/libnetwork
> -endef
> -
> -define DOCKER_PROXY_BUILD_CMDS
> -	cd $(@D)/gopath/src/github.com/docker/libnetwork; \
> -	$(DOCKER_PROXY_MAKE_ENV) \
> -	$(HOST_DIR)/usr/bin/go build -v \
> -		-o $(@D)/bin/docker-proxy \
> -		-ldflags "$(DOCKER_PROXY_GLDFLAGS)" \
> -		github.com/docker/libnetwork/cmd/proxy
> -endef
> +DOCKER_PROXY_BUILD_TARGETS = cmd/proxy
>  
>  define DOCKER_PROXY_INSTALL_TARGET_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/bin/docker-proxy $(TARGET_DIR)/usr/bin/docker-proxy
> +	$(INSTALL) -D -m 0755 $(@D)/$(DOCKER_PROXY_BINDIR)/proxy $(TARGET_DIR)/usr/bin/docker-proxy
>  endef
>  
> -$(eval $(generic-package))
> +$(eval $(golang-package))
> -- 
> 2.14.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure
  2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2018-03-31 13:27 ` [Buildroot] [PATCH v4 8/8] package/docker-proxy: " Thomas Petazzoni
@ 2018-03-31 18:00 ` Arnout Vandecappelle
  2018-03-31 18:39   ` Thomas Petazzoni
  8 siblings, 1 reply; 19+ messages in thread
From: Arnout Vandecappelle @ 2018-03-31 18:00 UTC (permalink / raw)
  To: buildroot



On 31-03-18 15:27, Thomas Petazzoni wrote:
> Hello,
> 
> This v4 is a new iteration of the work done by Angelo Compagnucci to
> introduce a golang package infrastructure. Note that in its v3 of the
> series, Angelo had a PATCH 7/7 that was adding 'mender' as a new
> package, but this specific patch is not part of this series.

 Series applied, with the exception of 7/8 which had a relevant comment from Yann:

   So, where do you now enforce a static build when
   BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT is set?

 Angelo, could you respin that patch together with mender?

 I also made some changes to pkg-golang.mk:

     - Rewrap comments to 80 columns.
     - Create a global definition of GO_TARGET_ENV.
     - <PKG>_GO_ENV is appended to the default env instead of replacing it.
     - Add a note to inner-golang-package that only target is supported.

 Angelo, please review those and send follow-up patches if you don't agree with
any of it.

 Thank you for the persistence on this one! And thank you Yann for reviewing.

 Regards,
 Arnout


[snip]

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure
  2018-03-31 18:00 ` [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Arnout Vandecappelle
@ 2018-03-31 18:39   ` Thomas Petazzoni
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 18:39 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 31 Mar 2018 20:00:43 +0200, Arnout Vandecappelle wrote:
> On 31-03-18 15:27, Thomas Petazzoni wrote:
> > Hello,
> > 
> > This v4 is a new iteration of the work done by Angelo Compagnucci to
> > introduce a golang package infrastructure. Note that in its v3 of the
> > series, Angelo had a PATCH 7/7 that was adding 'mender' as a new
> > package, but this specific patch is not part of this series.  
> 
>  Series applied, with the exception of 7/8 which had a relevant comment from Yann:
> 
>    So, where do you now enforce a static build when
>    BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT is set?
> 
>  Angelo, could you respin that patch together with mender?

I took care of PATCH 7/8, which converts docker-engine to the
golang-package infrastructure, re-adding the code handling
BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT.

So the Mender patch remains. I don't think Angelo really needs to
respin it, since we haven't reviewed it (yet).

>  I also made some changes to pkg-golang.mk:
> 
>      - Rewrap comments to 80 columns.
>      - Create a global definition of GO_TARGET_ENV.
>      - <PKG>_GO_ENV is appended to the default env instead of replacing it.
>      - Add a note to inner-golang-package that only target is supported.
> 
>  Angelo, please review those and send follow-up patches if you don't agree with
> any of it.
> 
>  Thank you for the persistence on this one! And thank you Yann for reviewing.

And thank you for doing a final review on this series!

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-03-31 18:39 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-31 13:27 [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Thomas Petazzoni
2018-03-31 13:27 ` [Buildroot] [PATCH v4 1/8] docker-containerd: remove symlink to $(RUNC_SRCDIR) Thomas Petazzoni
2018-03-31 13:34   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure Thomas Petazzoni
2018-03-31 14:17   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 3/8] docs/manual: add documentation for the golang infrastructure Thomas Petazzoni
2018-03-31 14:28   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 4/8] package/flannel: convert to " Thomas Petazzoni
2018-03-31 14:55   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 5/8] package/runc: " Thomas Petazzoni
2018-03-31 14:56   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 6/8] package/docker-containerd: " Thomas Petazzoni
2018-03-31 14:59   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 7/8] package/docker-engine: " Thomas Petazzoni
2018-03-31 15:04   ` Yann E. MORIN
2018-03-31 13:27 ` [Buildroot] [PATCH v4 8/8] package/docker-proxy: " Thomas Petazzoni
2018-03-31 15:13   ` Yann E. MORIN
2018-03-31 18:00 ` [Buildroot] [PATCH v4 0/8] Introduce a golang-package infrastructure Arnout Vandecappelle
2018-03-31 18:39   ` Thomas Petazzoni

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.