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.

154 lines
4.6 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=dockerd
  3. PKG_VERSION:=20.10.11
  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:=6fa7835bf7c17c293621967bd5096642fa1e3e1b597fbc7d7bd35f455d886495
  12. PKG_GIT_SHORT_COMMIT:=847da18 # 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) +btrfs-progs +ca-certificates +containerd +libdevmapper +libnetwork +tini \
  29. +KERNEL_SECCOMP:libseccomp +iptables-mod-extra +kmod-br-netfilter +kmod-ikconfig +kmod-nf-conntrack-netlink +kmod-nf-ipvs \
  30. +kmod-nf-nat +kmod-veth
  31. USERID:=docker:docker
  32. MENU:=1
  33. endef
  34. define Package/dockerd/conffiles
  35. /etc/config/dockerd
  36. endef
  37. define Package/dockerd/description
  38. The Docker CE Engine.
  39. endef
  40. GO_PKG_BUILD_VARS += GO111MODULE=auto
  41. TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
  42. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  43. # $(1) = path to dependent package 'Makefile'
  44. # $(2) = relevant dependency '.installer' file
  45. define EnsureVendoredVersion
  46. ( \
  47. DEP_VER=$$$$( grep --only-matching --perl-regexp '(?<=PKG_SOURCE_VERSION:=)(.*)' "$(1)" ); \
  48. VEN_VER=$$$$( grep --only-matching --perl-regexp '(?<=_COMMIT:=)(.*)(?=})' "$(PKG_BUILD_DIR)/hack/dockerfile/install/$(2)" ); \
  49. if [ "$$$${VEN_VER}" != "$$$${DEP_VER}" ]; then \
  50. echo "ERROR: Expected 'PKG_SOURCE_VERSION:=$$$${VEN_VER}' in '$(1)', found 'PKG_SOURCE_VERSION:=$$$${DEP_VER}'"; \
  51. exit 1; \
  52. fi \
  53. )
  54. endef
  55. define Build/Prepare
  56. $(Build/Prepare/Default)
  57. # Verify dependencies are the vendored version
  58. $(call EnsureVendoredVersion,../containerd/Makefile,containerd.installer)
  59. $(call EnsureVendoredVersion,../libnetwork/Makefile,proxy.installer)
  60. $(call EnsureVendoredVersion,../runc/Makefile,runc.installer)
  61. $(call EnsureVendoredVersion,../tini/Makefile,tini.installer)
  62. # Verify CLI is the same version
  63. ( \
  64. CLI_MAKEFILE="../docker/Makefile"; \
  65. CLI_VERSION=$$$$( grep --only-matching --perl-regexp '(?<=PKG_VERSION:=)(.*)' "$$$${CLI_MAKEFILE}" ); \
  66. if [ "$$$${CLI_VERSION}" != "$(PKG_VERSION)" ]; then \
  67. echo "ERROR: Expected 'PKG_VERSION:=$(PKG_VERSION)' in '$$$${CLI_MAKEFILE}', found 'PKG_VERSION:=$$$${CLI_VERSION}'"; \
  68. exit 1; \
  69. fi \
  70. )
  71. # Verify PKG_GIT_SHORT_COMMIT
  72. ( \
  73. 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)' ); \
  74. if [ "$$$${EXPECTED_PKG_GIT_SHORT_COMMIT}" != "$(strip $(PKG_GIT_SHORT_COMMIT))" ]; then \
  75. echo "ERROR: Expected 'PKG_GIT_SHORT_COMMIT:=$$$${EXPECTED_PKG_GIT_SHORT_COMMIT}', found 'PKG_GIT_SHORT_COMMIT:=$(strip $(PKG_GIT_SHORT_COMMIT))'"; \
  76. exit 1; \
  77. fi \
  78. )
  79. endef
  80. BUILDTAGS:=
  81. ifeq ($(KERNEL_SECCOMP),y)
  82. BUILDTAGS += seccomp
  83. endif
  84. ifeq ($(CONFIG_SELINUX),y)
  85. BUILDTAGS += selinux
  86. endif
  87. define Build/Compile
  88. ( \
  89. cd $(PKG_BUILD_DIR); \
  90. $(GO_PKG_VARS) \
  91. DOCKER_GITCOMMIT=$(PKG_GIT_SHORT_COMMIT) \
  92. DOCKER_BUILDTAGS='$(BUILDTAGS)' \
  93. VERSION=$(PKG_VERSION) \
  94. ./hack/make.sh binary; \
  95. )
  96. endef
  97. define Package/dockerd/install
  98. $(INSTALL_DIR) $(1)/usr/bin/
  99. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bundles/binary-daemon/dockerd $(1)/usr/bin/
  100. $(INSTALL_DIR) $(1)/opt/docker/
  101. $(INSTALL_DIR) $(1)/usr/share/docker/
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/check-config.sh $(1)/usr/share/docker/
  103. $(INSTALL_DIR) $(1)/etc/init.d
  104. $(INSTALL_BIN) ./files/dockerd.init $(1)/etc/init.d/dockerd
  105. $(INSTALL_DIR) $(1)/etc/config
  106. $(INSTALL_CONF) ./files/etc/config/dockerd $(1)/etc/config/dockerd
  107. # Must be after systcl 11-br-netfilter.conf from kmod-br-netfilter
  108. $(INSTALL_DIR) $(1)/etc/sysctl.d
  109. $(INSTALL_DATA) ./files/etc/sysctl.d/sysctl-br-netfilter-ip.conf \
  110. $(1)/etc/sysctl.d/12-br-netfilter-ip.conf
  111. endef
  112. define Package/dockerd/postinst
  113. #!/bin/sh
  114. [ -n "$$IPKG_INSTROOT" ] || {
  115. /etc/init.d/dockerd enable
  116. /etc/init.d/dockerd uciadd
  117. /etc/init.d/dockerd start
  118. }
  119. endef
  120. define Package/dockerd/prerm
  121. #!/bin/sh
  122. [ -n "$$IPKG_INSTROOT" ] || {
  123. /etc/init.d/dockerd disable
  124. /etc/init.d/dockerd stop
  125. /etc/init.d/dockerd ucidel
  126. }
  127. endef
  128. $(eval $(call BuildPackage,dockerd))