From patchwork Wed Oct 25 09:26:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 830152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JDEWPAsJ"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMPt30Jnyz9t2W for ; Wed, 25 Oct 2017 20:27:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C4DDF30838; Wed, 25 Oct 2017 09:27:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GTM9iZD83WpI; Wed, 25 Oct 2017 09:26:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 8A8D63037F; Wed, 25 Oct 2017 09:26:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id E73AE1C0621 for ; Wed, 25 Oct 2017 09:26:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id DB8DC899DF for ; Wed, 25 Oct 2017 09:26:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wvzbluroA2TX for ; Wed, 25 Oct 2017 09:26:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id B91C588A10 for ; Wed, 25 Oct 2017 09:26:56 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id p75so557325wmg.3 for ; Wed, 25 Oct 2017 02:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=vl78WQ7JAgl6yJlj8BkWxTeg0CgPtjDAje8X9QDn8pM=; b=JDEWPAsJn12l23WIW04KMvoRwfKRPnPgmVSmsY2qkIuqdbsbYhKJf/00kQWz1J83UC dXG1HacaKeBreert0NxllAoOmATAmkkJDQrQZx6R60kB0fD/hONUV55zXF7dvRqtttgo wg7sVZ+EjUnmeu2YeUuHrJrNmhC2lR0RJ8NZihmTIP8XjWxHrPB+LXrMr1QbQUbSNOTY Rc+parr6Xa40/b+xEcTJ7iYNFtNvHcbnjzKWWGNJKr9CgjXJB88gnsrBsdYr0zwLxfOY BbSu5S2QA07+0SLjaNtrLhH6aLEDJdGDZ/haM92B+r/mI9Sf7EORxbnn2dvV914DtQfP QgCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vl78WQ7JAgl6yJlj8BkWxTeg0CgPtjDAje8X9QDn8pM=; b=nv1qRDHjF6C8nLZzZzVfiLQNqb8Jj2OEPRixESAU7v7Mn8fllkVvRRZMQr4had+122 R3qBTqaMLrHeQHPI3H/te6qJsewAL2L1nw/znv4aDP0dnyToALehBRpdNjNjLqSOJCvN ahl2V7nUvklkUduHRBrN14xXtTSQfDUCkcYadwA+7FmWKosgED3Tlv3SejL+/mmndw0h V8/sEsECy5Rem8dKGtcdr26wmzbmhIQJ5JxzoKxwhwk8mMMOyFNKPmAJSzFwnED+HXDp 3DlhAp2nA/BGWU7FTqeUCk7i+QWe0DeoY+s7QOu+VhLtVC/TuWJftildQeS0pkk1Ctcs V3bA== X-Gm-Message-State: AMCzsaV043x0DZY0TVB83nlslw+cnUADpiFSjCaYTdD4foCfLW323o8u uE1r8g7Yr3nnLnIiQrAidnmKkXwO X-Google-Smtp-Source: ABhQp+R4ugFGdQr2ki/tkBB8Ve2PLpj0EOmF6VoDvditX3QT1ZwpxsFpdARepngCQzahOyLTJP0cZw== X-Received: by 10.28.5.148 with SMTP id 142mr1147570wmf.142.1508923614445; Wed, 25 Oct 2017 02:26:54 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id q7sm2009311wrg.97.2017.10.25.02.26.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:26:53 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 11:26:45 +0200 Message-Id: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: christian@paral.in Subject: [Buildroot] [RFC v5 1/5] package/pkg-golang: new package infrastructure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds a new infrastructure for golang based packages. Signed-off-by: Angelo Compagnucci --- Changelog: v2 -> v3: * Adding GO_LDFLAGS and GO_TAGS variables * Adding GOPATH variable * Adding option to build as static when BR2_STATIC_LIBS is enabled * Changed building logic to take into account multiple binaries v3 -> v4: * Changing GOPATH default value from gopath to _gopath v4 -> v5: * Removing unnecessary for now host package part (suggested by Arnout) * Fixing the naming of _MAKE_ENV (suggested by Arnout) * Reworking building command (suggested by Arnout) package/Makefile.in | 1 + package/pkg-golang.mk | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 package/pkg-golang.mk diff --git a/package/Makefile.in b/package/Makefile.in index a1a5316..60d98d0 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -429,3 +429,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 0000000..467d5b5 --- /dev/null +++ b/package/pkg-golang.mk @@ -0,0 +1,120 @@ +################################################################################ +# 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 _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. +# +################################################################################ + +################################################################################ +# 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)_GO ?= $(HOST_DIR)/bin/go install -v +$(2)_GOPATH ?= _gopath +$(2)_GO_ENV ?= $$(HOST_GO_TARGET_ENV) \ + GOPATH="$$(@D)/$$($(2)_GOPATH)" \ + CGO_ENABLED=$$(HOST_GO_CGO_ENABLED) + +ifeq ($(BR2_STATIC_LIBS),y) + $(2)_GO_LDFLAGS += -extldflags '-static' +endif + +ifdef $(2)_GO_LDFLAGS + $(2)_BUILD_OPTS += -ldflags "$$($(2)_GO_LDFLAGS)" +endif + +ifdef $(2)_GO_TAGS + $(2)_BUILD_OPTS += -tags "$$($(2)_GO_TAGS)" +endif + +# Target packages need the Go compiler on the host. +$(2)_DEPENDENCIES += host-go + +# +# 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)_GOPATH)/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. +# +$(2)_GO_SRC_PATH ?= $$(call domain,$($(2)_SITE))/$$(firstword $$(subst /, ,$$(call notdomain,$($(2)_SITE)))) +$(2)_SRC_PATH = $$(@D)/$$($(2)_GOPATH)/src/$$($(2)_GO_SRC_PATH)/$(1) + +# +# 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)_GOPATH)/bin + mkdir -p $$(@D)/$$($(2)_GOPATH)/src/$$($(2)_GO_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 gopath/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 + cd $$($(2)_SRC_PATH) && $$($(2)_GO_ENV) $$($(2)_GO) $$($(2)_BUILD_OPTS) +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 + $(INSTALL) -D -m 0755 $$(@D)/$$($(2)_BINDIR)/$(1) $(TARGET_DIR)/usr/bin/ +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) From patchwork Wed Oct 25 09:26:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 830153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XlY/UW9g"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMPt45yDPz9sRV for ; Wed, 25 Oct 2017 20:27:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 722DF3083B; Wed, 25 Oct 2017 09:27:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e8Q1RMz7pOC4; Wed, 25 Oct 2017 09:27:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7D3E030832; Wed, 25 Oct 2017 09:27:04 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id EC5571C0621 for ; Wed, 25 Oct 2017 09:26:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E5336899DF for ; Wed, 25 Oct 2017 09:26:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pEXIytAQvkaH for ; Wed, 25 Oct 2017 09:26:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2664388A10 for ; Wed, 25 Oct 2017 09:26:58 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id k62so23278355wrc.9 for ; Wed, 25 Oct 2017 02:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XFuMj3d7/yxpLL8+h5a69IMeF5frt0uQiNW+NyB/6nU=; b=XlY/UW9gs2UOTd+38hmQyd8YdR7dm66y30E2+j3vxNiEOxQkd8YxKDgMF04JEMIXe2 hC5SMuuT/PErn4ManTKKteVCcs0Kktd/0IgQd9dNvQByTWZG853OlFoSj6U4KAgBVcYb 3btgAFQTTwk0o+dxLEIhkq8DN9JXqPbuoj7NQR1CxJZ2tlHdjkHP1F7yNgiM6NS8etz6 z5TXcZuP843MFhbVM7eu59yOjl98b4i/Jt+cGC93cNz0QXHjC8Ie9E3Tw24NFFwDUZob 8qq9Yc3PSA8uXcmyApFx9PXYkW1LCU1RQyabfUfIrUGFO7gIOhdWzdiolVr3jndtzGcE Y3Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XFuMj3d7/yxpLL8+h5a69IMeF5frt0uQiNW+NyB/6nU=; b=ttIfRrK748SgIxMIU9shfwIaI7AjqyfYZTHyN/gXOndGCJ+TTRGpTC9S8xP4BC+GKl /+41eRc/dV4VedRP9TwTiePC4f3ZWQZq1146WJqVFzUyHKvV+jS50aYmD3T7XgWoQ/9N mNDpc6VMmZQc9xs953B15GsZD085yppBJ3sa4RVlidt5/eJ6b1eFmq4r8+WizJwFSLgx 60bxTS5yJrG9ZAHP+o60vrd5stk2JYJAYgshcZ5+W9kMowLtdm81BGbsf5RaoVnSps3Q 3DOLLOwWd4t20WKstSB7gPd61wf4ELp6QDTilkVr5vwrnp+3D8T8G2OmJ1qmLEgJ0Vzy JVvg== X-Gm-Message-State: AMCzsaVlrJ895a6FBc9uoRAb0uqgghw7Y+biAVtJ91b/9tMo2VidREq3 wjNPfu4tm03uB/0R41chHmmq7/Qq X-Google-Smtp-Source: ABhQp+Q5Us6askMNV/4H4PMLPhbUHBmB74o5K7VxSOZPJn2/1C65kpePANmZiQIk0EeK5xtZW3loYg== X-Received: by 10.223.154.74 with SMTP id z68mr1500123wrb.36.1508923615909; Wed, 25 Oct 2017 02:26:55 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id q7sm2009311wrg.97.2017.10.25.02.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:26:55 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 11:26:46 +0200 Message-Id: <1508923609-2022-2-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> References: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> Cc: christian@paral.in Subject: [Buildroot] [RFC v5 2/5] docs/manual: adding documentation for the golang infrastructure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds the documentation for the golang infrastructure. Signed-off-by: Angelo Compagnucci --- docs/manual/adding-packages-golang.txt | 114 +++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 116 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 0000000..3761cac --- /dev/null +++ b/docs/manual/adding-packages-golang.txt @@ -0,0 +1,114 @@ +// -*- 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: # go-foo +04: # +05: ################################################################################ +06: +07: GO_FOO_VERSION = 1.0 +08: GO_FOO_SOURCE = go-foo-$(GO_FOO_VERSION).tar.xz +09: GO_FOO_SITE = http://www.foosoftware.org/download +10: GO_FOO_LICENSE = BSD-3-Clause +11: GO_FOO_LICENSE_FILES = LICENSE +12: +13: $(eval $(golang-package)) +------------------------ + +On line 7, we declare the version of the package. + +On line 8 and 9, we declare the name of the tarball (xz-ed tarball +recommended) and the location of the tarball on the Web. Buildroot +will automatically download the tarball from this location. + +On line 10 and 11, we give licensing details about the package (its +license on line 10, and the file containing the license text on line +11). + +Finally, on line 13, 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 packages can freely choose their name (existing example in +Buildroot is +flannel+). + +In their +Config.in+ file, they should depend on ++BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS+ and ++BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS+ cause host-go will compile when Buildroot will add the +dependency automatically. + +The main macro of the Go package infrastructure is ++golang-package+. It is similar to the +generic-package+ macro. + +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: +GO_FOO_VERSION+, ++GO_FOO_SOURCE+, +GO_FOO_PATCH+, +GO_FOO_SITE+, ++GO_FOO_SUBDIR+, +GO_FOO_DEPENDENCIES+, +GO_FOO_LICENSE+, ++GO_FOO_LICENSE_FILES+, +GO_FOO_INSTALL_STAGING+, etc. + +Note that: + + * It is not necessary to add +go+ or +host-go+ in the + +GO_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 + +GO_FOO_GOPATH+. + +* +GO_FOO_GO_SRC_PATH+ is the path where your source will be compiled + relatively to the GOPATH. + The golang package infrastructure tries to guess the correct + sub folder to compile in but if guessing is not correct for you or your + package behaves differently, you can use this variable to + redefine the path. + +* +GOO_FOO_GO_LDFLAGS+ and +GO_FOO_GO_TAGS+ can be used to pass + respectively the LDFLAGS or the TAGS to the build command. + +GOO_FOO_GO_LDFLAGS+ and +GO_FOO_GO_TAGS+ will be combined into + the proper command line options to be passed to the compiler. + +* If you need to customize the install location for you binaries, you + can use +GOO_FOO_BINDIR+ to know where the binaries are. + +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 + +GO_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 d577ff0..be7468b 100644 --- a/docs/manual/adding-packages.txt +++ b/docs/manual/adding-packages.txt @@ -34,6 +34,8 @@ include::adding-packages-rebar.txt[] include::adding-packages-waf.txt[] +include::adding-packages-golang.txt[] + include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[] From patchwork Wed Oct 25 09:26:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 830154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iHYDHeSQ"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMPt90Jkvz9t2M for ; Wed, 25 Oct 2017 20:27:12 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D760A8879B; Wed, 25 Oct 2017 09:27:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9FjN7K1sM7e0; Wed, 25 Oct 2017 09:27:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8024588747; Wed, 25 Oct 2017 09:27:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D431D1C0621 for ; Wed, 25 Oct 2017 09:27:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CF05F899DF for ; Wed, 25 Oct 2017 09:27:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OguPwCJ3afcs for ; Wed, 25 Oct 2017 09:27:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id DEBF388A10 for ; Wed, 25 Oct 2017 09:26:59 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id p75so557622wmg.3 for ; Wed, 25 Oct 2017 02:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s51PPjhKKRDbmrQNcVO7GX5EnWvdvo4RsHfbuWfg/MA=; b=iHYDHeSQwBeWauXS9ei53ERuimR8uC9urEi1zfkZOIaGC84LoCoEYWt+iuWG/GyTpT tgh0R0MJv8kxMzw7SnSEWQoAhR52Nc5NILI+zg3AzjDtpHG4bYvEwKQbTNGrXCwYOYFG r+JGDaGuJTeODMHaq50e/gKScJofgJiJUERLUzqsXQD2s65aUofK+FnFzT0i3IwAb08T 7xdgX7yuCL8Eyb2bfZkaZS9eah37DtywWZr5GWVPDOTgbraavIfSEUP72L37PSq+5POF zRSuksazeJRzyQQzGDTSszRcIdx8Im0x4iylnXEFlq4+jVQCVr1wEMeWKiwQSK8PQiZF hyPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s51PPjhKKRDbmrQNcVO7GX5EnWvdvo4RsHfbuWfg/MA=; b=Tdyt8QmrfcWASpR/EH7eJygO1Y1UzaqOlKE0iKMn78WoHYuZ16qy7eRwjPZiBeTG9W WBHlN0Siusz7h9Z6J4cIYrpMc/qI6PM92X36I2UubMo0X9fTzDC2uuC65C2QiN2LrdIl Wda3DiFog1+WIISC7osMn4dMD6eurUQMs/KXzpAQpNO+3hHnQHLbxOIDnc/2rcQwIYVv sPiq229V6lbABCOKsPS9RJcjp8NEbaUEZhi8uKyImGKnyDYVnKKGUVcRtVllet7SHWiP x6lj3FgiuvQ76dcTmMgDj3G7cap/wE2m9PrHZd2vPdyxWpU/sZ1MFantWCXyYhir82rW jGgg== X-Gm-Message-State: AMCzsaWG4Df7dLBtGinst2UlQd3tsM7+PRUGYleVurFnTyEU9fyRSCGh AXv2WxoNjPShhIGvKeNLsy2pS4pa X-Google-Smtp-Source: ABhQp+QnsQZ94kc5v7qCCUpAUHjdgT03wbI2MaFGal4CDjqGdgSU0mEXUdcL4wgL2ZNUDlDFIZPhPw== X-Received: by 10.28.183.8 with SMTP id h8mr1070849wmf.2.1508923617822; Wed, 25 Oct 2017 02:26:57 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id q7sm2009311wrg.97.2017.10.25.02.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:26:56 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 11:26:47 +0200 Message-Id: <1508923609-2022-3-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> References: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> Cc: christian@paral.in Subject: [Buildroot] [RFC v5 3/5] package/flannel: converting to golang infrastructure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch converts the flannel package to the new golang infrastructure. Signed-off-by: Angelo Compagnucci --- 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 bbb2c72..6c9d9dd 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_GO_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 $(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)) From patchwork Wed Oct 25 09:26:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 830156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LN3IJL7H"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMPtH4Jd2z9sRV for ; Wed, 25 Oct 2017 20:27:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 29F9E824FD; Wed, 25 Oct 2017 09:27:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4N-WksBAAtqQ; Wed, 25 Oct 2017 09:27:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 6EBB788C55; Wed, 25 Oct 2017 09:27:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 262B71C0621 for ; Wed, 25 Oct 2017 09:27:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 20FA588C55 for ; Wed, 25 Oct 2017 09:27:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kc2eXNKqCchp for ; Wed, 25 Oct 2017 09:27:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by whitealder.osuosl.org (Postfix) with ESMTPS id 36E5C824FD for ; Wed, 25 Oct 2017 09:27:01 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id u138so543028wmu.5 for ; Wed, 25 Oct 2017 02:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HW5Ui31yJb8tT6Nl8iI7G89Nn0bw+Q5wxMx9+X841Vs=; b=LN3IJL7HLbtfaxlNyGSZogNac+RKrwsgEUyujn88IuzWYtFfoEN5uLHAAXA5ApErTZ QS+pXCucgXXO036r0XzboZllh3UyHT/fydW8RYAHQv3wF6Z3QxVV2eO7fVzYLQgn41QC v0FH8sPuQc97mMIUeVbHgfwOCJ5Dp3VqKEZVlhLSeTRNkiFaL+9+xKlI90ki2ta/968h N6oSDWuQ6UVj5f55wm6gwKT1Hb+LJ2BNK3kWMGnHiBR8ee3eQ2MEEDTgTe2S8bS/WVE/ 58JLTgqVeIp5WN19NI1qAz/F86Qeh0dOqbaP+1rTSib9R8whpfh+68+yPQfhzRmqZmE6 B4dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HW5Ui31yJb8tT6Nl8iI7G89Nn0bw+Q5wxMx9+X841Vs=; b=HMUAQkPIeh+xwIDZ1MmDlebwF7orgJ3d9Jidf8/XoO0hQv4mrwd6sbXYISC/uUedO/ BTnPMio7V8aFr0fVCloQtpLtuKS4V+XoytMcabWCRB430TA4EdS7GQ96qcrBPlEMuGDT EgRv0TvuHiqKKHMnfsqz2fYiGoW9hMM9jV+RQR9OWwaIVxjoYUD9TVvQTjoWpq4JB3qg ciNWdMVhMnh4+yW1cwQAUhre3eLugyU7Em6qOoAPmt+qJTVeXdO32EyLVNwaYM/lCy4P QeYqnXgFeXRxxinFNNhL6U3Tw2IXzKfu3VMhAMvYQqhPwZvCsZLm8usPjaQPom/OnC3Z tDdA== X-Gm-Message-State: AMCzsaU3OxntmKeXTLLR3iRibyK5O8Pw5n7X+OTRS21sUShPjowWBxZN qt65unfM76lC0eKQ8nFzYUi6zqgB X-Google-Smtp-Source: ABhQp+Rs4V2cvfYGtmvv3FsCwVHO0ypkRtFky8hHoAPlhfbkB5/VugEvlDRMt1Kw31ZRLVrTKWt8Fw== X-Received: by 10.28.101.4 with SMTP id z4mr1157348wmb.77.1508923619156; Wed, 25 Oct 2017 02:26:59 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id q7sm2009311wrg.97.2017.10.25.02.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:26:58 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 11:26:48 +0200 Message-Id: <1508923609-2022-4-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> References: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> Cc: christian@paral.in Subject: [Buildroot] [RFC v5 4/5] package/runc: converting to golang infrastructure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch converts the runc package to the new golang infrastructure. Signed-off-by: Angelo Compagnucci --- package/runc/runc.mk | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/package/runc/runc.mk b/package/runc/runc.mk index 0b51e11..2855ce3 100644 --- a/package/runc/runc.mk +++ b/package/runc/runc.mk @@ -9,43 +9,13 @@ RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION)) RUNC_LICENSE = Apache-2.0 RUNC_LICENSE_FILES = LICENSE -RUNC_DEPENDENCIES = host-go +RUNC_GO_LDFLAGS = -X main.gitCommit=$(RUNC_VERSION) -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_GLDFLAGS = \ - -X main.gitCommit=$(RUNC_VERSION) - -ifeq ($(BR2_STATIC_LIBS),y) -RUNC_GLDFLAGS += -extldflags '-static' -endif - -RUNC_GOTAGS = cgo static_build +RUNC_GO_TAGS = cgo static_build ifeq ($(BR2_PACKAGE_LIBSECCOMP),y) -RUNC_GOTAGS += seccomp +RUNC_GO_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 $(RUNC_GOPATH)/src/github.com/opencontainers/runc && \ - $(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)) From patchwork Wed Oct 25 09:26:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 830155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SaZhe4cK"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMPtH47VKz9sNx for ; Wed, 25 Oct 2017 20:27:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8106089500; Wed, 25 Oct 2017 09:27:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MvZ5TiUayyTg; Wed, 25 Oct 2017 09:27:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 94666894F5; Wed, 25 Oct 2017 09:27:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 4726C1C0621 for ; Wed, 25 Oct 2017 09:27:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 417E588C55 for ; Wed, 25 Oct 2017 09:27:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sHKses8Jlq3j for ; Wed, 25 Oct 2017 09:27:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9A321824FD for ; Wed, 25 Oct 2017 09:27:02 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id u138so543172wmu.5 for ; Wed, 25 Oct 2017 02:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N4KFTZQ3vxlnI5dsMDmlXewwK0nONFaXqPPkiNEzOZE=; b=SaZhe4cKNILHSAFe0sNyKkaFjyUo7MYELxIKHkjeXpCiiL6kPglQ2/bDicGYd+O0Cu Aojc8gan4F/QImRsfwtlvhAa4TzafhiPfJRlw9rlDpb48ernfRvuungcLiA61mxt1VBb Uy7BeMDrlF0NjptQrPdWZiWzQRSNj6u0pvj7b7YoM75USZKxBp0gjAWgxNPbCH1EdRnT UIpsFkoHQQRbNh7VTRO4bHpXGEty2oGFjNopzAvOHxk7PJsenrF6UbvKOmgb0hGIDAQI WrUx2ioRMPMdelBmMtunkHeKnWJzC6HJTAAeEWuSt5BjxF4e6N6VVaXVKsEVWCRWcSTK choA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N4KFTZQ3vxlnI5dsMDmlXewwK0nONFaXqPPkiNEzOZE=; b=obrNjZTmxfapdDLliVB3zaOi21JJKtUSH0gxRQh1E3kDkrBaq2qvvQiAjq1CY9EaDH Msi9lSglpGOYy2+9P7fkwb/x0xwaPF1DAAWmxAWpVc0lsX29CODC1/os0bKNN8wdqCU/ iYalpIvair9bQOM0RayXXSiylpBfgJG5FtrUSFkuRgSDd+R4GtgWozGItqq8MWlbu3z3 9Kvl6nIXsJYyUYv4JKJeQ36zVRU56w2YCWYRfcALkL3xdWjmD+rY/CIR98b0DT76WkU9 pbciZiFIaXTx3SqytcuwbRYeeMj3dIbRQKvFv5V5CFXys51o23YjPK2n56kQegrqcahl k0oA== X-Gm-Message-State: AMCzsaUUqTKw8s16zuyedyLdQ4P9lYeTcIO9qwEVxp8BAfoHiKttcjbg wxQeV9Xx9hEWyqJ62f7M6uP9teLm X-Google-Smtp-Source: ABhQp+QL+pRqFv+d2GJxrQaR+rNnDzJkvQsM9WRNZ0YpeOifjj2YQcKA0lto3wY6iWdaOb8OzhcdDg== X-Received: by 10.28.180.2 with SMTP id d2mr1045586wmf.118.1508923620655; Wed, 25 Oct 2017 02:27:00 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id q7sm2009311wrg.97.2017.10.25.02.26.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:26:59 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 11:26:49 +0200 Message-Id: <1508923609-2022-5-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> References: <1508923609-2022-1-git-send-email-angelo.compagnucci@gmail.com> Cc: christian@paral.in Subject: [Buildroot] [RFC v5 5/5] package/docker-containerd: converting to golang infrastructure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch converts the docker-containerd package to the new golang infrastructure. Signed-off-by: Angelo Compagnucci --- package/docker-containerd/docker-containerd.mk | 37 +++++++++++--------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk index ffbadb0..34e7674 100644 --- a/package/docker-containerd/docker-containerd.mk +++ b/package/docker-containerd/docker-containerd.mk @@ -9,39 +9,32 @@ 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_GOPATH = 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_GO_LDFLAGS = \ -X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION) -ifeq ($(BR2_STATIC_LIBS),y) -DOCKER_CONTAINERD_GLDFLAGS += -extldflags '-static' -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 +define DOCKER_CONTAINERD_LINK_DIR + ln -sf $(@D) $(@D)/$(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd + mkdir -p $(@D)/$(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers + ln -s $(RUNC_SRCDIR) $(@D)/$(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc endef +DOCKER_CONTAINERD_POST_CONFIGURE_HOOKS += DOCKER_CONTAINERD_LINK_DIR + 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)) + cd $(@D)/$(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd; \ + $(DOCKER_CONTAINERD_GO_ENV) \ + $(DOCKER_CONTAINERD_GO) \ + $(DOCKER_CONTAINERD_BUILD_OPTS) ./$(d)$(sep)) endef define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS 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 + $(INSTALL) -D -m 0755 $(@D)/$(DOCKER_CONTAINERD_BINDIR)/containerd $(TARGET_DIR)/usr/bin/docker-containerd + $(INSTALL) -D -m 0755 $(@D)/$(DOCKER_CONTAINERD_BINDIR)/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim ln -fs containerd-shim $(TARGET_DIR)/usr/bin/docker-containerd-shim endef -$(eval $(generic-package)) +$(eval $(golang-package))