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.

294 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:=1
  11. PKG_LICENSE:=LGPL-2.1+ 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-gnutls \
  114. --disable-apparmor \
  115. --disable-doc \
  116. --disable-examples \
  117. --enable-lua=yes \
  118. --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc"
  119. ifeq ($(CONFIG_LXC_SECCOMP),y)
  120. CONFIGURE_ARGS += --enable-seccomp
  121. else
  122. CONFIGURE_ARGS += --disable-seccomp
  123. endif
  124. MAKE_FLAGS += \
  125. LUA_INSTALL_CMOD="/usr/lib/lua" \
  126. LUA_INSTALL_LMOD="/usr/lib/lua"
  127. define Build/InstallDev
  128. $(INSTALL_DIR) $(1)/usr/include/lxc/
  129. $(CP) \
  130. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  131. $(1)/usr/include/lxc/
  132. $(INSTALL_DIR) $(1)/usr/lib
  133. $(CP) \
  134. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  135. $(1)/usr/lib/
  136. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  137. $(CP) \
  138. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  139. $(1)/usr/lib/pkgconfig/
  140. endef
  141. define Package/lxc/install
  142. true
  143. endef
  144. define Package/lxc-auto/install
  145. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  146. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  147. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  148. endef
  149. define Package/lxc-common/conffiles
  150. /etc/lxc/default.conf
  151. /etc/lxc/lxc.conf
  152. endef
  153. define Package/lxc-common/install
  154. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  155. $(CP) \
  156. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  157. $(1)/usr/lib/lxc/rootfs/
  158. $(INSTALL_DIR) $(1)/usr/share/lxc
  159. $(CP) \
  160. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  161. $(1)/usr/share/lxc/
  162. $(INSTALL_DIR) $(1)/etc/lxc/
  163. $(CP) \
  164. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  165. $(1)/etc/lxc/default.conf
  166. $(INSTALL_DIR) $(1)/etc/lxc/
  167. $(CP) \
  168. ./files/lxc.conf \
  169. $(1)/etc/lxc/lxc.conf
  170. $(INSTALL_DIR) $(1)/srv/lxc/
  171. endef
  172. define Package/lxc-hooks/install
  173. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  174. $(CP) \
  175. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  176. $(1)/usr/share/lxc/hooks/
  177. endef
  178. define Package/lxc-templates/install
  179. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  180. $(CP) \
  181. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  182. $(1)/usr/share/lxc/templates/
  183. endef
  184. define Package/lxc-configs/install
  185. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  186. $(CP) \
  187. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  188. $(1)/usr/share/lxc/config/
  189. endef
  190. define Package/liblxc/install
  191. $(INSTALL_DIR) $(1)/usr/lib/
  192. $(CP) \
  193. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  194. $(1)/usr/lib/
  195. endef
  196. define Package/lxc-lua/install
  197. $(INSTALL_DIR) $(1)/usr/lib/lua
  198. $(CP) \
  199. $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
  200. $(1)/usr/lib/lua/
  201. $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
  202. $(CP) \
  203. $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
  204. $(1)/usr/lib/lua/lxc/
  205. endef
  206. define Package/lxc-init/install
  207. $(INSTALL_DIR) $(1)/sbin
  208. $(CP) \
  209. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  210. $(1)/sbin/
  211. endef
  212. define GenPlugin
  213. define Package/lxc-$(1)
  214. $(call Package/lxc/Default)
  215. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  216. DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  217. endef
  218. define Package/lxc-$(1)/install
  219. $(INSTALL_DIR) $$(1)$(3)
  220. $(INSTALL_BIN) \
  221. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  222. $$(1)$(3)/
  223. endef
  224. $$(eval $$(call BuildPackage,lxc-$(1)))
  225. endef
  226. $(eval $(call BuildPackage,lxc))
  227. $(eval $(call BuildPackage,lxc-common))
  228. $(eval $(call BuildPackage,lxc-hooks))
  229. $(eval $(call BuildPackage,lxc-configs))
  230. $(eval $(call BuildPackage,lxc-templates))
  231. $(eval $(call BuildPackage,liblxc))
  232. $(eval $(call BuildPackage,lxc-lua))
  233. $(eval $(call BuildPackage,lxc-init))
  234. $(eval $(call BuildPackage,lxc-auto))
  235. $(eval $(call BuildPackage,lxc-unprivileged))
  236. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  237. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  238. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))