diff options
Diffstat (limited to 'recipes-containers/nerdctl/nerdctl_git.bb')
| -rw-r--r-- | recipes-containers/nerdctl/nerdctl_git.bb | 57 |
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 | 12 | SRCREV_FORMAT = "nerdcli" |
| 13 | SRCREV_FORMAT = "nerdcli_cgroups" | ||
| 14 | SRCREV_nerdcli = "497c7cf74d09bf1ddf2678382360ca61e6faebac" | 13 | SRCREV_nerdcli = "497c7cf74d09bf1ddf2678382360ca61e6faebac" |
| 15 | 14 | ||
| 16 | SRC_URI = "git://github.com/containerd/nerdctl.git;name=nerdcli;branch=main;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}" | 15 | SRC_URI = "git://github.com/containerd/nerdctl.git;name=nerdcli;branch=main;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}" |
| 17 | 16 | ||
| 18 | include src_uri.inc | 17 | include go-mod-git.inc |
| 18 | include go-mod-cache.inc | ||
| 19 | 19 | ||
| 20 | # patches and config | 20 | # patches |
| 21 | SRC_URI += " \ | 21 | SRC_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 | ||
| 26 | LICENSE = "Apache-2.0" | 25 | LICENSE = "Apache-2.0" |
| @@ -32,8 +31,14 @@ PV = "v2.0.3" | |||
| 32 | 31 | ||
| 33 | NERDCTL_PKG = "github.com/containerd/nerdctl" | 32 | NERDCTL_PKG = "github.com/containerd/nerdctl" |
| 34 | 33 | ||
| 34 | # go-mod-discovery configuration | ||
| 35 | GO_MOD_DISCOVERY_BUILD_TARGET = "./cmd/nerdctl" | ||
| 36 | GO_MOD_DISCOVERY_GIT_REPO = "https://github.com/containerd/nerdctl.git" | ||
| 37 | GO_MOD_DISCOVERY_GIT_REF = "${SRCREV_nerdcli}" | ||
| 38 | |||
| 35 | inherit go goarch | 39 | inherit go goarch |
| 36 | inherit systemd pkgconfig | 40 | inherit systemd pkgconfig |
| 41 | inherit go-mod-discovery | ||
| 37 | 42 | ||
| 38 | do_configure[noexec] = "1" | 43 | do_configure[noexec] = "1" |
| 39 | 44 | ||
| @@ -45,32 +50,24 @@ EXTRA_OEMAKE = " \ | |||
| 45 | 50 | ||
| 46 | PACKAGECONFIG ?= "" | 51 | PACKAGECONFIG ?= "" |
| 47 | 52 | ||
| 48 | # sets the "sites" variable. | ||
| 49 | include relocation.inc | ||
| 50 | |||
| 51 | PIEFLAG = "${@bb.utils.contains('GOBUILDFLAGS', '-buildmode=pie', '-buildmode=pie', '', d)}" | ||
| 52 | |||
| 53 | do_compile() { | 53 | do_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 | ||
| 76 | do_install() { | 73 | do_install() { |
