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.

252 lines
5.5 KiB

  1. #
  2. # Copyright (C) 2013-2014 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:=1.0.6
  10. PKG_RELEASE:=1
  11. PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/
  14. PKG_MD5SUM:=4aad3aee84b42faa194e44091d723a3b
  15. PKG_BUILD_DEPENDS:=lua
  16. PKG_BUILD_PARALLEL:=1
  17. PKG_INSTALL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. LXC_APPLETS_BIN += \
  20. attach autostart cgroup clone config console create destroy execute \
  21. freeze info monitor snapshot start stop unfreeze unshare usernsexec wait
  22. LXC_APPLETS_LIB += \
  23. monitord user-nic
  24. LXC_SCRIPTS += \
  25. checkconfig ls top
  26. DEPENDS_APPLETS = +libpthread +libcap +liblxc
  27. DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates
  28. DEPENDS_ls = +lxc-config
  29. DEPENDS_top = +lxc-lua +luafilesystem @BROKEN
  30. define Package/lxc/Default
  31. SECTION:=utils
  32. CATEGORY:=Utilities
  33. TITLE:=LXC userspace tools
  34. URL:=http://lxc.sourceforge.net/
  35. MAINTAINER:=Luka Perkov <luka@openwrt.org>
  36. endef
  37. define Package/lxc
  38. $(call Package/lxc/Default)
  39. MENU:=1
  40. endef
  41. define Package/lxc/config
  42. source "$(SOURCE)/Config.in"
  43. endef
  44. define Package/lxc/description
  45. LXC is the userspace control package for Linux Containers, a lightweight
  46. virtual system mechanism sometimes described as "chroot on steroids".
  47. endef
  48. define Package/lxc-common
  49. $(call Package/lxc/Default)
  50. TITLE:=LXC common files
  51. DEPENDS:= lxc
  52. endef
  53. define Package/lxc-hooks
  54. $(call Package/lxc/Default)
  55. TITLE:=LXC virtual machine hooks
  56. DEPENDS:= lxc
  57. endef
  58. define Package/lxc-templates
  59. $(call Package/lxc/Default)
  60. TITLE:=LXC virtual machine templates
  61. DEPENDS:= lxc
  62. endef
  63. define Package/lxc-configs
  64. $(call Package/lxc/Default)
  65. TITLE:=LXC virtual machine common config files
  66. DEPENDS:= lxc
  67. endef
  68. define Package/liblxc
  69. $(call Package/lxc/Default)
  70. SECTION:=libs
  71. CATEGORY:=Libraries
  72. TITLE:=LXC userspace library
  73. DEPENDS:= lxc +libcap +libpthread
  74. endef
  75. define Package/lxc-lua
  76. $(call Package/lxc/Default)
  77. TITLE:=LXC Lua bindings
  78. DEPENDS:= lxc +liblua +liblxc +luafilesystem
  79. endef
  80. define Package/lxc-init
  81. $(call Package/lxc/Default)
  82. TITLE:=LXC Lua bindings
  83. DEPENDS:= lxc +liblxc
  84. endef
  85. CONFIGURE_ARGS += \
  86. --disable-apparmor \
  87. --disable-doc \
  88. --disable-examples \
  89. --disable-seccomp
  90. --enable-lua=yes \
  91. --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
  92. MAKE_FLAGS += \
  93. LUA_INSTALL_CMOD="/usr/lib/lua" \
  94. LUA_INSTALL_LMOD="/usr/lib/lua"
  95. define Build/Configure
  96. ( cd $(PKG_BUILD_DIR); ./autogen.sh );
  97. $(call Build/Configure/Default)
  98. endef
  99. define Build/InstallDev
  100. $(INSTALL_DIR) $(1)/usr/include/lxc/
  101. $(CP) \
  102. $(PKG_INSTALL_DIR)/usr/include/lxc/* \
  103. $(1)/usr/include/lxc/
  104. $(INSTALL_DIR) $(1)/usr/lib
  105. $(CP) \
  106. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  107. $(1)/usr/lib/
  108. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  109. $(CP) \
  110. $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
  111. $(1)/usr/lib/pkgconfig/
  112. endef
  113. define Package/lxc/install
  114. true
  115. endef
  116. define Package/lxc-common/conffiles
  117. /etc/lxc/default.conf
  118. /etc/lxc/lxc.conf
  119. endef
  120. define Package/lxc-common/install
  121. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  122. $(CP) \
  123. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  124. $(1)/usr/lib/lxc/rootfs/
  125. $(INSTALL_DIR) $(1)/usr/share/lxc
  126. $(CP) \
  127. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  128. $(1)/usr/share/lxc/
  129. $(INSTALL_DIR) $(1)/etc/lxc/
  130. $(CP) \
  131. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  132. $(1)/etc/lxc/default.conf
  133. $(INSTALL_DIR) $(1)/etc/lxc/
  134. $(CP) \
  135. ./files/lxc.conf \
  136. $(1)/etc/lxc/lxc.conf
  137. $(INSTALL_DIR) $(1)/lxc/
  138. endef
  139. define Package/lxc-hooks/install
  140. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  141. $(CP) \
  142. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  143. $(1)/usr/share/lxc/hooks/
  144. endef
  145. define Package/lxc-templates/install
  146. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  147. $(CP) \
  148. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  149. $(1)/usr/share/lxc/templates/
  150. endef
  151. define Package/lxc-configs/install
  152. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  153. $(CP) \
  154. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  155. $(1)/usr/share/lxc/config/
  156. endef
  157. define Package/liblxc/install
  158. $(INSTALL_DIR) $(1)/usr/lib/
  159. $(CP) \
  160. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  161. $(1)/usr/lib/
  162. endef
  163. define Package/lxc-lua/install
  164. $(INSTALL_DIR) $(1)/usr/lib/lua
  165. $(CP) \
  166. $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
  167. $(1)/usr/lib/lua/
  168. $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
  169. $(CP) \
  170. $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
  171. $(1)/usr/lib/lua/lxc/
  172. endef
  173. define Package/lxc-init/install
  174. $(INSTALL_DIR) $(1)/sbin
  175. $(CP) \
  176. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  177. $(1)/sbin/
  178. endef
  179. define GenPlugin
  180. define Package/lxc-$(1)
  181. $(call Package/lxc/Default)
  182. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  183. DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  184. endef
  185. define Package/lxc-$(1)/install
  186. $(INSTALL_DIR) $$(1)$(3)
  187. $(INSTALL_BIN) \
  188. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  189. $$(1)$(3)/
  190. endef
  191. $$(eval $$(call BuildPackage,lxc-$(1)))
  192. endef
  193. $(eval $(call BuildPackage,lxc))
  194. $(eval $(call BuildPackage,lxc-common))
  195. $(eval $(call BuildPackage,lxc-hooks))
  196. $(eval $(call BuildPackage,lxc-configs))
  197. $(eval $(call BuildPackage,lxc-templates))
  198. $(eval $(call BuildPackage,liblxc))
  199. $(eval $(call BuildPackage,lxc-lua))
  200. $(eval $(call BuildPackage,lxc-init))
  201. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  202. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  203. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))