Merge pull request #1255 from samm-git/master
[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.2
12 PKG_RELEASE:=1
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_MD5SUM:=3ebadacf5fe8bfe689fd7a09812b682c
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
43 DEPENDS_ls = +lxc-config
44 DEPENDS_top = +lxc-lua +luafilesystem @BROKEN
45
46
47 define Package/lxc/Default
48 SECTION:=utils
49 CATEGORY:=Utilities
50 TITLE:=LXC userspace tools
51 URL:=http://lxc.sourceforge.net/
52 endef
53
54 define Package/lxc
55 $(call Package/lxc/Default)
56 MENU:=1
57 endef
58
59 define Package/lxc/config
60 source "$(SOURCE)/Config.in"
61 endef
62
63 define Package/lxc/description
64 LXC is the userspace control package for Linux Containers, a lightweight
65 virtual system mechanism sometimes described as "chroot on steroids".
66 endef
67
68 define Package/lxc-common
69 $(call Package/lxc/Default)
70 TITLE:=LXC common files
71 DEPENDS:= lxc
72 endef
73
74 define Package/lxc-hooks
75 $(call Package/lxc/Default)
76 TITLE:=LXC virtual machine hooks
77 DEPENDS:= lxc
78 endef
79
80 define Package/lxc-templates
81 $(call Package/lxc/Default)
82 TITLE:=LXC virtual machine templates
83 DEPENDS:= lxc
84 endef
85
86 define Package/lxc-configs
87 $(call Package/lxc/Default)
88 TITLE:=LXC virtual machine common config files
89 DEPENDS:= lxc
90 endef
91
92 define Package/liblxc
93 $(call Package/lxc/Default)
94 SECTION:=libs
95 CATEGORY:=Libraries
96 TITLE:=LXC userspace library
97 DEPENDS:= lxc +libcap +libpthread
98 endef
99
100 define Package/lxc-lua
101 $(call Package/lxc/Default)
102 TITLE:=LXC Lua bindings
103 DEPENDS:= lxc +liblua +liblxc +luafilesystem
104 endef
105
106 define Package/lxc-init
107 $(call Package/lxc/Default)
108 TITLE:=LXC Lua bindings
109 DEPENDS:= lxc +liblxc
110 endef
111
112 CONFIGURE_ARGS += \
113 --disable-apparmor \
114 --disable-doc \
115 --disable-examples \
116 --disable-seccomp
117 --enable-lua=yes \
118 --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
119
120 MAKE_FLAGS += \
121 LUA_INSTALL_CMOD="/usr/lib/lua" \
122 LUA_INSTALL_LMOD="/usr/lib/lua"
123
124
125 define Build/InstallDev
126 $(INSTALL_DIR) $(1)/usr/include/lxc/
127 $(CP) \
128 $(PKG_INSTALL_DIR)/usr/include/lxc/* \
129 $(1)/usr/include/lxc/
130
131 $(INSTALL_DIR) $(1)/usr/lib
132 $(CP) \
133 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
134 $(1)/usr/lib/
135
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
142
143 define Package/lxc/install
144 true
145 endef
146
147 define Package/lxc-common/conffiles
148 /etc/lxc/default.conf
149 /etc/lxc/lxc.conf
150 endef
151
152 define Package/lxc-common/install
153 $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
154 $(CP) \
155 $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
156 $(1)/usr/lib/lxc/rootfs/
157
158 $(INSTALL_DIR) $(1)/usr/share/lxc
159 $(CP) \
160 $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
161 $(1)/usr/share/lxc/
162
163 $(INSTALL_DIR) $(1)/etc/lxc/
164 $(CP) \
165 $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
166 $(1)/etc/lxc/default.conf
167
168 $(INSTALL_DIR) $(1)/etc/lxc/
169 $(CP) \
170 ./files/lxc.conf \
171 $(1)/etc/lxc/lxc.conf
172
173 $(INSTALL_DIR) $(1)/lxc/
174 endef
175
176 define Package/lxc-hooks/install
177 $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
178 $(CP) \
179 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
180 $(1)/usr/share/lxc/hooks/
181 endef
182
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
190 define Package/lxc-configs/install
191 $(INSTALL_DIR) $(1)/usr/share/lxc/config/
192 $(CP) \
193 $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
194 $(1)/usr/share/lxc/config/
195 endef
196
197 define Package/liblxc/install
198 $(INSTALL_DIR) $(1)/usr/lib/
199 $(CP) \
200 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
201 $(1)/usr/lib/
202 endef
203
204 define Package/lxc-lua/install
205 $(INSTALL_DIR) $(1)/usr/lib/lua
206 $(CP) \
207 $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
208 $(1)/usr/lib/lua/
209 $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
210 $(CP) \
211 $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
212 $(1)/usr/lib/lua/lxc/
213 endef
214
215 define Package/lxc-init/install
216 $(INSTALL_DIR) $(1)/sbin
217 $(CP) \
218 $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
219 $(1)/sbin/
220 endef
221
222 define GenPlugin
223 define Package/lxc-$(1)
224 $(call Package/lxc/Default)
225 TITLE:=Utility lxc-$(1) from the LXC userspace tools
226 DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
227 endef
228
229 define Package/lxc-$(1)/install
230 $(INSTALL_DIR) $$(1)$(3)
231 $(INSTALL_BIN) \
232 $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
233 $$(1)$(3)/
234 endef
235
236 $$(eval $$(call BuildPackage,lxc-$(1)))
237 endef
238
239
240 $(eval $(call BuildPackage,lxc))
241 $(eval $(call BuildPackage,lxc-common))
242 $(eval $(call BuildPackage,lxc-hooks))
243 $(eval $(call BuildPackage,lxc-configs))
244 $(eval $(call BuildPackage,lxc-templates))
245 $(eval $(call BuildPackage,liblxc))
246 $(eval $(call BuildPackage,lxc-lua))
247 $(eval $(call BuildPackage,lxc-init))
248 $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
249 $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
250 $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))