lxc: set RUNTIME_PATH define to the /var/run path
[feed/packages.git] / utils / lxc / Makefile
1 #
2 # Copyright (C) 2013-2015 OpenWrt.org
3 # Copyright (C) 2020 Sartura
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=lxc
12 PKG_VERSION:=5.0.2
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/
17 PKG_HASH:=bea08d2e49efcee34fa58acd2bc95c0adc64d291c07f4cfaf4ac1d8ac5a36f45
18
19 PKG_MAINTAINER:=Marko Ratkaj <markoratkaj@gmail.com>
20 PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause GPL-2.0
21 PKG_LICENSE_FILES:=COPYING LICENSE.GPL2 LICENSE.LGPL2.1
22 PKG_BUILD_FLAGS:=no-mips16
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/meson.mk
26
27 MESON_ARGS += \
28 -Db_lto=$(if $(findstring mips,$(CONFIG_ARCH)),false,true) \
29 -Dwerror=false \
30 -Dinit-script=sysvinit \
31 -Dman=false \
32 -Dapparmor=false \
33 -Dselinux=false \
34 -Dseccomp=$(if $(CONFIG_LXC_SECCOMP),true,false) \
35 -Dexamples=false \
36 -Db_pie=true \
37 -Druntime-path=/var/run
38
39 LXC_APPLETS_BIN += \
40 attach autostart cgroup copy config console create destroy device \
41 execute freeze info monitor snapshot start stop unfreeze unshare \
42 usernsexec wait top ls
43
44 LXC_APPLETS_LIB += \
45 monitord user-nic
46
47 LXC_SCRIPTS += \
48 checkconfig
49
50 DEPENDS_APPLETS = +libpthread +libcap +liblxc
51
52 DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock +getopt
53
54 define Package/lxc/Default
55 SECTION:=utils
56 CATEGORY:=Utilities
57 TITLE:=LXC userspace tools
58 URL:=https://linuxcontainers.org/
59 DEPENDS:=lxc
60 endef
61
62 define Package/lxc
63 $(call Package/lxc/Default)
64 DEPENDS:=@!arc
65 MENU:=1
66 endef
67
68 define Package/lxc-auto
69 $(call Package/lxc/Default)
70 TITLE:= (initscript)
71 DEPENDS+=+lxc-start +lxc-stop
72 endef
73
74 define Package/lxc-auto/postinst
75 [ -n "$${IPKG_INSTROOT}" ] || [ "$${PKG_UPGRADE}" = 1 ] || /etc/init.d/lxc-auto boot
76 endef
77
78 define Package/lxc-auto/description
79 LXC is the userspace control package for Linux Containers, a lightweight
80 virtual system mechanism sometimes described as "chroot on steroids".
81 This package adds an initscript for starting and stopping the containers
82 on boot and shutdown.
83 endef
84
85 define Package/lxc-auto/conffiles
86 /etc/config/lxc-auto
87 endef
88
89 define Package/lxc-unprivileged
90 $(call Package/lxc/Default)
91 TITLE:=Helper script for unprivileged containers support
92 DEPENDS+=+shadow-utils +shadow-newuidmap +shadow-newgidmap
93 endef
94
95 define Package/lxc-unprivileged/description
96 Support for unprivileged containers requires newuidmap and newguidmap.
97 This package makes sure they are available & have correct permissions.
98 endef
99
100 define Package/lxc-unprivileged/install
101 $(INSTALL_DIR) $(1)/etc/uci-defaults
102 $(INSTALL_DATA) ./files/lxc-unprivileged.defaults $(1)/etc/uci-defaults/lxc-unprivileged
103 endef
104
105 define Package/lxc/config
106 source "$(SOURCE)/Config.in"
107 endef
108
109 define Package/lxc/description
110 LXC is the userspace control package for Linux Containers, a lightweight
111 virtual system mechanism sometimes described as "chroot on steroids".
112 endef
113
114 define Package/lxc-common
115 $(call Package/lxc/Default)
116 TITLE:=LXC common files
117 endef
118
119 define Package/lxc-hooks
120 $(call Package/lxc/Default)
121 TITLE:=LXC virtual machine hooks
122 endef
123
124 define Package/lxc-templates
125 $(call Package/lxc/Default)
126 TITLE:=LXC virtual machine templates
127 endef
128
129 define Package/lxc-configs
130 $(call Package/lxc/Default)
131 TITLE:=LXC virtual machine common config files
132 endef
133
134 define Package/liblxc
135 $(call Package/lxc/Default)
136 SECTION:=libs
137 CATEGORY:=Libraries
138 TITLE:=LXC userspace library
139 DEPENDS+= +libcap +libpthread +LXC_SECCOMP:libseccomp +libopenssl
140 endef
141
142 define Package/lxc-init
143 $(call Package/lxc/Default)
144 TITLE:=LXC Lua bindings
145 DEPENDS+= +liblxc
146 endef
147
148 ifdef CONFIG_USE_MIPS16
149 TARGET_CFLAGS += -minterlink-mips16
150 endif
151 TARGET_LDFLAGS += -lgcc_eh
152
153 define Build/InstallDev
154 $(INSTALL_DIR) $(1)/usr/include/lxc/
155 $(CP) \
156 $(PKG_INSTALL_DIR)/usr/include/lxc/* \
157 $(1)/usr/include/lxc/
158
159 $(INSTALL_DIR) $(1)/usr/lib
160 $(CP) \
161 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
162 $(1)/usr/lib/
163
164 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
165 $(CP) \
166 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
167 $(1)/usr/lib/pkgconfig/
168 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/lxc.pc
169 $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/lxc.pc
170 endef
171
172
173 define Package/lxc/install
174 true
175 endef
176
177 define Package/lxc-auto/install
178 $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
179 $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto
180 $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto
181 endef
182
183 define Package/lxc-common/conffiles
184 /etc/lxc/default.conf
185 /etc/lxc/lxc.conf
186 endef
187
188 define Package/lxc-common/install
189 $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
190 $(CP) \
191 $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
192 $(1)/usr/lib/lxc/rootfs/
193
194 $(INSTALL_DIR) $(1)/usr/share/lxc
195 $(CP) \
196 $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
197 $(1)/usr/share/lxc/
198
199 $(INSTALL_DIR) $(1)/etc/lxc/
200 $(CP) \
201 $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
202 $(1)/etc/lxc/default.conf
203
204 $(INSTALL_DIR) $(1)/etc/lxc/
205 $(CP) \
206 ./files/lxc.conf \
207 $(1)/etc/lxc/lxc.conf
208
209 $(INSTALL_DIR) $(1)/srv/lxc/
210 endef
211
212 define Package/lxc-hooks/install
213 $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
214 $(CP) \
215 $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
216 $(1)/usr/share/lxc/hooks/
217 endef
218
219 define Package/lxc-templates/install
220 $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
221 $(CP) \
222 $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
223 $(1)/usr/share/lxc/templates/
224 endef
225
226 define Package/lxc-configs/install
227 $(INSTALL_DIR) $(1)/usr/share/lxc/config/
228 $(CP) \
229 $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
230 $(1)/usr/share/lxc/config/
231 endef
232
233 define Package/liblxc/install
234 $(INSTALL_DIR) $(1)/usr/lib/
235 $(CP) \
236 $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
237 $(1)/usr/lib/
238 endef
239
240 define Package/lxc-init/install
241 $(INSTALL_DIR) $(1)/sbin
242 $(CP) \
243 $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
244 $(1)/sbin/
245 endef
246
247 define GenPlugin
248 define Package/lxc-$(1)
249 $(call Package/lxc/Default)
250 TITLE:=Utility lxc-$(1) from the LXC userspace tools
251 DEPENDS+= +lxc-common $(2) $(DEPENDS_$(1))
252 endef
253
254 define Package/lxc-$(1)/install
255 $(INSTALL_DIR) $$(1)$(3)
256 $(INSTALL_BIN) \
257 $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
258 $$(1)$(3)/
259 endef
260
261 $$(eval $$(call BuildPackage,lxc-$(1)))
262 endef
263
264 $(eval $(call BuildPackage,lxc))
265 $(eval $(call BuildPackage,lxc-common))
266 $(eval $(call BuildPackage,lxc-hooks))
267 $(eval $(call BuildPackage,lxc-configs))
268 $(eval $(call BuildPackage,lxc-templates))
269 $(eval $(call BuildPackage,liblxc))
270 $(eval $(call BuildPackage,lxc-init))
271 $(eval $(call BuildPackage,lxc-auto))
272 $(eval $(call BuildPackage,lxc-unprivileged))
273 $(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
274 $(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/libexec/lxc")))
275 $(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))