summaryrefslogtreecommitdiffstats
path: root/recipes-containers/nerdctl/nerdctl_git.bb
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2025-12-05 22:08:00 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2025-12-08 20:57:44 -0500
commitb4dfb683a95398e89428311287d8a32583a75c6c (patch)
tree51e2741aade619d70d2ac4bb3490e6ed2b89d077 /recipes-containers/nerdctl/nerdctl_git.bb
parent43a9e53dee19c56b79188081ee8adf326d7ddcdb (diff)
downloadmeta-virtualization-b4dfb683a95398e89428311287d8a32583a75c6c.tar.gz
nerdctl: update to go-mod-vcs format
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/nerdctl/nerdctl_git.bb')
-rw-r--r--recipes-containers/nerdctl/nerdctl_git.bb57
1 files changed, 27 insertions, 30 deletions
diff --git a/recipes-containers/nerdctl/nerdctl_git.bb b/recipes-containers/nerdctl/nerdctl_git.bb
index 3f87e564..7c4d0156 100644
--- a/recipes-containers/nerdctl/nerdctl_git.bb
+++ b/recipes-containers/nerdctl/nerdctl_git.bb
@@ -9,18 +9,17 @@ DEPENDS = " \
9 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ 9 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
10" 10"
11 11
12# Specify the first two important SRCREVs as the format 12SRCREV_FORMAT = "nerdcli"
13SRCREV_FORMAT = "nerdcli_cgroups"
14SRCREV_nerdcli = "497c7cf74d09bf1ddf2678382360ca61e6faebac" 13SRCREV_nerdcli = "497c7cf74d09bf1ddf2678382360ca61e6faebac"
15 14
16SRC_URI = "git://github.com/containerd/nerdctl.git;name=nerdcli;branch=main;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}" 15SRC_URI = "git://github.com/containerd/nerdctl.git;name=nerdcli;branch=main;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}"
17 16
18include src_uri.inc 17include go-mod-git.inc
18include go-mod-cache.inc
19 19
20# patches and config 20# patches
21SRC_URI += " \ 21SRC_URI += " \
22 file://0001-Makefile-allow-external-specification-of-build-setti.patch \ 22 file://0001-Makefile-allow-external-specification-of-build-setti.patch \
23 file://modules.txt \
24 " 23 "
25 24
26LICENSE = "Apache-2.0" 25LICENSE = "Apache-2.0"
@@ -32,8 +31,14 @@ PV = "v2.0.3"
32 31
33NERDCTL_PKG = "github.com/containerd/nerdctl" 32NERDCTL_PKG = "github.com/containerd/nerdctl"
34 33
34# go-mod-discovery configuration
35GO_MOD_DISCOVERY_BUILD_TARGET = "./cmd/nerdctl"
36GO_MOD_DISCOVERY_GIT_REPO = "https://github.com/containerd/nerdctl.git"
37GO_MOD_DISCOVERY_GIT_REF = "${SRCREV_nerdcli}"
38
35inherit go goarch 39inherit go goarch
36inherit systemd pkgconfig 40inherit systemd pkgconfig
41inherit go-mod-discovery
37 42
38do_configure[noexec] = "1" 43do_configure[noexec] = "1"
39 44
@@ -45,32 +50,24 @@ EXTRA_OEMAKE = " \
45 50
46PACKAGECONFIG ?= "" 51PACKAGECONFIG ?= ""
47 52
48# sets the "sites" variable.
49include relocation.inc
50
51PIEFLAG = "${@bb.utils.contains('GOBUILDFLAGS', '-buildmode=pie', '-buildmode=pie', '', d)}"
52
53do_compile() { 53do_compile() {
54 54 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
55 cd ${S}/src/import 55 export GOMODCACHE="${S}/pkg/mod"
56 56 export CGO_ENABLED="1"
57 export GOPATH="$GOPATH:${S}/src/import/.gopath" 57 export GOSUMDB="off"
58 58 export GOTOOLCHAIN="local"
59 # Pass the needed cflags/ldflags so that cgo 59 export GOPROXY="off"
60 # can find the needed headers files and libraries 60
61 export GOARCH=${TARGET_GOARCH} 61 cd ${S}/src/import
62 export CGO_ENABLED="1" 62
63 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" 63 # Pass the needed cflags/ldflags so that cgo
64 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" 64 # can find the needed headers files and libraries
65 65 export GOARCH=${TARGET_GOARCH}
66 export GOFLAGS="-mod=vendor -trimpath ${PIEFLAG}" 66 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
67 67 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
68 # our copied .go files are to be used for the build 68
69 ln -sf vendor.copy vendor 69 # -trimpath removes build paths from the binary (required for reproducible builds)
70 # inform go that we know what we are doing 70 oe_runmake GO=${GO} BUILDTAGS="${BUILDTAGS}" GO_BUILD_FLAGS="-trimpath" binaries
71 cp ${UNPACKDIR}/modules.txt vendor/
72
73 oe_runmake GO=${GO} BUILDTAGS="${BUILDTAGS}" binaries
74} 71}
75 72
76do_install() { 73do_install() {