You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
5.2 KiB

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