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