From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 2/8] package/pkg-golang: new package infrastructure
Date: Sat, 31 Mar 2018 16:17:22 +0200 [thread overview]
Message-ID: <20180331141722.GF25161@scaer> (raw)
In-Reply-To: <20180331132736.21105-3-thomas.petazzoni@bootlin.com>
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. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2018-03-31 14:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180331141722.GF25161@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.