From: Changqing Li <[email protected]>

Using GO_EXTRA_LDFLAGS to set BuildVersion, pass another -ldflags will
overrides -ldflags set in GOBUILDFLAGS(set in go.bbclass)

Signed-off-by: Changqing Li <[email protected]>
---
 recipes-networking/cni/cni_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/recipes-networking/cni/cni_git.bb 
b/recipes-networking/cni/cni_git.bb
index 88f9b483..ca7b17a2 100644
--- a/recipes-networking/cni/cni_git.bb
+++ b/recipes-networking/cni/cni_git.bb
@@ -55,6 +55,8 @@ BB_GIT_SHALLOW = "1"
 # https://github.com/llvm/llvm-project/issues/53999
 TOOLCHAIN = "gcc"
 
+GO_EXTRA_LDFLAGS += '-X 
github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${CNI_VERSION}'
+
 do_compile() {
        mkdir -p ${S}/src/github.com/containernetworking
        ln -sfr ${S}/src/import ${S}/src/github.com/containernetworking/cni
@@ -91,7 +93,7 @@ do_compile() {
        for p in $PLUGINS; do
            plugin="$(basename "$p")"
            echo "building: $p"
-           ${GO} build -trimpath ${GOBUILDFLAGS} -ldflags '-X 
github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${CNI_VERSION}'
 -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
+           ${GO} build -trimpath ${GOBUILDFLAGS} -o ${B}/plugins/bin/$plugin 
github.com/containernetworking/plugins/$p
        done
 
        # Build flannel separately - it's from flannel-io/cni-plugin repo with 
its own module
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9539): 
https://lists.yoctoproject.org/g/meta-virtualization/message/9539
Mute This Topic: https://lists.yoctoproject.org/mt/117148696/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to