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