1
0

Makefile 6.3 KB

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