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/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-auto/postinst
  145. [ "$${PKG_UPGRADE}" = "0" ] && /etc/init.d/lxc-auto boot
  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")))