All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anuj Mittal <anuj.mittal@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [honister][PATCH 15/24] go.bbclass: Allow adding parameters to go ldflags
Date: Wed,  3 Nov 2021 00:44:03 +0800	[thread overview]
Message-ID: <4c0c5edbb561f2bd21bba979ed7553fb3b717116.1635871270.git.anuj.mittal@intel.com> (raw)
In-Reply-To: <cover.1635871270.git.anuj.mittal@intel.com>

From: Ahmed Hossam <Ahmed.Hossam@opensynergy.com>

Currently, there is no clean way to pass extra parameters to the go tool link,
which is passed by the go build ldflags flag, the append needs to happen inside
the quotes of the ldflags parameter

See [YOCTO #14554].

Add a variable to allow adding extra parameters to -ldflags in the GO_LDFLAGS
variable, one of the main usecases is setting the application version.

For example, adding to the recipe something like
GO_EXTRA_LDFLAGS="-X main.Version=v1.0.0"
or
GO_EXTRA_LDFLAGS="-X main.Version=${PV}"

Signed-off-by: Ahmed Hossam <Ahmed.Hossam@opensynergy.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit eaa7a61dab9a1d7bb039f16abdd9aacb44faa595)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 meta/classes/go.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 0dd0c5f1d2..aa54b4a08c 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -41,7 +41,8 @@ GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS
 GO_LINKMODE ?= ""
 GO_LINKMODE:class-nativesdk = "--linkmode=external"
 GO_LINKMODE:class-native = "--linkmode=external"
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"'
+GO_EXTRA_LDFLAGS ?= ""
+GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
 export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
 export GOPATH_OMIT_IN_ACTIONID ?= "1"
 export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
-- 
2.31.1



  parent reply	other threads:[~2021-11-02 16:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 16:43 [honister][PATCH 00/24] Review request Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 01/24] python3-setuptools: _distutils/sysconfig fix Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 02/24] waffle: convert to git, website is down Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 03/24] strace: show test suite log on failure Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 04/24] classes/populate_sdk_base: Add setscene tasks Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 05/24] staging: Fix autoconf-native rebuild failure Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 06/24] linux-yocto/5.10: update to v5.10.73 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 07/24] linux-yocto/5.14: update to v5.14.12 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 08/24] linux-yocto/5.14: update to v5.14.13 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 09/24] linux-yocto/5.10: update to v5.10.74 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 10/24] linux-yocto/5.14: common-pc: enable CONFIG_ATA_PIIX as built-in Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 11/24] linux-yocto/5.14: update to v5.14.14 Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 12/24] linux-yocto/5.10: update to v5.10.75 Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 13/24] meson: move lang args to the right section Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 14/24] meson: install native file in sdk Anuj Mittal
2021-11-02 16:44 ` Anuj Mittal [this message]
2021-11-02 16:44 ` [honister][PATCH 16/24] stress-ng: convert to git, website is down Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 17/24] tzdata: upgrade 2021a -> 2021d Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 18/24] tzdata: update 2021d -> 2021e Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 19/24] spdx.py: Add annotation to relationship Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 20/24] create-spdx: add create_annotation function Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 21/24] create-spdx: cross recipes are native also Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 22/24] oeqa/runtime/parselogs: modified drm error in common errors list Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 23/24] meson.bblcass: Remove empty egg-info directories before running meson Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 24/24] qemu.inc: " Anuj Mittal

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=4c0c5edbb561f2bd21bba979ed7553fb3b717116.1635871270.git.anuj.mittal@intel.com \
    --to=anuj.mittal@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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.