blob: d5e28e14897d60273454c2a3e166a087139b1cc4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
HOMEPAGE = "https://github.com/containerd/nerdctl"
SUMMARY = "Docker-compatible CLI for containerd"
DESCRIPTION = "nerdctl: Docker-compatible CLI for containerd \
"
DEPENDS = " \
go-md2man \
rsync-native \
${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
"
# Specify the first two important SRCREVs as the format
SRCREV_FORMAT="nerdcli_cgroups"
SRCREV_nerdcli = "e084a2df4a8861eb5f0b0d32df0643ef24b81093"
SRC_URI = "git://github.com/containerd/nerdctl.git;name=nerdcli;branch=master;protocol=https"
include src_uri.inc
# patches and config
SRC_URI += "file://0001-Makefile-allow-external-specification-of-build-setti.patch \
file://modules.txt \
"
SRC_URI[sha256sum] = "d7b05a9bff34dfb25abe7e5b1e54cf2607f953d91cb33fb231a4775a1a4afa3d"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
GO_IMPORT = "import"
# S = "${WORKDIR}/git"
PV = "v0.22.2"
NERDCTL_PKG = "github.com/containerd/nerdctl"
inherit go goarch
inherit systemd pkgconfig
do_configure[noexec] = "1"
EXTRA_OEMAKE = " \
PREFIX=${prefix} BINDIR=${bindir} LIBEXECDIR=${libexecdir} \
ETCDIR=${sysconfdir} TMPFILESDIR=${nonarch_libdir}/tmpfiles.d \
SYSTEMDDIR=${systemd_unitdir}/system USERSYSTEMDDIR=${systemd_unitdir}/user \
"
PACKAGECONFIG ?= ""
# sets the "sites" variable.
include relocation.inc
do_compile() {
cd ${S}/src/import
export GOPATH="$GOPATH:${S}/src/import/.gopath"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
export GOARCH=${TARGET_GOARCH}
export CGO_ENABLED="1"
export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export GOFLAGS="-mod=vendor"
# this moves all the fetches into the proper vendor structure
# expected for build
for s in ${sites}; do
site_dest=$(echo $s | cut -d: -f1)
site_source=$(echo $s | cut -d: -f2)
mkdir -p vendor.copy/$site_dest
[ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ] && { echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)" ; true ; } || { echo "[INFO] $site_dest: copying .go files" ; rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest ; }
done
# our copied .go files are to be used for the build
ln -sf vendor.copy vendor
# inform go that we know what we are doing
cp ${WORKDIR}/modules.txt vendor/
oe_runmake GO=${GO} BUILDTAGS="${BUILDTAGS}" binaries
}
do_install() {
install -d "${D}${BIN_PREFIX}/bin"
install -m 755 "${S}/src/import/_output/nerdctl" "${D}${BIN_PREFIX}/bin"
}
INHIBIT_PACKAGE_STRIP = "1"
INSANE_SKIP:${PN} += "ldflags already-stripped"
|