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.

273 lines
6.6 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.2
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
  14. PKG_HASH:=ca336dcdf303fea5ff231d89a9b6278b061c4cffb14f0db0a71a15bdd95a5cb0
  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
  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/description
  50. LXC is the userspace control package for Linux Containers, a lightweight
  51. virtual system mechanism sometimes described as "chroot on steroids".
  52. This package adds an initscript for starting and stopping the containers
  53. on boot and shutdown.
  54. endef
  55. define Package/lxc-auto/conffiles
  56. /etc/config/lxc-auto
  57. endef
  58. define Package/lxc-unprivileged
  59. $(call Package/lxc/Default)
  60. TITLE:=Helper script for unprivileged containers support
  61. DEPENDS+=+shadow-utils +shadow-newuidmap +shadow-newgidmap
  62. endef
  63. define Package/lxc-unprivileged/description
  64. Support for unprivileged containers requires newuidmap and newguidmap.
  65. This package makes sure they are available & have correct permissions.
  66. endef
  67. define Package/lxc-unprivileged/install
  68. $(INSTALL_DIR) $(1)/etc/uci-defaults
  69. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  70. endef
  71. define Package/lxc/config
  72. source "$(SOURCE)/Config.in"
  73. endef
  74. define Package/lxc/description
  75. LXC is the userspace control package for Linux Containers, a lightweight
  76. virtual system mechanism sometimes described as "chroot on steroids".
  77. endef
  78. define Package/lxc-common
  79. $(call Package/lxc/Default)
  80. TITLE:=LXC common files
  81. endef
  82. define Package/lxc-hooks
  83. $(call Package/lxc/Default)
  84. TITLE:=LXC virtual machine hooks
  85. endef
  86. define Package/lxc-templates
  87. $(call Package/lxc/Default)
  88. TITLE:=LXC virtual machine templates
  89. endef
  90. define Package/lxc-configs
  91. $(call Package/lxc/Default)
  92. TITLE:=LXC virtual machine common config files
  93. endef
  94. define Package/liblxc
  95. $(call Package/lxc/Default)
  96. SECTION:=libs
  97. CATEGORY:=Libraries
  98. TITLE:=LXC userspace library
  99. DEPENDS+= +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
  100. endef
  101. define Package/lxc-init
  102. $(call Package/lxc/Default)
  103. TITLE:=LXC Lua bindings
  104. DEPENDS+= +liblxc
  105. endef
  106. CONFIGURE_ARGS += \
  107. --disable-werror \
  108. --disable-rpath \
  109. --disable-doc \
  110. --disable-api-docs \
  111. --disable-apparmor \
  112. --disable-selinux \
  113. --$(if $(CONFIG_LXC_SECCOMP),en,dis)able-seccomp \
  114. --enable-capabilities \
  115. --disable-examples
  116. ifdef CONFIG_USE_MIPS16
  117. TARGET_CFLAGS += -minterlink-mips16
  118. endif
  119. TARGET_LDFLAGS += -lgcc_eh
  120. define Build/InstallDev
  121. $(INSTALL_DIR) $(1)/usr/include/lxc/
  122. $(CP) \
  123. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  124. $(1)/usr/include/lxc/
  125. $(INSTALL_DIR) $(1)/usr/lib
  126. $(CP) \
  127. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  128. $(1)/usr/lib/
  129. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  130. $(CP) \
  131. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  132. $(1)/usr/lib/pkgconfig/
  133. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  134. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  135. endef
  136. define Package/lxc/install
  137. true
  138. endef
  139. define Package/lxc-auto/install
  140. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  141. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  142. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  143. endef
  144. define Package/lxc-common/conffiles
  145. /etc/lxc/default.conf
  146. /etc/lxc/lxc.conf
  147. endef
  148. define Package/lxc-common/install
  149. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  150. $(CP) \
  151. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  152. $(1)/usr/lib/lxc/rootfs/
  153. $(INSTALL_DIR) $(1)/usr/share/lxc
  154. $(CP) \
  155. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  156. $(1)/usr/share/lxc/
  157. $(INSTALL_DIR) $(1)/etc/lxc/
  158. $(CP) \
  159. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  160. $(1)/etc/lxc/default.conf
  161. $(INSTALL_DIR) $(1)/etc/lxc/
  162. $(CP) \
  163. ./files/lxc.conf \
  164. $(1)/etc/lxc/lxc.conf
  165. $(INSTALL_DIR) $(1)/srv/lxc/
  166. endef
  167. define Package/lxc-hooks/install
  168. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  169. $(CP) \
  170. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  171. $(1)/usr/share/lxc/hooks/
  172. endef
  173. define Package/lxc-templates/install
  174. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  175. $(CP) \
  176. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  177. $(1)/usr/share/lxc/templates/
  178. endef
  179. define Package/lxc-configs/install
  180. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  181. $(CP) \
  182. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  183. $(1)/usr/share/lxc/config/
  184. endef
  185. define Package/liblxc/install
  186. $(INSTALL_DIR) $(1)/usr/lib/
  187. $(CP) \
  188. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  189. $(1)/usr/lib/
  190. endef
  191. define Package/lxc-init/install
  192. $(INSTALL_DIR) $(1)/sbin
  193. $(CP) \
  194. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  195. $(1)/sbin/
  196. endef
  197. define GenPlugin
  198. define Package/lxc-$(1)
  199. $(call Package/lxc/Default)
  200. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  201. DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
  202. endef
  203. define Package/lxc-$(1)/install
  204. $(INSTALL_DIR) $$(1)$(3)
  205. $(INSTALL_BIN) \
  206. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  207. $$(1)$(3)/
  208. endef
  209. $$(eval $$(call BuildPackage,lxc-$(1)))
  210. endef
  211. $(eval $(call BuildPackage,lxc))
  212. $(eval $(call BuildPackage,lxc-common))
  213. $(eval $(call BuildPackage,lxc-hooks))
  214. $(eval $(call BuildPackage,lxc-configs))
  215. $(eval $(call BuildPackage,lxc-templates))
  216. $(eval $(call BuildPackage,liblxc))
  217. $(eval $(call BuildPackage,lxc-init))
  218. $(eval $(call BuildPackage,lxc-auto))
  219. $(eval $(call BuildPackage,lxc-unprivileged))
  220. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  221. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  222. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))