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.

271 lines
6.5 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:=2
  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. TARGET_CFLAGS += -minterlink-mips16
  117. TARGET_LDFLAGS += -lgcc_eh
  118. define Build/InstallDev
  119. $(INSTALL_DIR) $(1)/usr/include/lxc/
  120. $(CP) \
  121. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  122. $(1)/usr/include/lxc/
  123. $(INSTALL_DIR) $(1)/usr/lib
  124. $(CP) \
  125. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  126. $(1)/usr/lib/
  127. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  128. $(CP) \
  129. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  130. $(1)/usr/lib/pkgconfig/
  131. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  132. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  133. endef
  134. define Package/lxc/install
  135. true
  136. endef
  137. define Package/lxc-auto/install
  138. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  139. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  140. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  141. endef
  142. define Package/lxc-common/conffiles
  143. /etc/lxc/default.conf
  144. /etc/lxc/lxc.conf
  145. endef
  146. define Package/lxc-common/install
  147. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  148. $(CP) \
  149. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  150. $(1)/usr/lib/lxc/rootfs/
  151. $(INSTALL_DIR) $(1)/usr/share/lxc
  152. $(CP) \
  153. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  154. $(1)/usr/share/lxc/
  155. $(INSTALL_DIR) $(1)/etc/lxc/
  156. $(CP) \
  157. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  158. $(1)/etc/lxc/default.conf
  159. $(INSTALL_DIR) $(1)/etc/lxc/
  160. $(CP) \
  161. ./files/lxc.conf \
  162. $(1)/etc/lxc/lxc.conf
  163. $(INSTALL_DIR) $(1)/srv/lxc/
  164. endef
  165. define Package/lxc-hooks/install
  166. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  167. $(CP) \
  168. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  169. $(1)/usr/share/lxc/hooks/
  170. endef
  171. define Package/lxc-templates/install
  172. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  173. $(CP) \
  174. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  175. $(1)/usr/share/lxc/templates/
  176. endef
  177. define Package/lxc-configs/install
  178. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  179. $(CP) \
  180. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  181. $(1)/usr/share/lxc/config/
  182. endef
  183. define Package/liblxc/install
  184. $(INSTALL_DIR) $(1)/usr/lib/
  185. $(CP) \
  186. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  187. $(1)/usr/lib/
  188. endef
  189. define Package/lxc-init/install
  190. $(INSTALL_DIR) $(1)/sbin
  191. $(CP) \
  192. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  193. $(1)/sbin/
  194. endef
  195. define GenPlugin
  196. define Package/lxc-$(1)
  197. $(call Package/lxc/Default)
  198. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  199. DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
  200. endef
  201. define Package/lxc-$(1)/install
  202. $(INSTALL_DIR) $$(1)$(3)
  203. $(INSTALL_BIN) \
  204. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  205. $$(1)$(3)/
  206. endef
  207. $$(eval $$(call BuildPackage,lxc-$(1)))
  208. endef
  209. $(eval $(call BuildPackage,lxc))
  210. $(eval $(call BuildPackage,lxc-common))
  211. $(eval $(call BuildPackage,lxc-hooks))
  212. $(eval $(call BuildPackage,lxc-configs))
  213. $(eval $(call BuildPackage,lxc-templates))
  214. $(eval $(call BuildPackage,liblxc))
  215. $(eval $(call BuildPackage,lxc-init))
  216. $(eval $(call BuildPackage,lxc-auto))
  217. $(eval $(call BuildPackage,lxc-unprivileged))
  218. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  219. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  220. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))