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