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.

274 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:=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
  81. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  82. endef
  83. define Package/lxc/config
  84. source "$(SOURCE)/Config.in"
  85. endef
  86. define Package/lxc/description
  87. LXC is the userspace control package for Linux Containers, a lightweight
  88. virtual system mechanism sometimes described as "chroot on steroids".
  89. endef
  90. define Package/lxc-common
  91. $(call Package/lxc/Default)
  92. TITLE:=LXC common files
  93. endef
  94. define Package/lxc-hooks
  95. $(call Package/lxc/Default)
  96. TITLE:=LXC virtual machine hooks
  97. endef
  98. define Package/lxc-templates
  99. $(call Package/lxc/Default)
  100. TITLE:=LXC virtual machine templates
  101. endef
  102. define Package/lxc-configs
  103. $(call Package/lxc/Default)
  104. TITLE:=LXC virtual machine common config files
  105. endef
  106. define Package/liblxc
  107. $(call Package/lxc/Default)
  108. SECTION:=libs
  109. CATEGORY:=Libraries
  110. TITLE:=LXC userspace library
  111. DEPENDS+= +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
  112. endef
  113. define Package/lxc-init
  114. $(call Package/lxc/Default)
  115. TITLE:=LXC Lua bindings
  116. DEPENDS+= +liblxc
  117. endef
  118. ifdef CONFIG_USE_MIPS16
  119. TARGET_CFLAGS += -minterlink-mips16
  120. endif
  121. TARGET_LDFLAGS += -lgcc_eh
  122. define Build/InstallDev
  123. $(INSTALL_DIR) $(1)/usr/include/lxc/
  124. $(CP) \
  125. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  126. $(1)/usr/include/lxc/
  127. $(INSTALL_DIR) $(1)/usr/lib
  128. $(CP) \
  129. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  130. $(1)/usr/lib/
  131. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  132. $(CP) \
  133. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  134. $(1)/usr/lib/pkgconfig/
  135. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  136. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  137. endef
  138. define Package/lxc/install
  139. true
  140. endef
  141. define Package/lxc-auto/install
  142. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  143. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  144. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  145. endef
  146. define Package/lxc-common/conffiles
  147. /etc/lxc/default.conf
  148. /etc/lxc/lxc.conf
  149. endef
  150. define Package/lxc-common/install
  151. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  152. $(CP) \
  153. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  154. $(1)/usr/lib/lxc/rootfs/
  155. $(INSTALL_DIR) $(1)/usr/share/lxc
  156. $(CP) \
  157. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  158. $(1)/usr/share/lxc/
  159. $(INSTALL_DIR) $(1)/etc/lxc/
  160. $(CP) \
  161. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  162. $(1)/etc/lxc/default.conf
  163. $(INSTALL_DIR) $(1)/etc/lxc/
  164. $(CP) \
  165. ./files/lxc.conf \
  166. $(1)/etc/lxc/lxc.conf
  167. $(INSTALL_DIR) $(1)/srv/lxc/
  168. endef
  169. define Package/lxc-hooks/install
  170. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  171. $(CP) \
  172. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  173. $(1)/usr/share/lxc/hooks/
  174. endef
  175. define Package/lxc-templates/install
  176. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  177. $(CP) \
  178. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  179. $(1)/usr/share/lxc/templates/
  180. endef
  181. define Package/lxc-configs/install
  182. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  183. $(CP) \
  184. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  185. $(1)/usr/share/lxc/config/
  186. endef
  187. define Package/liblxc/install
  188. $(INSTALL_DIR) $(1)/usr/lib/
  189. $(CP) \
  190. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  191. $(1)/usr/lib/
  192. endef
  193. define Package/lxc-init/install
  194. $(INSTALL_DIR) $(1)/sbin
  195. $(CP) \
  196. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  197. $(1)/sbin/
  198. endef
  199. define GenPlugin
  200. define Package/lxc-$(1)
  201. $(call Package/lxc/Default)
  202. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  203. DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
  204. endef
  205. define Package/lxc-$(1)/install
  206. $(INSTALL_DIR) $$(1)$(3)
  207. $(INSTALL_BIN) \
  208. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  209. $$(1)$(3)/
  210. endef
  211. $$(eval $$(call BuildPackage,lxc-$(1)))
  212. endef
  213. $(eval $(call BuildPackage,lxc))
  214. $(eval $(call BuildPackage,lxc-common))
  215. $(eval $(call BuildPackage,lxc-hooks))
  216. $(eval $(call BuildPackage,lxc-configs))
  217. $(eval $(call BuildPackage,lxc-templates))
  218. $(eval $(call BuildPackage,liblxc))
  219. $(eval $(call BuildPackage,lxc-init))
  220. $(eval $(call BuildPackage,lxc-auto))
  221. $(eval $(call BuildPackage,lxc-unprivileged))
  222. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  223. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/libexec/lxc")))
  224. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))