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