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.

299 lines
7.1 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:=5
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
  13. PKG_HASH:=68663a67450a8d6734e137eac54cc7077209fb15c456eec401a2c26e6386eff6
  14. PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause GPL-2.0
  15. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  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. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
  144. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
  145. endef
  146. define Package/lxc/install
  147. true
  148. endef
  149. define Package/lxc-auto/install
  150. $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
  151. $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
  152. $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
  153. endef
  154. define Package/lxc-common/conffiles
  155. /etc/lxc/default.conf
  156. /etc/lxc/lxc.conf
  157. endef
  158. define Package/lxc-common/install
  159. $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
  160. $(CP) \
  161. $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
  162. $(1)/usr/lib/lxc/rootfs/
  163. $(INSTALL_DIR) $(1)/usr/share/lxc
  164. $(CP) \
  165. $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
  166. $(1)/usr/share/lxc/
  167. $(INSTALL_DIR) $(1)/etc/lxc/
  168. $(CP) \
  169. $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
  170. $(1)/etc/lxc/default.conf
  171. $(INSTALL_DIR) $(1)/etc/lxc/
  172. $(CP) \
  173. ./files/lxc.conf \
  174. $(1)/etc/lxc/lxc.conf
  175. $(INSTALL_DIR) $(1)/srv/lxc/
  176. endef
  177. define Package/lxc-hooks/install
  178. $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
  179. $(CP) \
  180. $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
  181. $(1)/usr/share/lxc/hooks/
  182. endef
  183. define Package/lxc-templates/install
  184. $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
  185. $(CP) \
  186. $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
  187. $(1)/usr/share/lxc/templates/
  188. endef
  189. define Package/lxc-configs/install
  190. $(INSTALL_DIR) $(1)/usr/share/lxc/config/
  191. $(CP) \
  192. $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
  193. $(1)/usr/share/lxc/config/
  194. endef
  195. define Package/liblxc/install
  196. $(INSTALL_DIR) $(1)/usr/lib/
  197. $(CP) \
  198. $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
  199. $(1)/usr/lib/
  200. endef
  201. define Package/lxc-lua/install
  202. $(INSTALL_DIR) $(1)/usr/lib/lua
  203. $(CP) \
  204. $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
  205. $(1)/usr/lib/lua/
  206. $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
  207. $(CP) \
  208. $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
  209. $(1)/usr/lib/lua/lxc/
  210. endef
  211. define Package/lxc-init/install
  212. $(INSTALL_DIR) $(1)/sbin
  213. $(CP) \
  214. $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
  215. $(1)/sbin/
  216. endef
  217. define GenPlugin
  218. define Package/lxc-$(1)
  219. $(call Package/lxc/Default)
  220. TITLE:=Utility lxc-$(1) from the LXC userspace tools
  221. DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  222. endef
  223. define Package/lxc-$(1)/install
  224. $(INSTALL_DIR) $$(1)$(3)
  225. $(INSTALL_BIN) \
  226. $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
  227. $$(1)$(3)/
  228. endef
  229. $$(eval $$(call BuildPackage,lxc-$(1)))
  230. endef
  231. $(eval $(call BuildPackage,lxc))
  232. $(eval $(call BuildPackage,lxc-common))
  233. $(eval $(call BuildPackage,lxc-hooks))
  234. $(eval $(call BuildPackage,lxc-configs))
  235. $(eval $(call BuildPackage,lxc-templates))
  236. $(eval $(call BuildPackage,liblxc))
  237. $(eval $(call BuildPackage,lxc-lua))
  238. $(eval $(call BuildPackage,lxc-init))
  239. $(eval $(call BuildPackage,lxc-auto))
  240. $(eval $(call BuildPackage,lxc-unprivileged))
  241. $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
  242. $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
  243. $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))