]> code.ossystems Code Review - openembedded-core.git/commit
go.bbclass: Allow adding parameters to go ldflags
authorAhmed Hossam <Ahmed.Hossam@opensynergy.com>
Tue, 26 Oct 2021 18:56:42 +0000 (20:56 +0200)
committerAnuj Mittal <anuj.mittal@intel.com>
Tue, 2 Nov 2021 16:40:35 +0000 (00:40 +0800)
commit4c0c5edbb561f2bd21bba979ed7553fb3b717116
tree6fa6484377eed3726bc3bbf7b9695375ad03fe92
parent2ea62c23bf9d37e46d3cd9aa7527c535994d4b77
go.bbclass: Allow adding parameters to go ldflags

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