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.

297 lines
6.9 KiB

  1. #
  2. # Copyright (C) 2013-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=lxc
  9. PKG_VERSION:=2.1.1
  10. PKG_RELEASE:=4
  11. PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause GPL-2.0
  12. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
  15. PKG_HASH:=68663a67450a8d6734e137eac54cc7077209fb15c456eec401a2c26e6386eff6
  16. PKG_BUILD_DEPENDS:=lua
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_INSTALL:=1
  19. PKG_FIXUP:=autoreconf
  20. include $(INCLUDE_DIR)/package.mk
  21. LXC_APPLETS_BIN += \
  22. attach autostart cgroup copy config console create destroy device \
  23. execute freeze info monitor snapshot start stop unfreeze unshare \
  24. usernsexec wait top ls
  25. LXC_APPLETS_LIB += \
  26. monitord user-nic
  27. LXC_SCRIPTS += \
  28. checkconfig
  29. DEPENDS_APPLETS = +libpthread +libcap +liblxc
  30. DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock
  31. define Package/lxc/Default
  32. SECTION:=utils
  33. CATEGORY:=Utilities
  34. TITLE:=LXC userspace tools
  35. URL:=http://lxc.sourceforge.net/
  36. endef
  37. define Package/lxc
  38. $(call Package/lxc/Default)
  39. MENU:=1
  40. endef
  41. define Package/lxc-auto
  42. $(call Package/lxc/Default)
  43. TITLE:= (initscript)
  44. DEPENDS:=+lxc-start +lxc-stop
  45. endef
  46. define Package/lxc-auto/description
  47. LXC is the userspace control package for Linux Containers, a lightweight
  48. virtual system mechanism sometimes described as "chroot on steroids".
  49. This package adds and initscript for starting and stopping the containers
  50. on boot and shutdown.
  51. endef
  52. define Package/lxc-auto/conffiles
  53. /etc/config/lxc-auto
  54. endef
  55. define Package/lxc-unprivileged
  56. $(call Package/lxc/Default)
  57. TITLE:=Helper script for unprivileged containers support
  58. DEPENDS:=+shadow-utils +shadow-newuidmap +shadow-newgidmap
  59. endef
  60. define Package/lxc-unprivileged/description
  61. Support for unprivileged containers requires newuidmap and newguidmap.
  62. This package makes sure they are available & have correct permissions.
  63. endef
  64. define Package/lxc-unprivileged/install
  65. $(INSTALL_DIR) $(1)/etc/uci-defaults
  66. $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
  67. endef
  68. define Package/lxc/config
  69. source "$(SOURCE)/Config.in"
  70. endef
  71. define Package/lxc/description
  72. LXC is the userspace control package for Linux Containers, a lightweight
  73. virtual system mechanism sometimes described as "chroot on steroids".
  74. endef
  75. define Package/lxc-common
  76. $(call Package/lxc/Default)
  77. TITLE:=LXC common files
  78. DEPENDS:= lxc
  79. endef
  80. define Package/lxc-hooks
  81. $(call Package/lxc/Default)
  82. TITLE:=LXC virtual machine hooks
  83. DEPENDS:= lxc
  84. endef
  85. define Package/lxc-templates
  86. $(call Package/lxc/Default)
  87. TITLE:=LXC virtual machine templates
  88. DEPENDS:= lxc
  89. endef
  90. define Package/lxc-configs
  91. $(call Package/lxc/Default)
  92. TITLE:=LXC virtual machine common config files
  93. DEPENDS:= lxc
  94. endef
  95. define Package/liblxc
  96. $(call Package/lxc/Default)
  97. SECTION:=libs
  98. CATEGORY:=Libraries
  99. TITLE:=LXC userspace library
  100. DEPENDS:= lxc +libcap +libpthread +LXC_SECCOMP:libseccomp
  101. endef
  102. define Package/lxc-lua
  103. $(call Package/lxc/Default)
  104. TITLE:=LXC Lua bindings
  105. DEPENDS:= lxc +liblua +liblxc
  106. endef
  107. define Package/lxc-init
  108. $(call Package/lxc/Default)
  109. TITLE:=LXC Lua bindings
  110. DEPENDS:= lxc +liblxc
  111. endef
  112. CONFIGURE_ARGS += \
  113. --disable-apparmor \
  114. --disable-cgmanager \
  115. --disable-doc \
  116. --disable-examples \
  117. --disable-gnutls \
  118. --disable-selinux \
  119. --disable-python \
  120. --enable-lua=yes \
  121. --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc"
  122. ifeq ($(CONFIG_LXC_SECCOMP),y)
  123. CONFIGURE_ARGS += --enable-seccomp
  124. else
  125. CONFIGURE_ARGS += --disable-seccomp
  126. endif
  127. MAKE_FLAGS += \
  128. LUA_INSTALL_CMOD="/usr/lib/lua" \
  129. LUA_INSTALL_LMOD="/usr/lib/lua"
  130. define Build/InstallDev
  131. $(INSTALL_DIR) $(1)/usr/include/lxc/
  132. $(CP) \
  133. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  134. $(1)/usr/include/lxc/
  135. $(INSTALL_DIR) $(1)/usr/lib
  136. $(CP) \
  137. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  138. $(1)/usr/lib/
  139. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  140. $(CP) \
  141. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  142. $(1)/usr/lib/pkgconfig/
  143. endef
  144. define Package/lxc/install
  145. true
  146. endef
  147. define Package/lxc-auto/install
  148. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  149. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  150. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  151. endef
  152. define Package/lxc-common/conffiles
  153. /etc/lxc/default.conf
  154. /etc/lxc/lxc.conf
  155. endef
  156. define Package/lxc-common/install
  157. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  158. $(CP) \
  159. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  160. $(1)/usr/lib/lxc/rootfs/
  161. $(INSTALL_DIR) $(1)/usr/share/lxc
  162. $(CP) \
  163. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  164. $(1)/usr/share/lxc/
  165. $(INSTALL_DIR) $(1)/etc/lxc/
  166. $(CP) \
  167. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  168. $(1)/etc/lxc/default.conf
  169. $(INSTALL_DIR) $(1)/etc/lxc/
  170. $(CP) \
  171. ./files/lxc.conf \
  172. $(1)/etc/lxc/lxc.conf
  173. $(INSTALL_DIR) $(1)/srv/lxc/
  174. endef
  175. define Package/lxc-hooks/install
  176. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  177. $(CP) \
  178. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  179. $(1)/usr/share/lxc/hooks/
  180. endef
  181. define Package/lxc-templates/install
  182. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  183. $(CP) \
  184. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  185. $(1)/usr/share/lxc/templates/
  186. endef
  187. define Package/lxc-configs/install
  188. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  189. $(CP) \
  190. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  191. $(1)/usr/share/lxc/config/
  192. endef
  193. define Package/liblxc/install
  194. $(INSTALL_DIR) $(1)/usr/lib/
  195. $(CP) \
  196. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  197. $(1)/usr/lib/
  198. endef
  199. define Package/lxc-lua/install
  200. $(INSTALL_DIR) $(1)/usr/lib/lua
  201. $(CP) \
  202. $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
  203. $(1)/usr/lib/lua/
  204. $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
  205. $(CP) \
  206. $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
  207. $(1)/usr/lib/lua/lxc/
  208. endef
  209. define Package/lxc-init/install
  210. $(INSTALL_DIR) $(1)/sbin
  211. $(CP) \
  212. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  213. $(1)/sbin/
  214. endef
  215. define GenPlugin
  216. define Package/lxc-$(1)
  217. $(call Package/lxc/Default)
  218. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  219. DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  220. endef
  221. define Package/lxc-$(1)/install
  222. $(INSTALL_DIR) $$(1)$(3)
  223. $(INSTALL_BIN) \
  224. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  225. $$(1)$(3)/
  226. endef
  227. $$(eval $$(call BuildPackage,lxc-$(1)))
  228. endef
  229. $(eval $(call BuildPackage,lxc))
  230. $(eval $(call BuildPackage,lxc-common))
  231. $(eval $(call BuildPackage,lxc-hooks))
  232. $(eval $(call BuildPackage,lxc-configs))
  233. $(eval $(call BuildPackage,lxc-templates))
  234. $(eval $(call BuildPackage,liblxc))
  235. $(eval $(call BuildPackage,lxc-lua))
  236. $(eval $(call BuildPackage,lxc-init))
  237. $(eval $(call BuildPackage,lxc-auto))
  238. $(eval $(call BuildPackage,lxc-unprivileged))
  239. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  240. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  241. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))