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.9 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:=5.0.1
  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:=d8195423bb1e206f8521d24b6cde4789f043960c7cf065990a9cf741dcfd4222
  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_LICENSE_FILES:=COPYING LICENSE.GPL2 LICENSE.LGPL2.1
  18. PKG_USE_MIPS16:=0
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/meson.mk
  21. MESON_ARGS += \
  22. -Db_lto=$(if $(findstring mips,$(CONFIG_ARCH)),false,true) \
  23. -Dwerror=false \
  24. -Dinit-script=sysvinit \
  25. -Dman=false \
  26. -Dapparmor=false \
  27. -Dselinux=false \
  28. -Dseccomp=$(if $(CONFIG_LXC_SECCOMP),true,false) \
  29. -Dexamples=false \
  30. -Db_pie=true
  31. LXC_APPLETS_BIN += \
  32. attach autostart cgroup copy config console create destroy device \
  33. execute freeze info monitor snapshot start stop unfreeze unshare \
  34. usernsexec wait top ls
  35. LXC_APPLETS_LIB += \
  36. monitord user-nic
  37. LXC_SCRIPTS += \
  38. checkconfig
  39. DEPENDS_APPLETS = +libpthread +libcap +liblxc
  40. DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock +getopt
  41. define Package/lxc/Default
  42. SECTION:=utils
  43. CATEGORY:=Utilities
  44. TITLE:=LXC userspace tools
  45. URL:=https://linuxcontainers.org/
  46. DEPENDS:=lxc
  47. endef
  48. define Package/lxc
  49. $(call Package/lxc/Default)
  50. DEPENDS:=@!arc
  51. MENU:=1
  52. endef
  53. define Package/lxc-auto
  54. $(call Package/lxc/Default)
  55. TITLE:= (initscript)
  56. DEPENDS+=+lxc-start +lxc-stop
  57. endef
  58. define Package/lxc-auto/postinst
  59. [ -n "$${IPKG_INSTROOT}" ] || [ "$${PKG_UPGRADE}" = 1 ] || /etc/init.d/lxc-auto boot
  60. endef
  61. define Package/lxc-auto/description
  62. LXC is the userspace control package for Linux Containers, a lightweight
  63. virtual system mechanism sometimes described as "chroot on steroids".
  64. This package adds an initscript for starting and stopping the containers
  65. on boot and shutdown.
  66. endef
  67. define Package/lxc-auto/conffiles
  68. /etc/config/lxc-auto
  69. endef
  70. define Package/lxc-unprivileged
  71. $(call Package/lxc/Default)
  72. TITLE:=Helper script for unprivileged containers support
  73. DEPENDS+=+shadow-utils +shadow-newuidmap +shadow-newgidmap
  74. endef
  75. define Package/lxc-unprivileged/description
  76. Support for unprivileged containers requires newuidmap and newguidmap.
  77. This package makes sure they are available & have correct permissions.
  78. endef
  79. define Package/lxc-unprivileged/install
  80. $(INSTALL_DIR) $(1)/etc/uci-defaults $(1)/etc/init.d
  81. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  82. $(INSTALL_BIN) ./files/lxc-unprivileged.init $(1)/etc/init.d
  83. $(INSTALL_DATA) ./files/subuid $(1)/etc/subuid
  84. $(INSTALL_DATA) ./files/subgid $(1)/etc/subgid
  85. endef
  86. define Package/lxc/config
  87. source "$(SOURCE)/Config.in"
  88. endef
  89. define Package/lxc/description
  90. LXC is the userspace control package for Linux Containers, a lightweight
  91. virtual system mechanism sometimes described as "chroot on steroids".
  92. endef
  93. define Package/lxc-common
  94. $(call Package/lxc/Default)
  95. TITLE:=LXC common files
  96. endef
  97. define Package/lxc-hooks
  98. $(call Package/lxc/Default)
  99. TITLE:=LXC virtual machine hooks
  100. endef
  101. define Package/lxc-templates
  102. $(call Package/lxc/Default)
  103. TITLE:=LXC virtual machine templates
  104. endef
  105. define Package/lxc-configs
  106. $(call Package/lxc/Default)
  107. TITLE:=LXC virtual machine common config files
  108. endef
  109. define Package/liblxc
  110. $(call Package/lxc/Default)
  111. SECTION:=libs
  112. CATEGORY:=Libraries
  113. TITLE:=LXC userspace library
  114. DEPENDS+= +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
  115. endef
  116. define Package/lxc-init
  117. $(call Package/lxc/Default)
  118. TITLE:=LXC Lua bindings
  119. DEPENDS+= +liblxc
  120. endef
  121. ifdef CONFIG_USE_MIPS16
  122. TARGET_CFLAGS += -minterlink-mips16
  123. endif
  124. TARGET_LDFLAGS += -lgcc_eh
  125. define Build/InstallDev
  126. $(INSTALL_DIR) $(1)/usr/include/lxc/
  127. $(CP) \
  128. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  129. $(1)/usr/include/lxc/
  130. $(INSTALL_DIR) $(1)/usr/lib
  131. $(CP) \
  132. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  133. $(1)/usr/lib/
  134. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  135. $(CP) \
  136. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  137. $(1)/usr/lib/pkgconfig/
  138. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  139. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  140. endef
  141. define Package/lxc/install
  142. true
  143. endef
  144. define Package/lxc-auto/install
  145. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  146. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  147. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  148. endef
  149. define Package/lxc-common/conffiles
  150. /etc/lxc/default.conf
  151. /etc/lxc/lxc.conf
  152. endef
  153. define Package/lxc-common/install
  154. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  155. $(CP) \
  156. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  157. $(1)/usr/lib/lxc/rootfs/
  158. $(INSTALL_DIR) $(1)/usr/share/lxc
  159. $(CP) \
  160. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  161. $(1)/usr/share/lxc/
  162. $(INSTALL_DIR) $(1)/etc/lxc/
  163. $(CP) \
  164. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  165. $(1)/etc/lxc/default.conf
  166. $(INSTALL_DIR) $(1)/etc/lxc/
  167. $(CP) \
  168. ./files/lxc.conf \
  169. $(1)/etc/lxc/lxc.conf
  170. $(INSTALL_DIR) $(1)/srv/lxc/
  171. endef
  172. define Package/lxc-hooks/install
  173. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  174. $(CP) \
  175. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  176. $(1)/usr/share/lxc/hooks/
  177. endef
  178. define Package/lxc-templates/install
  179. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  180. $(CP) \
  181. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  182. $(1)/usr/share/lxc/templates/
  183. endef
  184. define Package/lxc-configs/install
  185. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  186. $(CP) \
  187. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  188. $(1)/usr/share/lxc/config/
  189. endef
  190. define Package/liblxc/install
  191. $(INSTALL_DIR) $(1)/usr/lib/
  192. $(CP) \
  193. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  194. $(1)/usr/lib/
  195. endef
  196. define Package/lxc-init/install
  197. $(INSTALL_DIR) $(1)/sbin
  198. $(CP) \
  199. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  200. $(1)/sbin/
  201. endef
  202. define GenPlugin
  203. define Package/lxc-$(1)
  204. $(call Package/lxc/Default)
  205. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  206. DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
  207. endef
  208. define Package/lxc-$(1)/install
  209. $(INSTALL_DIR) $$(1)$(3)
  210. $(INSTALL_BIN) \
  211. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  212. $$(1)$(3)/
  213. endef
  214. $$(eval $$(call BuildPackage,lxc-$(1)))
  215. endef
  216. $(eval $(call BuildPackage,lxc))
  217. $(eval $(call BuildPackage,lxc-common))
  218. $(eval $(call BuildPackage,lxc-hooks))
  219. $(eval $(call BuildPackage,lxc-configs))
  220. $(eval $(call BuildPackage,lxc-templates))
  221. $(eval $(call BuildPackage,liblxc))
  222. $(eval $(call BuildPackage,lxc-init))
  223. $(eval $(call BuildPackage,lxc-auto))
  224. $(eval $(call BuildPackage,lxc-unprivileged))
  225. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  226. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/libexec/lxc")))
  227. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))