aboutsummaryrefslogtreecommitdiff
path: root/package/docker-containerd/docker-containerd.mk
blob: b1acd441058701ae826a0a4f48b8fd77d6f30e7b (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
################################################################################
#
# docker-containerd
#
################################################################################

DOCKER_CONTAINERD_VERSION = 0ac3cd1be170d180b2baed755e8f0da547ceb267
DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VERSION))
DOCKER_CONTAINERD_LICENSE = Apache-2.0
DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code

DOCKER_CONTAINERD_DEPENDENCIES = host-go

DOCKER_CONTAINERD_GOPATH = "$(@D)/vendor"
DOCKER_CONTAINERD_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
	CGO_ENABLED=1 \
	GOBIN="$(@D)/bin" \
	GOPATH="$(DOCKER_CONTAINERD_GOPATH)"

DOCKER_CONTAINERD_GLDFLAGS = \
	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION) \
	-extldflags '-static'

define DOCKER_CONTAINERD_CONFIGURE_CMDS
	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers
	ln -s $(RUNC_SRCDIR) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc
endef

define DOCKER_CONTAINERD_BUILD_CMDS
	$(foreach d,ctr containerd containerd-shim,\
		cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build \
			-v -o $(@D)/bin/$(d) -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./$(d)$(sep))
endef

define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
	ln -fs containerd-shim $(TARGET_DIR)/usr/bin/docker-containerd-shim
endef

$(eval $(generic-package))