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.

277 lines
6.7 KiB

  1. #
  2. # Copyright (C) 2013-2015 OpenWrt.org
  3. # Copyright (C) 2020 Sartura
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=lxc
  10. PKG_VERSION:=4.0.12
  11. PKG_RELEASE:=$(AUTORELEASE)
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
  14. PKG_HASH:=db242f8366fc63e8c7588bb2017b354173cf3c4b20abc18780debdc48b14d3ef
  15. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  16. PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause GPL-2.0
  17. PKG_FIXUP:=autoreconf
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. include $(INCLUDE_DIR)/package.mk
  22. LXC_APPLETS_BIN += \
  23. attach autostart cgroup copy config console create destroy device \
  24. execute freeze info monitor snapshot start stop unfreeze unshare \
  25. usernsexec wait top ls
  26. LXC_APPLETS_LIB += \
  27. monitord user-nic
  28. LXC_SCRIPTS += \
  29. checkconfig
  30. DEPENDS_APPLETS = +libpthread +libcap +liblxc
  31. DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock +getopt
  32. define Package/lxc/Default
  33. SECTION:=utils
  34. CATEGORY:=Utilities
  35. TITLE:=LXC userspace tools
  36. URL:=https://linuxcontainers.org/
  37. DEPENDS:=lxc
  38. endef
  39. define Package/lxc
  40. $(call Package/lxc/Default)
  41. DEPENDS:=@!arc
  42. MENU:=1
  43. endef
  44. define Package/lxc-auto
  45. $(call Package/lxc/Default)
  46. TITLE:= (initscript)
  47. DEPENDS+=+lxc-start +lxc-stop
  48. endef
  49. define Package/lxc-auto/postinst
  50. [ -n "$${IPKG_INSTROOT}" ] || [ "$${PKG_UPGRADE}" = 1 ] || /etc/init.d/lxc-auto boot
  51. endef
  52. define Package/lxc-auto/description
  53. LXC is the userspace control package for Linux Containers, a lightweight
  54. virtual system mechanism sometimes described as "chroot on steroids".
  55. This package adds an initscript for starting and stopping the containers
  56. on boot and shutdown.
  57. endef
  58. define Package/lxc-auto/conffiles
  59. /etc/config/lxc-auto
  60. endef
  61. define Package/lxc-unprivileged
  62. $(call Package/lxc/Default)
  63. TITLE:=Helper script for unprivileged containers support
  64. DEPENDS+=+shadow-utils +shadow-newuidmap +shadow-newgidmap
  65. endef
  66. define Package/lxc-unprivileged/description
  67. Support for unprivileged containers requires newuidmap and newguidmap.
  68. This package makes sure they are available & have correct permissions.
  69. endef
  70. define Package/lxc-unprivileged/install
  71. $(INSTALL_DIR) $(1)/etc/uci-defaults
  72. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  73. endef
  74. define Package/lxc/config
  75. source "$(SOURCE)/Config.in"
  76. endef
  77. define Package/lxc/description
  78. LXC is the userspace control package for Linux Containers, a lightweight
  79. virtual system mechanism sometimes described as "chroot on steroids".
  80. endef
  81. define Package/lxc-common
  82. $(call Package/lxc/Default)
  83. TITLE:=LXC common files
  84. endef
  85. define Package/lxc-hooks
  86. $(call Package/lxc/Default)
  87. TITLE:=LXC virtual machine hooks
  88. endef
  89. define Package/lxc-templates
  90. $(call Package/lxc/Default)
  91. TITLE:=LXC virtual machine templates
  92. endef
  93. define Package/lxc-configs
  94. $(call Package/lxc/Default)
  95. TITLE:=LXC virtual machine common config files
  96. endef
  97. define Package/liblxc
  98. $(call Package/lxc/Default)
  99. SECTION:=libs
  100. CATEGORY:=Libraries
  101. TITLE:=LXC userspace library
  102. DEPENDS+= +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
  103. endef
  104. define Package/lxc-init
  105. $(call Package/lxc/Default)
  106. TITLE:=LXC Lua bindings
  107. DEPENDS+= +liblxc
  108. endef
  109. CONFIGURE_ARGS += \
  110. --disable-werror \
  111. --disable-rpath \
  112. --disable-doc \
  113. --disable-api-docs \
  114. --disable-apparmor \
  115. --disable-selinux \
  116. --$(if $(CONFIG_LXC_SECCOMP),en,dis)able-seccomp \
  117. --enable-capabilities \
  118. --disable-examples
  119. ifdef CONFIG_USE_MIPS16
  120. TARGET_CFLAGS += -minterlink-mips16
  121. endif
  122. TARGET_LDFLAGS += -lgcc_eh
  123. define Build/InstallDev
  124. $(INSTALL_DIR) $(1)/usr/include/lxc/
  125. $(CP) \
  126. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  127. $(1)/usr/include/lxc/
  128. $(INSTALL_DIR) $(1)/usr/lib
  129. $(CP) \
  130. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  131. $(1)/usr/lib/
  132. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  133. $(CP) \
  134. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  135. $(1)/usr/lib/pkgconfig/
  136. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  137. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  138. endef
  139. define Package/lxc/install
  140. true
  141. endef
  142. define Package/lxc-auto/install
  143. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  144. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  145. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  146. endef
  147. define Package/lxc-common/conffiles
  148. /etc/lxc/default.conf
  149. /etc/lxc/lxc.conf
  150. endef
  151. define Package/lxc-common/install
  152. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  153. $(CP) \
  154. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  155. $(1)/usr/lib/lxc/rootfs/
  156. $(INSTALL_DIR) $(1)/usr/share/lxc
  157. $(CP) \
  158. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  159. $(1)/usr/share/lxc/
  160. $(INSTALL_DIR) $(1)/etc/lxc/
  161. $(CP) \
  162. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  163. $(1)/etc/lxc/default.conf
  164. $(INSTALL_DIR) $(1)/etc/lxc/
  165. $(CP) \
  166. ./files/lxc.conf \
  167. $(1)/etc/lxc/lxc.conf
  168. $(INSTALL_DIR) $(1)/srv/lxc/
  169. endef
  170. define Package/lxc-hooks/install
  171. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  172. $(CP) \
  173. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  174. $(1)/usr/share/lxc/hooks/
  175. endef
  176. define Package/lxc-templates/install
  177. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  178. $(CP) \
  179. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  180. $(1)/usr/share/lxc/templates/
  181. endef
  182. define Package/lxc-configs/install
  183. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  184. $(CP) \
  185. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  186. $(1)/usr/share/lxc/config/
  187. endef
  188. define Package/liblxc/install
  189. $(INSTALL_DIR) $(1)/usr/lib/
  190. $(CP) \
  191. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  192. $(1)/usr/lib/
  193. endef
  194. define Package/lxc-init/install
  195. $(INSTALL_DIR) $(1)/sbin
  196. $(CP) \
  197. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  198. $(1)/sbin/
  199. endef
  200. define GenPlugin
  201. define Package/lxc-$(1)
  202. $(call Package/lxc/Default)
  203. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  204. DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
  205. endef
  206. define Package/lxc-$(1)/install
  207. $(INSTALL_DIR) $$(1)$(3)
  208. $(INSTALL_BIN) \
  209. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  210. $$(1)$(3)/
  211. endef
  212. $$(eval $$(call BuildPackage,lxc-$(1)))
  213. endef
  214. $(eval $(call BuildPackage,lxc))
  215. $(eval $(call BuildPackage,lxc-common))
  216. $(eval $(call BuildPackage,lxc-hooks))
  217. $(eval $(call BuildPackage,lxc-configs))
  218. $(eval $(call BuildPackage,lxc-templates))
  219. $(eval $(call BuildPackage,liblxc))
  220. $(eval $(call BuildPackage,lxc-init))
  221. $(eval $(call BuildPackage,lxc-auto))
  222. $(eval $(call BuildPackage,lxc-unprivileged))
  223. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  224. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  225. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))