lxc: add config templates package
[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
78 endef
79
80 define Package/lxc-configs
81 $(call Package/lxc/Default)
82 TITLE:=LXC virtual machine common config files
83 DEPENDS:= lxc
84 endef
85
86 define Package/liblxc
87 $(call Package/lxc/Default)
88 SECTION:=libs
89 CATEGORY:=Libraries
90 TITLE:=LXC userspace library
91 DEPENDS:= lxc +libcap +libpthread
92 endef
93
94 define Package/lxc-lua
95 $(call Package/lxc/Default)
96 TITLE:=LXC Lua bindings
97 DEPENDS:= lxc +liblua +liblxc +luafilesystem
98 endef
99
100 define Package/lxc-init
101 $(call Package/lxc/Default)
102 TITLE:=LXC Lua bindings
103 DEPENDS:= lxc +liblxc
104 endef
105
106 CONFIGURE_ARGS += \
107 --disable-apparmor \
108 --disable-doc \
109 --disable-examples \
110 --disable-seccomp
111 --enable-lua=yes \
112 --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
113
114 MAKE_FLAGS += \
115 LUA_INSTALL_CMOD="/usr/lib/lua" \
116 LUA_INSTALL_LMOD="/usr/lib/lua"
117
118 define Build/Configure
119 ( cd $(PKG_BUILD_DIR); ./autogen.sh );
120 $(call Build/Configure/Default)
121 endef
122
123
124 define Build/InstallDev
125 $(INSTALL_DIR) $(1)/usr/include/lxc/
126 $(CP) \
127 $(PKG_INSTALL_DIR)/usr/include/lxc/* \
128 $(1)/usr/include/lxc/
129
130 $(INSTALL_DIR) $(1)/usr/lib
131 $(CP) \
132 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
133 $(1)/usr/lib/
134
135 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
136 $(CP) \
137 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
138 $(1)/usr/lib/pkgconfig/
139 endef
140
141
142 define Package/lxc/install
143 true
144 endef
145
146 define Package/lxc-common/conffiles
147 /etc/lxc/default.conf
148 /etc/lxc/lxc.conf
149 endef
150
151 define Package/lxc-common/install
152 $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
153 $(CP) \
154 $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
155 $(1)/usr/lib/lxc/rootfs/
156
157 $(INSTALL_DIR) $(1)/usr/share/lxc
158 $(CP) \
159 $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
160 $(1)/usr/share/lxc/
161
162 $(INSTALL_DIR) $(1)/etc/lxc/
163 $(CP) \
164 $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
165 $(1)/etc/lxc/lxc.conf
166 endef
167
168 define Package/lxc-hooks/install
169 $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
170 $(CP) \
171 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountcgroups \
172 $(1)/usr/share/lxc/hooks/
173 $(CP) \
174 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountecryptfsroot \
175 $(1)/usr/share/lxc/hooks/
176 endef
177
178 define Package/lxc-templates/install
179 $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
180 $(CP) \
181 $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
182 $(1)/usr/share/lxc/templates/
183 endef
184
185 define Package/lxc-configs/install
186 $(INSTALL_DIR) $(1)/usr/share/lxc/config/
187 $(CP) \
188 $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
189 $(1)/usr/share/lxc/config/
190 endef
191
192 define Package/liblxc/install
193 $(INSTALL_DIR) $(1)/usr/lib/
194 $(CP) \
195 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
196 $(1)/usr/lib/
197 endef
198
199 define Package/lxc-lua/install
200 $(INSTALL_DIR) $(1)/usr/lib/lua
201 $(CP) \
202 $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
203 $(1)/usr/lib/lua/
204 $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
205 $(CP) \
206 $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
207 $(1)/usr/lib/lua/lxc/
208 endef
209
210 define Package/lxc-init/install
211 $(INSTALL_DIR) $(1)/sbin
212 $(CP) \
213 $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
214 $(1)/sbin/
215 endef
216
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
224 define Package/lxc-$(1)/install
225 $(INSTALL_DIR) $$(1)$(3)
226 $(INSTALL_BIN) \
227 $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
228 $$(1)$(3)/
229 endef
230
231 $$(eval $$(call BuildPackage,lxc-$(1)))
232 endef
233
234
235 $(eval $(call BuildPackage,lxc))
236 $(eval $(call BuildPackage,lxc-common))
237 $(eval $(call BuildPackage,lxc-hooks))
238 $(eval $(call BuildPackage,lxc-configs))
239 $(eval $(call BuildPackage,lxc-templates))
240 $(eval $(call BuildPackage,liblxc))
241 $(eval $(call BuildPackage,lxc-lua))
242 $(eval $(call BuildPackage,lxc-init))
243 $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
244 $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
245 $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))