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