Merge pull request #878 from jow-/lxc-autoconf-fix
[feed/packages.git] / utils / lxc / Makefile
1 #
2 # Copyright (C) 2013-2015 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.1.0
12 PKG_RELEASE:=1
13
14 PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0
15 PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/lxc/
19 PKG_MD5SUM:=ab1cbabf859abc15165050c854979c5c
20
21 PKG_BUILD_DEPENDS:=lua
22 PKG_BUILD_PARALLEL:=1
23
24 PKG_INSTALL:=1
25 PKG_FIXUP:=autoreconf
26
27 include $(INCLUDE_DIR)/package.mk
28
29 LXC_APPLETS_BIN += \
30 attach autostart cgroup clone config console create destroy execute \
31 freeze info monitor snapshot start stop unfreeze unshare usernsexec wait
32
33 LXC_APPLETS_LIB += \
34 monitord user-nic
35
36 LXC_SCRIPTS += \
37 checkconfig ls top
38
39 DEPENDS_APPLETS = +libpthread +libcap +liblxc
40
41 DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates
42 DEPENDS_ls = +lxc-config
43 DEPENDS_top = +lxc-lua +luafilesystem @BROKEN
44
45
46 define Package/lxc/Default
47 SECTION:=utils
48 CATEGORY:=Utilities
49 TITLE:=LXC userspace tools
50 URL:=http://lxc.sourceforge.net/
51 endef
52
53 define Package/lxc
54 $(call Package/lxc/Default)
55 MENU:=1
56 endef
57
58 define Package/lxc/config
59 source "$(SOURCE)/Config.in"
60 endef
61
62 define Package/lxc/description
63 LXC is the userspace control package for Linux Containers, a lightweight
64 virtual system mechanism sometimes described as "chroot on steroids".
65 endef
66
67 define Package/lxc-common
68 $(call Package/lxc/Default)
69 TITLE:=LXC common files
70 DEPENDS:= lxc
71 endef
72
73 define Package/lxc-hooks
74 $(call Package/lxc/Default)
75 TITLE:=LXC virtual machine hooks
76 DEPENDS:= lxc
77 endef
78
79 define Package/lxc-templates
80 $(call Package/lxc/Default)
81 TITLE:=LXC virtual machine templates
82 DEPENDS:= lxc
83 endef
84
85 define Package/lxc-configs
86 $(call Package/lxc/Default)
87 TITLE:=LXC virtual machine common config files
88 DEPENDS:= lxc
89 endef
90
91 define Package/liblxc
92 $(call Package/lxc/Default)
93 SECTION:=libs
94 CATEGORY:=Libraries
95 TITLE:=LXC userspace library
96 DEPENDS:= lxc +libcap +libpthread
97 endef
98
99 define Package/lxc-lua
100 $(call Package/lxc/Default)
101 TITLE:=LXC Lua bindings
102 DEPENDS:= lxc +liblua +liblxc +luafilesystem
103 endef
104
105 define Package/lxc-init
106 $(call Package/lxc/Default)
107 TITLE:=LXC Lua bindings
108 DEPENDS:= lxc +liblxc
109 endef
110
111 CONFIGURE_ARGS += \
112 --disable-apparmor \
113 --disable-doc \
114 --disable-examples \
115 --disable-seccomp
116 --enable-lua=yes \
117 --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
118
119 MAKE_FLAGS += \
120 LUA_INSTALL_CMOD="/usr/lib/lua" \
121 LUA_INSTALL_LMOD="/usr/lib/lua"
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/default.conf
166
167 $(INSTALL_DIR) $(1)/etc/lxc/
168 $(CP) \
169 ./files/lxc.conf \
170 $(1)/etc/lxc/lxc.conf
171
172 $(INSTALL_DIR) $(1)/lxc/
173 endef
174
175 define Package/lxc-hooks/install
176 $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
177 $(CP) \
178 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
179 $(1)/usr/share/lxc/hooks/
180 endef
181
182 define Package/lxc-templates/install
183 $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
184 $(CP) \
185 $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
186 $(1)/usr/share/lxc/templates/
187 endef
188
189 define Package/lxc-configs/install
190 $(INSTALL_DIR) $(1)/usr/share/lxc/config/
191 $(CP) \
192 $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
193 $(1)/usr/share/lxc/config/
194 endef
195
196 define Package/liblxc/install
197 $(INSTALL_DIR) $(1)/usr/lib/
198 $(CP) \
199 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
200 $(1)/usr/lib/
201 endef
202
203 define Package/lxc-lua/install
204 $(INSTALL_DIR) $(1)/usr/lib/lua
205 $(CP) \
206 $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
207 $(1)/usr/lib/lua/
208 $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
209 $(CP) \
210 $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
211 $(1)/usr/lib/lua/lxc/
212 endef
213
214 define Package/lxc-init/install
215 $(INSTALL_DIR) $(1)/sbin
216 $(CP) \
217 $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
218 $(1)/sbin/
219 endef
220
221 define GenPlugin
222 define Package/lxc-$(1)
223 $(call Package/lxc/Default)
224 TITLE:=Utility lxc-$(1) from the LXC userspace tools
225 DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
226 endef
227
228 define Package/lxc-$(1)/install
229 $(INSTALL_DIR) $$(1)$(3)
230 $(INSTALL_BIN) \
231 $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
232 $$(1)$(3)/
233 endef
234
235 $$(eval $$(call BuildPackage,lxc-$(1)))
236 endef
237
238
239 $(eval $(call BuildPackage,lxc))
240 $(eval $(call BuildPackage,lxc-common))
241 $(eval $(call BuildPackage,lxc-hooks))
242 $(eval $(call BuildPackage,lxc-configs))
243 $(eval $(call BuildPackage,lxc-templates))
244 $(eval $(call BuildPackage,liblxc))
245 $(eval $(call BuildPackage,lxc-lua))
246 $(eval $(call BuildPackage,lxc-init))
247 $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
248 $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
249 $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))