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