aboutsummaryrefslogtreecommitdiff
path: root/utils/lxc/Makefile
blob: 97d79835ead49967de3d0ebcee44a766e86edd00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#
# Copyright (C) 2013-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=lxc
PKG_VERSION:=1.0.5
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/
PKG_MD5SUM:=9d9af9e9e69a831cd50b58d91c786013

PKG_BUILD_DEPENDS:=lua
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

LXC_APPLETS_BIN += \
	attach autostart cgroup clone config console create destroy execute \
	freeze info monitor snapshot start stop unfreeze unshare usernsexec wait

LXC_APPLETS_LIB += \
	monitord user-nic

LXC_SCRIPTS += \
	checkconfig ls top

DEPENDS_APPLETS = +libpthread +libcap +liblxc

DEPENDS_top = +lxc-lua +luafilesystem @BROKEN


define Package/lxc/Default
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=LXC userspace tools
  URL:=http://lxc.sourceforge.net/
  MAINTAINER:=Luka Perkov <luka@openwrt.org>
endef

define Package/lxc
  $(call Package/lxc/Default)
  MENU:=1
endef

define Package/lxc/config
  source "$(SOURCE)/Config.in"
endef

define Package/lxc/description
 LXC is the userspace control package for Linux Containers, a lightweight
 virtual system mechanism sometimes described as "chroot on steroids".
endef

define Package/lxc-common
  $(call Package/lxc/Default)
  TITLE:=LXC common files
  DEPENDS:= lxc
endef

define Package/lxc-hooks
  $(call Package/lxc/Default)
  TITLE:=LXC virtual machine hooks
  DEPENDS:= lxc
endef

define Package/lxc-templates
  $(call Package/lxc/Default)
  TITLE:=LXC virtual machine templates
  DEPENDS:= lxc @BROKEN
endef

define Package/liblxc
  $(call Package/lxc/Default)
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=LXC userspace library
  DEPENDS:= lxc +libcap +libpthread
endef

define Package/lxc-lua
  $(call Package/lxc/Default)
  TITLE:=LXC Lua bindings
  DEPENDS:= lxc +liblua +liblxc +luafilesystem
endef

define Package/lxc-init
  $(call Package/lxc/Default)
  TITLE:=LXC Lua bindings
  DEPENDS:= lxc +liblxc
endef

CONFIGURE_ARGS += \
	--disable-apparmor \
	--disable-doc \
	--disable-examples \
	--disable-seccomp
	--enable-lua=yes \
	--with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \

MAKE_FLAGS += \
	LUA_INSTALL_CMOD="/usr/lib/lua" \
	LUA_INSTALL_LMOD="/usr/lib/lua"

define Build/Configure
	( cd $(PKG_BUILD_DIR); ./autogen.sh );
	$(call Build/Configure/Default)
endef


define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include/lxc/
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/include/lxc/* \
		$(1)/usr/include/lxc/

	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
		$(1)/usr/lib/

	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
		$(1)/usr/lib/pkgconfig/
endef


define Package/lxc/install
	true
endef

define Package/lxc-common/conffiles
/etc/lxc/default.conf
/etc/lxc/lxc.conf
endef

define Package/lxc-common/install
	$(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
		$(1)/usr/lib/lxc/rootfs/

	$(INSTALL_DIR) $(1)/usr/share/lxc
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
		$(1)/usr/share/lxc/

	$(INSTALL_DIR) $(1)/etc/lxc/
	$(CP) \
		$(PKG_INSTALL_DIR)/etc/lxc/default.conf \
		$(1)/etc/lxc/
endef

define Package/lxc-hooks/install
	$(INSTALL_DIR) $(1)/usr/share/lxc/hooks
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountcgroups \
		$(1)/usr/share/lxc/hooks/
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountecryptfsroot \
		$(1)/usr/share/lxc/hooks/
endef

define Package/lxc-templates/install
	$(INSTALL_DIR) $(1)/usr/share/lxc/templates/
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
		$(1)/usr/share/lxc/templates/
endef

define Package/liblxc/install
	$(INSTALL_DIR) $(1)/usr/lib/
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
		$(1)/usr/lib/
endef

define Package/lxc-lua/install
	$(INSTALL_DIR) $(1)/usr/lib/lua
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
		$(1)/usr/lib/lua/
	$(INSTALL_DIR) $(1)/usr/lib/lua/lxc
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
		$(1)/usr/lib/lua/lxc/
endef

define Package/lxc-init/install
	$(INSTALL_DIR) $(1)/sbin
	$(CP) \
		$(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
		$(1)/sbin/
endef

define GenPlugin
  define Package/lxc-$(1)
    $(call Package/lxc/Default)
    TITLE:=Utility lxc-$(1) from the LXC userspace tools
    DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
  endef

  define Package/lxc-$(1)/install
	$(INSTALL_DIR) $$(1)$(3)
	$(INSTALL_BIN) \
		$(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
		$$(1)$(3)/
  endef

  $$(eval $$(call BuildPackage,lxc-$(1)))
endef


$(eval $(call BuildPackage,lxc))
$(eval $(call BuildPackage,lxc-common))
$(eval $(call BuildPackage,lxc-hooks))
$(eval $(call BuildPackage,lxc-templates))
$(eval $(call BuildPackage,liblxc))
$(eval $(call BuildPackage,lxc-lua))
$(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
$(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
$(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))