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.

303 lines
7.2 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:=1
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
  14. PKG_HASH:=ca336dcdf303fea5ff231d89a9b6278b061c4cffb14f0db0a71a15bdd95a5cb0
  15. PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause GPL-2.0
  16. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  17. PKG_BUILD_DEPENDS:=lua
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_INSTALL:=1
  20. PKG_FIXUP:=autoreconf
  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. endef
  38. define Package/lxc
  39. $(call Package/lxc/Default)
  40. MENU:=1
  41. endef
  42. define Package/lxc-auto
  43. $(call Package/lxc/Default)
  44. TITLE:= (initscript)
  45. DEPENDS:=+lxc-start +lxc-stop
  46. endef
  47. define Package/lxc-auto/description
  48. LXC is the userspace control package for Linux Containers, a lightweight
  49. virtual system mechanism sometimes described as "chroot on steroids".
  50. This package adds and initscript for starting and stopping the containers
  51. on boot and shutdown.
  52. endef
  53. define Package/lxc-auto/conffiles
  54. /etc/config/lxc-auto
  55. endef
  56. define Package/lxc-unprivileged
  57. $(call Package/lxc/Default)
  58. TITLE:=Helper script for unprivileged containers support
  59. DEPENDS:=+shadow-utils +shadow-newuidmap +shadow-newgidmap
  60. endef
  61. define Package/lxc-unprivileged/description
  62. Support for unprivileged containers requires newuidmap and newguidmap.
  63. This package makes sure they are available & have correct permissions.
  64. endef
  65. define Package/lxc-unprivileged/install
  66. $(INSTALL_DIR) $(1)/etc/uci-defaults
  67. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  68. endef
  69. define Package/lxc/config
  70. source "$(SOURCE)/Config.in"
  71. endef
  72. define Package/lxc/description
  73. LXC is the userspace control package for Linux Containers, a lightweight
  74. virtual system mechanism sometimes described as "chroot on steroids".
  75. endef
  76. define Package/lxc-common
  77. $(call Package/lxc/Default)
  78. TITLE:=LXC common files
  79. DEPENDS:= lxc
  80. endef
  81. define Package/lxc-hooks
  82. $(call Package/lxc/Default)
  83. TITLE:=LXC virtual machine hooks
  84. DEPENDS:= lxc
  85. endef
  86. define Package/lxc-templates
  87. $(call Package/lxc/Default)
  88. TITLE:=LXC virtual machine templates
  89. DEPENDS:= lxc
  90. endef
  91. define Package/lxc-configs
  92. $(call Package/lxc/Default)
  93. TITLE:=LXC virtual machine common config files
  94. DEPENDS:= lxc
  95. endef
  96. define Package/liblxc
  97. $(call Package/lxc/Default)
  98. SECTION:=libs
  99. CATEGORY:=Libraries
  100. TITLE:=LXC userspace library
  101. DEPENDS:= lxc +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
  102. endef
  103. define Package/lxc-lua
  104. $(call Package/lxc/Default)
  105. TITLE:=LXC Lua bindings
  106. DEPENDS:= lxc +liblua +liblxc
  107. endef
  108. define Package/lxc-init
  109. $(call Package/lxc/Default)
  110. TITLE:=LXC Lua bindings
  111. DEPENDS:= lxc +liblxc
  112. endef
  113. CONFIGURE_ARGS += \
  114. --disable-apparmor \
  115. --disable-cgmanager \
  116. --disable-doc \
  117. --disable-examples \
  118. --disable-gnutls \
  119. --disable-selinux \
  120. --disable-python \
  121. --enable-lua=yes \
  122. --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc"
  123. TARGET_CFLAGS += -Wno-format-nonliteral
  124. TARGET_LDFLAGS += -lgcc_eh
  125. ifeq ($(CONFIG_LXC_SECCOMP),y)
  126. CONFIGURE_ARGS += --enable-seccomp
  127. else
  128. CONFIGURE_ARGS += --disable-seccomp
  129. endif
  130. MAKE_FLAGS += \
  131. LUA_INSTALL_CMOD="/usr/lib/lua" \
  132. LUA_INSTALL_LMOD="/usr/lib/lua"
  133. define Build/InstallDev
  134. $(INSTALL_DIR) $(1)/usr/include/lxc/
  135. $(CP) \
  136. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  137. $(1)/usr/include/lxc/
  138. $(INSTALL_DIR) $(1)/usr/lib
  139. $(CP) \
  140. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  141. $(1)/usr/lib/
  142. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  143. $(CP) \
  144. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  145. $(1)/usr/lib/pkgconfig/
  146. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  147. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  148. endef
  149. define Package/lxc/install
  150. true
  151. endef
  152. define Package/lxc-auto/install
  153. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  154. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  155. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  156. endef
  157. define Package/lxc-common/conffiles
  158. /etc/lxc/default.conf
  159. /etc/lxc/lxc.conf
  160. endef
  161. define Package/lxc-common/install
  162. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  163. $(CP) \
  164. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  165. $(1)/usr/lib/lxc/rootfs/
  166. $(INSTALL_DIR) $(1)/usr/share/lxc
  167. $(CP) \
  168. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  169. $(1)/usr/share/lxc/
  170. $(INSTALL_DIR) $(1)/etc/lxc/
  171. $(CP) \
  172. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  173. $(1)/etc/lxc/default.conf
  174. $(INSTALL_DIR) $(1)/etc/lxc/
  175. $(CP) \
  176. ./files/lxc.conf \
  177. $(1)/etc/lxc/lxc.conf
  178. $(INSTALL_DIR) $(1)/srv/lxc/
  179. endef
  180. define Package/lxc-hooks/install
  181. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  182. $(CP) \
  183. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  184. $(1)/usr/share/lxc/hooks/
  185. endef
  186. define Package/lxc-templates/install
  187. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  188. $(CP) \
  189. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  190. $(1)/usr/share/lxc/templates/
  191. endef
  192. define Package/lxc-configs/install
  193. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  194. $(CP) \
  195. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  196. $(1)/usr/share/lxc/config/
  197. endef
  198. define Package/liblxc/install
  199. $(INSTALL_DIR) $(1)/usr/lib/
  200. $(CP) \
  201. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  202. $(1)/usr/lib/
  203. endef
  204. define Package/lxc-lua/install
  205. $(INSTALL_DIR) $(1)/usr/lib/lua
  206. $(CP) \
  207. $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
  208. $(1)/usr/lib/lua/
  209. $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
  210. $(CP) \
  211. $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
  212. $(1)/usr/lib/lua/lxc/
  213. endef
  214. define Package/lxc-init/install
  215. $(INSTALL_DIR) $(1)/sbin
  216. $(CP) \
  217. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  218. $(1)/sbin/
  219. endef
  220. define GenPlugin
  221. define Package/lxc-$(1)
  222. $(call Package/lxc/Default)
  223. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  224. DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  225. endef
  226. define Package/lxc-$(1)/install
  227. $(INSTALL_DIR) $$(1)$(3)
  228. $(INSTALL_BIN) \
  229. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  230. $$(1)$(3)/
  231. endef
  232. $$(eval $$(call BuildPackage,lxc-$(1)))
  233. endef
  234. $(eval $(call BuildPackage,lxc))
  235. $(eval $(call BuildPackage,lxc-common))
  236. $(eval $(call BuildPackage,lxc-hooks))
  237. $(eval $(call BuildPackage,lxc-configs))
  238. $(eval $(call BuildPackage,lxc-templates))
  239. $(eval $(call BuildPackage,liblxc))
  240. $(eval $(call BuildPackage,lxc-lua))
  241. $(eval $(call BuildPackage,lxc-init))
  242. $(eval $(call BuildPackage,lxc-auto))
  243. $(eval $(call BuildPackage,lxc-unprivileged))
  244. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  245. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  246. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))