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