libgd: avoid recursive and redundant dependencies
[feed/packages.git] / utils / dockerd / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=dockerd
4 PKG_VERSION:=20.10.17
5 PKG_RELEASE:=$(AUTORELEASE)
6 PKG_LICENSE:=Apache-2.0
7 PKG_LICENSE_FILES:=LICENSE
8
9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
10 PKG_GIT_URL:=github.com/moby/moby
11 PKG_GIT_REF:=v$(PKG_VERSION)
12 PKG_SOURCE_URL:=https://codeload.$(PKG_GIT_URL)/tar.gz/$(PKG_GIT_REF)?
13 PKG_HASH:=061cf8579aa3c813c353c80fa480744e2f6cca2e6392f546bd0942a6a10c7a14
14 PKG_GIT_SHORT_COMMIT:=a89b842 # SHA1 used within the docker executables
15
16 PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
17
18 PKG_BUILD_DEPENDS:=golang/host
19 PKG_BUILD_PARALLEL:=1
20 PKG_USE_MIPS16:=0
21
22 GO_PKG:=github.com/docker/docker
23
24 include $(INCLUDE_DIR)/package.mk
25 include ../../lang/golang/golang-package.mk
26
27 define Package/dockerd/config
28 source "$(SOURCE)/Config.in"
29 endef
30
31 define Package/dockerd
32 SECTION:=utils
33 CATEGORY:=Utilities
34 TITLE:=Docker Community Edition Daemon
35 URL:=https://www.docker.com/
36 DEPENDS:=$(GO_ARCH_DEPENDS) \
37 +ca-certificates \
38 +containerd \
39 +iptables \
40 +iptables-mod-extra \
41 +IPV6:ip6tables \
42 +IPV6:kmod-ipt-nat6 \
43 +KERNEL_SECCOMP:libseccomp \
44 +kmod-ipt-nat \
45 +kmod-ipt-physdev \
46 +kmod-nf-ipvs \
47 +kmod-veth \
48 +libnetwork \
49 +tini \
50 +uci-firewall
51 USERID:=docker:docker
52 MENU:=1
53 endef
54
55 define Package/dockerd/conffiles
56 /etc/config/dockerd
57 endef
58
59 define Package/dockerd/description
60 The Docker CE Engine.
61 endef
62
63 GO_PKG_BUILD_VARS += GO111MODULE=auto
64 TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
65 TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
66 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lc -lgcc_eh)
67
68 # $(1) = path to dependent package 'Makefile'
69 # $(2) = relevant dependency '.installer' file
70 define EnsureVendoredVersion
71 ( \
72 DEP_VER=$$$$( grep --only-matching --perl-regexp '(?<=PKG_VERSION:=)(.*)' "$(1)" ); \
73 VEN_VER=$$$$( grep --only-matching --perl-regexp '(?<=_VERSION:=v)(.*)(?=})' "$(PKG_BUILD_DIR)/hack/dockerfile/install/$(2)" ); \
74 if [ "$$$${VEN_VER}" != "$$$${DEP_VER}" ]; then \
75 echo "ERROR: Expected 'PKG_VERSION:=$$$${VEN_VER}' in '$(1)', found 'PKG_VERSION:=$$$${DEP_VER}'"; \
76 exit 1; \
77 fi \
78 )
79 endef
80
81 # $(1) = path to dependent package 'Makefile'
82 # $(2) = relevant dependency '.installer' file
83 define EnsureVendoredCommit
84 ( \
85 DEP_VER=$$$$( grep --only-matching --perl-regexp '(?<=PKG_SOURCE_VERSION:=)(.*)' "$(1)" ); \
86 VEN_VER=$$$$( grep --only-matching --perl-regexp '(?<=_COMMIT:=)(.*)(?=})' "$(PKG_BUILD_DIR)/hack/dockerfile/install/$(2)" ); \
87 if [ "$$$${VEN_VER}" != "$$$${DEP_VER}" ]; then \
88 echo "ERROR: Expected 'PKG_SOURCE_VERSION:=$$$${VEN_VER}' in '$(1)', found 'PKG_SOURCE_VERSION:=$$$${DEP_VER}'"; \
89 exit 1; \
90 fi \
91 )
92 endef
93
94 define Build/Prepare
95 $(Build/Prepare/Default)
96
97 # Verify dependencies are the vendored version
98 $(call EnsureVendoredVersion,../containerd/Makefile,containerd.installer)
99 $(call EnsureVendoredCommit,../libnetwork/Makefile,proxy.installer)
100 $(call EnsureVendoredVersion,../runc/Makefile,runc.installer)
101 $(call EnsureVendoredVersion,../tini/Makefile,tini.installer)
102
103 # Verify CLI is the same version
104 ( \
105 CLI_MAKEFILE="../docker/Makefile"; \
106 CLI_VERSION=$$$$( grep --only-matching --perl-regexp '(?<=PKG_VERSION:=)(.*)' "$$$${CLI_MAKEFILE}" ); \
107 if [ "$$$${CLI_VERSION}" != "$(PKG_VERSION)" ]; then \
108 echo "ERROR: Expected 'PKG_VERSION:=$(PKG_VERSION)' in '$$$${CLI_MAKEFILE}', found 'PKG_VERSION:=$$$${CLI_VERSION}'"; \
109 exit 1; \
110 fi \
111 )
112
113 # Verify PKG_GIT_SHORT_COMMIT
114 ( \
115 EXPECTED_PKG_GIT_SHORT_COMMIT=$$$$( $(CURDIR)/git-short-commit.sh '$(PKG_GIT_URL)' '$(PKG_GIT_REF)' '$(TMP_DIR)/git-short-commit/$(PKG_NAME)-$(PKG_VERSION)' ); \
116 if [ "$$$${EXPECTED_PKG_GIT_SHORT_COMMIT}" != "$(strip $(PKG_GIT_SHORT_COMMIT))" ]; then \
117 echo "ERROR: Expected 'PKG_GIT_SHORT_COMMIT:=$$$${EXPECTED_PKG_GIT_SHORT_COMMIT}', found 'PKG_GIT_SHORT_COMMIT:=$(strip $(PKG_GIT_SHORT_COMMIT))'"; \
118 exit 1; \
119 fi \
120 )
121 endef
122
123 BUILDTAGS:=
124 ifeq ($(KERNEL_SECCOMP),y)
125 BUILDTAGS += seccomp
126 endif
127 ifeq ($(CONFIG_SELINUX),y)
128 BUILDTAGS += selinux
129 endif
130
131 define Build/Compile
132 ( \
133 cd $(PKG_BUILD_DIR); \
134 $(GO_PKG_VARS) \
135 DOCKER_GITCOMMIT=$(PKG_GIT_SHORT_COMMIT) \
136 DOCKER_BUILDTAGS='$(BUILDTAGS)' \
137 VERSION=$(PKG_VERSION) \
138 ./hack/make.sh binary; \
139 )
140 endef
141
142 define Package/dockerd/install
143 $(INSTALL_DIR) $(1)/usr/bin/
144 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bundles/binary-daemon/dockerd $(1)/usr/bin/
145
146 $(INSTALL_DIR) $(1)/opt/docker/
147
148 ifeq ($(CONFIG_DOCKER_CHECK_CONFIG),y)
149 $(INSTALL_DIR) $(1)/usr/share/docker/
150 $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/check-config.sh $(1)/usr/share/docker/
151 endif
152
153 $(INSTALL_DIR) $(1)/etc/init.d
154 $(INSTALL_BIN) ./files/dockerd.init $(1)/etc/init.d/dockerd
155
156 $(INSTALL_DIR) $(1)/etc/config
157 $(INSTALL_CONF) ./files/etc/config/dockerd $(1)/etc/config/dockerd
158
159 # Must be after systcl 11-br-netfilter.conf from kmod-br-netfilter
160 $(INSTALL_DIR) $(1)/etc/sysctl.d
161 $(INSTALL_DATA) ./files/etc/sysctl.d/sysctl-br-netfilter-ip.conf \
162 $(1)/etc/sysctl.d/12-br-netfilter-ip.conf
163 endef
164
165 define Package/dockerd/postinst
166 #!/bin/sh
167 [ -n "$$IPKG_INSTROOT" ] || {
168 /etc/init.d/dockerd enable
169 /etc/init.d/dockerd uciadd
170 /etc/init.d/dockerd start
171 }
172 endef
173
174 define Package/dockerd/prerm
175 #!/bin/sh
176 [ -n "$$IPKG_INSTROOT" ] || {
177 /etc/init.d/dockerd disable
178 /etc/init.d/dockerd stop
179 /etc/init.d/dockerd ucidel
180 }
181 endef
182
183 $(eval $(call BuildPackage,dockerd))