1################################################################################
2#
3# libvirt
4#
5################################################################################
6
7LIBVIRT_VERSION = 7.10.0
8LIBVIRT_SITE = https://libvirt.org/sources
9LIBVIRT_SOURCE = libvirt-$(LIBVIRT_VERSION).tar.xz
10LIBVIRT_LICENSE = LGPL-2.1+
11LIBVIRT_LICENSE_FILES = COPYING
12LIBVIRT_CPE_ID_VENDOR = redhat
13LIBVIRT_INSTALL_STAGING = YES
14LIBVIRT_DEPENDENCIES = \
15	host-libxslt \
16	host-nfs-utils \
17	host-pkgconf \
18	host-python-docutils \
19	gnutls \
20	libglib2 \
21	libpciaccess \
22	libtirpc \
23	libxml2 \
24	udev \
25	zlib \
26	$(TARGET_NLS_DEPENDENCIES)
27
28LIBVIRT_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
29
30LIBVIRT_CONF_ENV += \
31	CFLAGS="$(TARGET_CFLAGS) `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`" \
32	LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`"
33
34LIBVIRT_CONF_OPTS = \
35	-Drpath=disabled \
36	-Dapparmor=disabled \
37	-Ddocs=disabled \
38	-Ddriver_bhyve=disabled \
39	-Ddriver_ch=disabled \
40	-Ddriver_esx=disabled \
41	-Ddriver_hyperv=disabled \
42	-Ddriver_libxl=disabled \
43	-Ddriver_openvz=disabled \
44	-Ddriver_remote=enabled \
45	-Ddriver_secrets=enabled \
46	-Ddriver_test=disabled \
47	-Ddriver_vbox=disabled \
48	-Ddriver_vmware=disabled \
49	-Ddriver_vz=disabled \
50	-Ddtrace=disabled \
51	-Dexpensive_tests=disabled \
52	-Dfirewalld=disabled \
53	-Dfirewalld_zone=disabled \
54	-Dglusterfs=disabled \
55	-Dhost_validate=enabled \
56	-Dinit_script=$(if $(BR2_INIT_SYSTEMD),systemd,none) \
57	-Dlogin_shell=disabled \
58	-Dnetcf=disabled \
59	-Dnls=$(if $(BR2_SYSTEM_ENABLE_NLS),enabled,disabled) \
60	-Dnumad=disabled \
61	-Dopenwsman=disabled \
62	-Dpciaccess=enabled \
63	-Dpm_utils=disabled \
64	-Dsanlock=disabled \
65	-Dsasl=disabled \
66	-Dsecdriver_apparmor=disabled \
67	-Dstorage_iscsi=disabled \
68	-Dstorage_iscsi_direct=disabled \
69	-Dstorage_mpath=disabled \
70	-Dsysctl_config=enabled \
71	-Dtest_coverage=false \
72	-Dtests=disabled \
73	-Dudev=enabled \
74	-Dwireshark_dissector=disabled
75
76# warning_level should only drive the level of warnings during the
77# compilation of C code. However, libvirt misuses that to also
78# enable SSP when warning_level == 2
79# Force warning_level=1 to disable SSP, and let our toolchain wrapper
80# handle it.
81LIBVIRT_CONF_OPTS += -Dwarning_level=1
82
83ifeq ($(BR2_PACKAGE_ATTR),y)
84LIBVIRT_CONF_OPTS += -Dattr=enabled
85LIBVIRT_DEPENDENCIES += attr
86else
87LIBVIRT_CONF_OPTS += -Dattr=disabled
88endif
89
90ifeq ($(BR2_PACKAGE_AUDIT),y)
91LIBVIRT_CONF_OPTS += -Daudit=enabled
92LIBVIRT_DEPENDENCIES += audit
93else
94LIBVIRT_CONF_OPTS += -Daudit=disabled
95endif
96
97ifeq ($(BR2_PACKAGE_BASH_COMPLETION),y)
98LIBVIRT_CONF_OPTS += -Dbash_completion=enabled
99LIBVIRT_DEPENDENCIES += bash-completion
100else
101LIBVIRT_CONF_OPTS += -Dbash_completion=disabled
102endif
103
104ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),y)
105LIBVIRT_CONF_OPTS += -Dblkid=enabled
106LIBVIRT_DEPENDENCIES += util-linux
107else
108LIBVIRT_CONF_OPTS += -Dblkid=disabled
109endif
110
111ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
112LIBVIRT_CONF_OPTS += -Dcapng=enabled
113LIBVIRT_DEPENDENCIES += libcap-ng
114else
115LIBVIRT_CONF_OPTS += -Dcapng=disabled
116endif
117
118ifeq ($(BR2_PACKAGE_LIBCURL),y)
119LIBVIRT_CONF_OPTS += -Dcurl=enabled
120LIBVIRT_DEPENDENCIES += libcurl
121else
122LIBVIRT_CONF_OPTS += -Dcurl=disabled
123endif
124
125ifeq ($(BR2_PACKAGE_LIBFUSE),y)
126LIBVIRT_CONF_OPTS += -Dfuse=enabled
127LIBVIRT_DEPENDENCIES += libfuse
128else
129LIBVIRT_CONF_OPTS += -Dfuse=disabled
130endif
131
132ifeq ($(BR2_PACKAGE_LIBISCSI),y)
133LIBVIRT_CONF_OPTS += -Dlibiscsi=enabled
134LIBVIRT_DEPENDENCIES += libiscsi
135else
136LIBVIRT_CONF_OPTS += -Dlibiscsi=disabled
137endif
138
139ifeq ($(BR2_PACKAGE_LIBNL),y)
140LIBVIRT_CONF_OPTS += -Dlibnl=enabled
141LIBVIRT_DEPENDENCIES += libnl
142else
143LIBVIRT_CONF_OPTS += -Dlibnl=disabled
144endif
145
146ifeq ($(BR2_PACKAGE_LIBPCAP),y)
147LIBVIRT_CONF_OPTS += -Dlibpcap=enabled
148LIBVIRT_DEPENDENCIES += libpcap
149else
150LIBVIRT_CONF_OPTS += -Dlibpcap=disabled
151endif
152
153ifeq ($(BR2_PACKAGE_NUMACTL),y)
154LIBVIRT_CONF_OPTS += -Dnumactl=enabled
155LIBVIRT_DEPENDENCIES += numactl
156else
157LIBVIRT_CONF_OPTS += -Dnumactl=disabled
158endif
159
160ifeq ($(BR2_PACKAGE_POLKIT),y)
161LIBVIRT_CONF_OPTS += -Dpolkit=enabled
162LIBVIRT_DEPENDENCIES += polkit
163else
164LIBVIRT_CONF_OPTS += -Dpolkit=disabled
165endif
166
167ifeq ($(BR2_PACKAGE_READLINE),y)
168LIBVIRT_CONF_OPTS += -Dreadline=enabled
169LIBVIRT_DEPENDENCIES += readline
170else
171LIBVIRT_CONF_OPTS += -Dreadline=disabled
172endif
173
174ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
175LIBVIRT_CONF_OPTS += -Dselinux=enabled -Dsecdriver_selinux=enabled \
176	-Dselinux_mount=/sys/fs/selinux
177LIBVIRT_DEPENDENCIES += libselinux
178else
179LIBVIRT_CONF_OPTS += -Dselinux=disabled -Dsecdriver_selinux=disabled
180endif
181
182ifeq ($(BR2_PACKAGE_LVM2_STANDARD_INSTALL),y)
183LIBVIRT_CONF_OPTS += -Dstorage_lvm=enabled
184LIBVIRT_DEPENDENCIES += host-lvm2 lvm2
185else
186LIBVIRT_CONF_OPTS += -Dstorage_lvm=disabled
187endif
188
189ifeq ($(BR2_PACKAGE_YAJL),y)
190LIBVIRT_CONF_OPTS += -Dyajl=enabled
191LIBVIRT_DEPENDENCIES += yajl
192else
193LIBVIRT_CONF_OPTS += -Dyajl=disabled
194endif
195
196ifeq ($(BR2_PACKAGE_LIBVIRT_DAEMON),y)
197# Network is used by daemon, only
198LIBVIRT_CONF_OPTS += \
199	-Ddriver_interface=enabled \
200	-Ddriver_libvirtd=enabled \
201	-Ddriver_network=enabled
202
203ifeq ($(BR2_PACKAGE_LIBSSH),y)
204LIBVIRT_CONF_OPTS += -Dlibssh=enabled
205LIBVIRT_DEPENDENCIES += libssh
206else
207LIBVIRT_CONF_OPTS += -Dlibssh=disabled
208endif
209
210# Can't build nss plugin without network or yajl
211ifeq ($(BR2_PACKAGE_LIBNSS)$(BR2_PACKAGE_YAJL),yy)
212LIBVIRT_CONF_OPTS += -Dnss=enabled
213LIBVIRT_DEPENDENCIES += libnss
214else
215LIBVIRT_CONF_OPTS += -Dnss=disabled
216endif
217
218ifeq ($(BR2_PACKAGE_LIBSSH2),y)
219LIBVIRT_CONF_OPTS += -Dlibssh2=enabled
220LIBVIRT_DEPENDENCIES += libssh2
221else
222LIBVIRT_CONF_OPTS += -Dlibssh2=disabled
223endif
224
225ifeq ($(BR2_PACKAGE_LIBVIRT_LXC),y)
226LIBVIRT_CONF_OPTS += -Dlogin_shell=enabled -Ddriver_lxc=enabled
227LIBVIRT_DEPENDENCIES += lxc
228else
229LIBVIRT_CONF_OPTS += -Dlogin_shell=disabled -Ddriver_lxc=disabled
230endif
231
232ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y)
233LIBVIRT_CONF_OPTS += -Ddriver_qemu=enabled -Dqemu_user=qemu -Dqemu_group=kvm
234else
235LIBVIRT_CONF_OPTS += -Ddriver_qemu=disabled -Dqemu_user=no -Dqemu_group=no
236endif
237
238else # BR2_PACKAGE_LIBVIRT_DAEMON
239
240LIBVIRT_CONF_OPTS += \
241	-Ddriver_interface=disabled \
242	-Ddriver_libvirtd=disabled \
243	-Ddriver_network=disabled
244
245endif
246
247define LIBVIRT_INSTALL_UDEV_RULES
248	$(INSTALL) -D -m 644 package/libvirt/90-kvm.rules \
249		$(TARGET_DIR)/etc/udev/rules.d/90-kvm.rules
250endef
251LIBVIRT_POST_INSTALL_TARGET_HOOKS += LIBVIRT_INSTALL_UDEV_RULES
252
253# Adjust directory ownerships and permissions. Notice /var/log is a symlink to
254# /tmp in the default sysvinit skeleton, so some directories may disappear at
255# run-time. Set the permissions anyway, since they are valid for the default
256# systemd skeleton.
257define LIBVIRT_PERMISSIONS
258	/etc/libvirt                             d  700  root  root  -  -  -  -  -
259	/etc/libvirt/nwfilter                    d  700  root  root  -  -  -  -  -
260	/var/lib/libvirt                         d  755  root  root  -  -  -  -  -
261	/var/lib/libvirt/boot                    d  711  root  root  -  -  -  -  -
262	/var/lib/libvirt/dnsmasq                 d  755  root  root  -  -  -  -  -
263	/var/lib/libvirt/filesystems             d  711  root  root  -  -  -  -  -
264	/var/lib/libvirt/images                  d  711  root  root  -  -  -  -  -
265	/var/lib/libvirt/network                 d  700  root  root  -  -  -  -  -
266	/var/lib/libvirt/qemu                    d  751  qemu  kvm   -  -  -  -  -
267	/var/lib/libvirt/qemu/autostart          d  700  root  root  -  -  -  -  -
268	/var/lib/libvirt/qemu/networks           d  700  root  root  -  -  -  -  -
269	/var/lib/libvirt/qemu/networks/autostart d  700  root  root  -  -  -  -  -
270	/var/lib/libvirt/qemu/channel            d  755  qemu  kvm   -  -  -  -  -
271	/var/lib/libvirt/qemu/channel/target     d  755  qemu  kvm   -  -  -  -  -
272	/var/lib/libvirt/qemu/dump               d  755  qemu  kvm   -  -  -  -  -
273	/var/lib/libvirt/qemu/nvram              d  755  qemu  kvm   -  -  -  -  -
274	/var/lib/libvirt/qemu/save               d  755  qemu  kvm   -  -  -  -  -
275	/var/lib/libvirt/qemu/snapshot           d  755  qemu  kvm   -  -  -  -  -
276	/var/lib/libvirt/secrets                 d  700  root  root  -  -  -  -  -
277	/var/lib/libvirt/storage                 d  755  root  root  -  -  -  -  -
278	/var/lib/libvirt/storage/autostart       d  755  root  root  -  -  -  -  -
279	/var/cache/libvirt                       d  711  root  root  -  -  -  -  -
280	/var/cache/libvirt/lxc                   d  750  root  root  -  -  -  -  -
281	/var/cache/libvirt/qemu                  d  750  qemu  kvm   -  -  -  -  -
282	/var/cache/libvirt/qemu/capabilities     d  755  root  root  -  -  -  -  -
283	/var/log/libvirt                         d  700  root  root  -  -  -  -  -
284	/var/log/libvirt/lxc                     d  750  root  root  -  -  -  -  -
285	/var/log/libvirt/qemu                    d  750  root  root  -  -  -  -  -
286	/var/log/swtpm                           d  755  root  root  -  -  -  -  -
287	/var/log/swtpm/libvirt                   d  755  root  root  -  -  -  -  -
288	/var/log/swtpm/libvirt/qemu              d  711  root  root  -  -  -  -  -
289endef
290
291# libvirt may need to create persistent files (e.g. VM definitions) in these
292# directories. Move them to /var/lib because /etc may be on a read-only or
293# volatile (initramfs) filesystem. We could tweak the code to change these
294# paths but the patch would be large and would break compatibility with
295# ordinary installations and with the documentation.
296define LIBVIRT_CREATE_SYMLINKS
297	$(INSTALL) -m 700 -d $(TARGET_DIR)/etc/libvirt
298	$(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt
299	$(INSTALL) -m 751 -d $(TARGET_DIR)/var/lib/libvirt/qemu
300	$(INSTALL) -m 700 -d $(TARGET_DIR)/var/lib/libvirt/secrets
301	$(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt/storage
302	ln -s -f ../../var/lib/libvirt/qemu $(TARGET_DIR)/etc/libvirt/
303	ln -s -f ../../var/lib/libvirt/secrets $(TARGET_DIR)/etc/libvirt/
304	ln -s -f ../../var/lib/libvirt/storage $(TARGET_DIR)/etc/libvirt/
305endef
306
307LIBVIRT_PRE_INSTALL_TARGET_HOOKS += LIBVIRT_CREATE_SYMLINKS
308
309ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y)
310define LIBVIRT_USERS
311	qemu -1 kvm -1 * - - - Libvirt qemu/kvm daemon
312endef
313endif
314
315ifeq ($(BR2_PACKAGE_LIBVIRT_DAEMON),y)
316define LIBVIRT_INSTALL_INIT_SYSV
317	$(INSTALL) -D -m 0755 package/libvirt/S91virtlogd $(TARGET_DIR)/etc/init.d/S91virtlogd
318	$(INSTALL) -D -m 0755 package/libvirt/S92libvirtd $(TARGET_DIR)/etc/init.d/S92libvirtd
319endef
320endif
321
322$(eval $(meson-package))
323