Merge pull request #171 from thess/contrib-update
[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.5
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:=9d9af9e9e69a831cd50b58d91c786013
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_top = +lxc-lua +luafilesystem @BROKEN
37
38
39 define Package/lxc/Default
40 SECTION:=utils
41 CATEGORY:=Utilities
42 TITLE:=LXC userspace tools
43 URL:=http://lxc.sourceforge.net/
44 MAINTAINER:=Luka Perkov <luka@openwrt.org>
45 endef
46
47 define Package/lxc
48 $(call Package/lxc/Default)
49 MENU:=1
50 endef
51
52 define Package/lxc/description
53 LXC is the userspace control package for Linux Containers, a lightweight
54 virtual system mechanism sometimes described as "chroot on steroids".
55 endef
56
57 define Package/lxc-common
58 $(call Package/lxc/Default)
59 TITLE:=LXC common files
60 DEPENDS:= lxc
61 endef
62
63 define Package/lxc-hooks
64 $(call Package/lxc/Default)
65 TITLE:=LXC virtual machine hooks
66 DEPENDS:= lxc
67 endef
68
69 define Package/lxc-templates
70 $(call Package/lxc/Default)
71 TITLE:=LXC virtual machine templates
72 DEPENDS:= lxc @BROKEN
73 endef
74
75 define Package/liblxc
76 $(call Package/lxc/Default)
77 SECTION:=libs
78 CATEGORY:=Libraries
79 TITLE:=LXC userspace library
80 DEPENDS:= lxc +libcap +libpthread
81 endef
82
83 define Package/lxc-lua
84 $(call Package/lxc/Default)
85 TITLE:=LXC Lua bindings
86 DEPENDS:= lxc +liblua +liblxc +luafilesystem
87 endef
88
89 define Package/lxc-init
90 $(call Package/lxc/Default)
91 TITLE:=LXC Lua bindings
92 DEPENDS:= lxc +liblxc
93 endef
94
95 CONFIGURE_ARGS += \
96 --disable-apparmor \
97 --disable-doc \
98 --disable-examples \
99 --disable-seccomp
100 --enable-lua=yes \
101 --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
102
103 MAKE_FLAGS += \
104 LUA_INSTALL_CMOD="/usr/lib/lua" \
105 LUA_INSTALL_LMOD="/usr/lib/lua"
106
107 define Build/Configure
108 ( cd $(PKG_BUILD_DIR); ./autogen.sh );
109 $(call Build/Configure/Default)
110 endef
111
112
113 define Build/InstallDev
114 $(INSTALL_DIR) $(1)/usr/include/lxc/
115 $(CP) \
116 $(PKG_INSTALL_DIR)/usr/include/lxc/* \
117 $(1)/usr/include/lxc/
118
119 $(INSTALL_DIR) $(1)/usr/lib
120 $(CP) \
121 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
122 $(1)/usr/lib/
123
124 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
125 $(CP) \
126 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
127 $(1)/usr/lib/pkgconfig/
128 endef
129
130
131 define Package/lxc/install
132 true
133 endef
134
135 define Package/lxc-common/conffiles
136 /etc/lxc/default.conf
137 /etc/lxc/lxc.conf
138 endef
139
140 define Package/lxc-common/install
141 $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
142 $(CP) \
143 $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
144 $(1)/usr/lib/lxc/rootfs/
145
146 $(INSTALL_DIR) $(1)/usr/share/lxc
147 $(CP) \
148 $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
149 $(1)/usr/share/lxc/
150
151 $(INSTALL_DIR) $(1)/etc/lxc/
152 $(CP) \
153 $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
154 $(1)/etc/lxc/
155 endef
156
157 define Package/lxc-hooks/install
158 $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
159 $(CP) \
160 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountcgroups \
161 $(1)/usr/share/lxc/hooks/
162 $(CP) \
163 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountecryptfsroot \
164 $(1)/usr/share/lxc/hooks/
165 endef
166
167 define Package/lxc-templates/install
168 $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
169 $(CP) \
170 $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
171 $(1)/usr/share/lxc/templates/
172 endef
173
174 define Package/liblxc/install
175 $(INSTALL_DIR) $(1)/usr/lib/
176 $(CP) \
177 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
178 $(1)/usr/lib/
179 endef
180
181 define Package/lxc-lua/install
182 $(INSTALL_DIR) $(1)/usr/lib/lua
183 $(CP) \
184 $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
185 $(1)/usr/lib/lua/
186 $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
187 $(CP) \
188 $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
189 $(1)/usr/lib/lua/lxc/
190 endef
191
192 define Package/lxc-init/install
193 $(INSTALL_DIR) $(1)/sbin
194 $(CP) \
195 $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
196 $(1)/sbin/
197 endef
198
199 define GenPlugin
200 define Package/lxc-$(1)
201 $(call Package/lxc/Default)
202 TITLE:=Utility lxc-$(1) from the LXC userspace tools
203 DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
204 endef
205
206 define Package/lxc-$(1)/install
207 $(INSTALL_DIR) $$(1)$(3)
208 $(INSTALL_BIN) \
209 $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
210 $$(1)$(3)/
211 endef
212
213 $$(eval $$(call BuildPackage,lxc-$(1)))
214 endef
215
216
217 $(eval $(call BuildPackage,lxc))
218 $(eval $(call BuildPackage,lxc-common))
219 $(eval $(call BuildPackage,lxc-hooks))
220 $(eval $(call BuildPackage,lxc-templates))
221 $(eval $(call BuildPackage,liblxc))
222 $(eval $(call BuildPackage,lxc-lua))
223 $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
224 $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
225 $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))