blob: 8ed2505e494aeec008d59e026cb91edaa18ccc38 [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux."
2HOMEPAGE = "http://libvirt.org"
Patrick Williamse69d2352017-02-23 20:56:04 -06003LICENSE = "LGPLv2.1+ & GPLv2+"
4LICENSE_${PN}-ptest = "GPLv2+ & LGPLv2.1+"
Patrick Williamsd849ec72016-08-17 14:59:38 -05005LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
6 file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d"
7SECTION = "console/tools"
Patrick Williamsd849ec72016-08-17 14:59:38 -05008
9DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 iptables dnsmasq readline libtasn1 libxslt-native acl libdevmapper \
11 ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'shadow-native', '', d)}"
Patrick Williamsd849ec72016-08-17 14:59:38 -050012
13# libvirt-guests.sh needs gettext.sh
14#
15RDEPENDS_${PN} = "gettext-runtime"
16
Brad Bishopd7bf8c12018-02-25 22:55:05 -050017RDEPENDS_${PN}-ptest += "make gawk perl"
Patrick Williamsd849ec72016-08-17 14:59:38 -050018
19RDEPENDS_libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd"
20RDEPENDS_libvirt-libvirtd_append_x86-64 = " dmidecode"
21RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode"
22
23#connman blocks the 53 port and libvirtd can't start its DNS service
24RCONFLICTS_${PN}_libvirtd = "connman"
25
26SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
27 file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \
28 file://libvirtd.sh \
29 file://libvirtd.conf \
30 file://runptest.patch \
31 file://run-ptest \
32 file://tests-allow-separated-src-and-build-dirs.patch \
33 file://libvirt-use-pkg-config-to-locate-libcap.patch \
34 file://0001-to-fix-build-error.patch \
35 file://Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch \
Patrick Williamse69d2352017-02-23 20:56:04 -060036 file://install-missing-file.patch \
37 file://0001-nsslinktest-also-build-virAtomic.h.patch \
38 file://0001-qemu-Let-empty-default-VNC-password-work-as-document.patch \
39 file://0001-ptest-add-missing-test_helper-files.patch \
40 file://0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041 file://0001-Added-configure-variable-for-placing-systemd-untis-l.patch \
Patrick Williamsd849ec72016-08-17 14:59:38 -050042 "
43
Patrick Williamse69d2352017-02-23 20:56:04 -060044SRC_URI[libvirt.md5sum] = "f9dc1e63d559eca50ae0ee798a4c6c6d"
45SRC_URI[libvirt.sha256sum] = "93a23c44eb431da46c9458f95a66e29c9b98e37515d44b6be09e75b35ec94ac8"
Patrick Williamsd849ec72016-08-17 14:59:38 -050046
47inherit autotools gettext update-rc.d pkgconfig ptest systemd
48
49CACHED_CONFIGUREVARS += "\
50ac_cv_path_XMLLINT=/usr/bin/xmllint \
51ac_cv_path_XMLCATLOG=/usr/bin/xmlcatalog \
52ac_cv_path_AUGPARSE=/usr/bin/augparse \
53ac_cv_path_DNSMASQ=/usr/bin/dnsmasq \
54ac_cv_path_BRCTL=/usr/sbin/brctl \
55ac_cv_path_TC=/sbin/tc \
56ac_cv_path_UDEVADM=/sbin/udevadm \
57ac_cv_path_MODPROBE=/sbin/modprobe \
58ac_cv_path_IP_PATH=/bin/ip \
59ac_cv_path_IPTABLES_PATH=/usr/sbin/iptables \
60ac_cv_path_IP6TABLES_PATH=/usr/sbin/ip6tables \
61ac_cv_path_MOUNT=/bin/mount \
62ac_cv_path_UMOUNT=/bin/umount \
63ac_cv_path_MKFS=/usr/sbin/mkfs \
64ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \
65ac_cv_path_PVCREATE=/usr/sbin/pvcreate \
66ac_cv_path_VGCREATE=/usr/sbin/vgcreate \
67ac_cv_path_LVCREATE=/usr/sbin/lvcreate \
68ac_cv_path_PVREMOVE=/usr/sbin/pvremove \
69ac_cv_path_VGREMOVE=/usr/sbin/vgremove \
70ac_cv_path_LVREMOVE=/usr/sbin/lvremove \
71ac_cv_path_LVCHANGE=/usr/sbin/lvchange \
72ac_cv_path_VGCHANGE=/usr/sbin/vgchange \
73ac_cv_path_VGSCAN=/usr/sbin/vgscan \
74ac_cv_path_PVS=/usr/sbin/pvs \
75ac_cv_path_VGS=/usr/sbin/vgs \
76ac_cv_path_LVS=/usr/sbin/lvs \
77ac_cv_path_PARTED=/usr/sbin/parted \
78ac_cv_path_DMSETUP=/usr/sbin/dmsetup"
79
80# Ensure that libvirt uses polkit rather than policykit, whether the host has
81# pkcheck installed or not, and ensure the path is correct per our config.
82CACHED_CONFIGUREVARS += "ac_cv_path_PKCHECK_PATH=${bindir}/pkcheck"
83
84# Some other possible paths we are not yet setting
85#ac_cv_path_RPCGEN=
86#ac_cv_path_XSLTPROC=
87#ac_cv_path_RADVD=
88#ac_cv_path_UDEVSETTLE=
89#ac_cv_path_EBTABLES_PATH=
90#ac_cv_path_PKG_CONFIG=
91#ac_cv_path_ac_pt_PKG_CONFIG
92#ac_cv_path_POLKIT_AUTH=
93#ac_cv_path_DTRACE=
94#ac_cv_path_ISCSIADM=
95#ac_cv_path_MSGFMT=
96#ac_cv_path_GMSGFMT=
97#ac_cv_path_XGETTEXT=
98#ac_cv_path_MSGMERGE=
99#ac_cv_path_SCRUB=
100#ac_cv_path_PYTHON=
101
102ALLOW_EMPTY_${PN} = "1"
103
104PACKAGES =+ "${PN}-libvirtd ${PN}-virsh"
105
106ALLOW_EMPTY_${PN}-libvirtd = "1"
107
108FILES_${PN}-libvirtd = " \
109 ${sysconfdir}/init.d \
110 ${sysconfdir}/sysctl.d \
111 ${sysconfdir}/logrotate.d \
112 ${sysconfdir}/libvirt/libvirtd.conf \
113 /usr/lib/sysctl.d/60-libvirtd.conf \
114 ${sbindir}/libvirtd \
115 ${systemd_unitdir}/system/* \
Patrick Williamse69d2352017-02-23 20:56:04 -0600116 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', '${libexecdir}/libvirt-guests.sh', d)} \
Patrick Williamsd849ec72016-08-17 14:59:38 -0500117 "
118
119FILES_${PN}-virsh = "${bindir}/virsh"
120FILES_${PN} += "${libdir}/libvirt/connection-driver \
121 ${datadir}/augeas \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500122 ${@bb.utils.contains('PACKAGECONFIG', 'polkit', '${datadir}/polkit-1', '', d)} \
123 "
Patrick Williamsd849ec72016-08-17 14:59:38 -0500124
125FILES_${PN}-dbg += "${libdir}/libvirt/connection-driver/.debug ${libdir}/libvirt/lock-driver/.debug"
126FILES_${PN}-staticdev += "${libdir}/*.a ${libdir}/libvirt/connection-driver/*.a ${libdir}/libvirt/lock-driver/*.a"
127
128CONFFILES_${PN} += "${sysconfdir}/libvirt/libvirt.conf \
129 ${sysconfdir}/libvirt/lxc.conf \
130 ${sysconfdir}/libvirt/qemu-lockd.conf \
131 ${sysconfdir}/libvirt/qemu.conf \
132 ${sysconfdir}/libvirt/virt-login-shell.conf \
133 ${sysconfdir}/libvirt/virtlockd.conf"
134
135CONFFILES_${PN}-libvirtd = "${sysconfdir}/logrotate.d/libvirt ${sysconfdir}/logrotate.d/libvirt.lxc \
136 ${sysconfdir}/logrotate.d/libvirt.qemu ${sysconfdir}/logrotate.d/libvirt.uml \
137 ${sysconfdir}/libvirt/libvirtd.conf \
138 /usr/lib/sysctl.d/libvirtd.conf"
139
140INITSCRIPT_PACKAGES = "${PN}-libvirtd"
141INITSCRIPT_NAME_${PN}-libvirtd = "libvirtd"
142INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72"
143
144SYSTEMD_PACKAGES = "${PN}-libvirtd"
145SYSTEMD_SERVICE_${PN}-libvirtd = " \
Patrick Williamsd849ec72016-08-17 14:59:38 -0500146 libvirtd.service \
147 virtlockd.service \
148 libvirt-guests.service \
149 virtlockd.socket \
150 "
151
152
153PRIVATE_LIBS_${PN}-ptest = " \
154 libvirt-lxc.so.0 \
155 libvirt.so.0 \
156 libvirt-qemu.so.0 \
157 lockd.so \
158 libvirt_driver_secret.so \
159 libvirt_driver_nodedev.so \
160 libvirt_driver_vbox.so \
161 libvirt_driver_interface.so \
162 libvirt_driver_uml.so \
163 libvirt_driver_network.so \
164 libvirt_driver_nwfilter.so \
165 libvirt_driver_qemu.so \
166 libvirt_driver_storage.so \
167 libvirt_driver_lxc.so \
168 "
169
170# xen-minimal config
171#PACKAGECONFIG ??= "xen libxl xen-inotify test remote libvirtd"
172
173# full config
174PACKAGECONFIG ??= "qemu yajl uml openvz vmware vbox esx iproute2 lxc test \
175 remote macvtap libvirtd netcf udev python ebtables \
Patrick Williamse69d2352017-02-23 20:56:04 -0600176 ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit libcap-ng', '', d)} \
177 ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen libxl xen-inotify', '', d)} \
178 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'polkit', '', d)} \
Patrick Williamsd849ec72016-08-17 14:59:38 -0500179 "
180
181# enable,disable,depends,rdepends
182#
183PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu,"
184PACKAGECONFIG[yajl] = "--with-yajl,--without-yajl,yajl,yajl"
185PACKAGECONFIG[xen] = "--with-xen,--without-xen,xen,"
186PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi,,"
187PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,libxl,"
188PACKAGECONFIG[xen-inotify] = "--with-xen-inotify,--without-xen-inotify,xen,"
189PACKAGECONFIG[uml] = "--with-uml, --without-uml,,"
190PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz,,"
191PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware,,"
192PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp,,"
193PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox,,"
194PACKAGECONFIG[esx] = "--with-esx,--without-esx,,"
195PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv,,"
196PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit,polkit"
197PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc,"
198PACKAGECONFIG[test] = "--with-test=yes,--with-test=no,,"
199PACKAGECONFIG[remote] = "--with-remote,--without-remote,,"
200PACKAGECONFIG[macvtap] = "--with-macvtap=yes,--with-macvtap=no,libnl,libnl"
201PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd,,"
202PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf"
203PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,,"
204PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess,"
205PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux,"
206PACKAGECONFIG[ebtables] = "ac_cv_path_EBTABLES_PATH=/sbin/ebtables,ac_cv_path_EBTABLES_PATH=,ebtables,ebtables"
207PACKAGECONFIG[python] = ",,python,"
208PACKAGECONFIG[sasl] = "--with-sasl,--without-sasl,cyrus-sasl,cyrus-sasl"
209PACKAGECONFIG[iproute2] = "ac_cv_path_IP_PATH=/sbin/ip,ac_cv_path_IP_PATH=,iproute2,iproute2"
210PACKAGECONFIG[numactl] = "--with-numactl,--without-numactl,numactl,"
211PACKAGECONFIG[fuse] = "--with-fuse,--without-fuse,fuse,"
212PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
213PACKAGECONFIG[libcap-ng] = "--with-capng,--without-capng,libcap-ng,"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500214PACKAGECONFIG[wireshark] = "--with-wireshark-dissector,--without-wireshark-dissector,wireshark libwsutil,"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500215
216# Enable the Python tool support
217require libvirt-python.inc
218
219do_install_append() {
220 install -d ${D}/etc/init.d
221 install -d ${D}/etc/libvirt
222
223 install -m 0755 ${WORKDIR}/libvirtd.sh ${D}/etc/init.d/libvirtd
224 install -m 0644 ${WORKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf
225
226 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
227 # This will wind up in the libvirtd package, but will NOT be invoked by default.
228 #
229 mv ${D}/${libexecdir}/libvirt-guests.sh ${D}/${sysconfdir}/init.d
230 fi
231
232 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
233 # This variable is used by libvirtd.service to start libvirtd in the right mode
234 sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd
235
236 # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities.
237 sed -i -e 's/Type=notify/Type=forking/' \
238 -e '/Type=forking/a PIDFile=${localstatedir}/run/libvirtd.pid' \
239 ${D}/${systemd_unitdir}/system/libvirtd.service
240 fi
241
242 # The /var/run/libvirt directories created by the Makefile
243 # are wiped out in volatile, we need to create these at boot.
244 rm -rf ${D}${localstatedir}/run
245 install -d ${D}${sysconfdir}/default/volatiles
246 echo "d root root 0755 ${localstatedir}/run/libvirt none" \
247 > ${D}${sysconfdir}/default/volatiles/99_libvirt
248 echo "d root root 0755 ${localstatedir}/run/libvirt/lockd none" \
249 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
250 echo "d root root 0755 ${localstatedir}/run/libvirt/lxc none" \
251 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
252 echo "d root root 0755 ${localstatedir}/run/libvirt/network none" \
253 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
254 echo "d root root 0755 ${localstatedir}/run/libvirt/qemu none" \
255 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
256
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500257 # Manually set permissions and ownership to match polkit recipe
258 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
259 install -d -m 0700 ${D}/${datadir}/polkit-1/rules.d
260 chown polkitd ${D}/${datadir}/polkit-1/rules.d
261 chgrp root ${D}/${datadir}/polkit-1/rules.d
262 else
263 rm -rf ${D}/${datadir}/polkit-1
264 fi
265
Patrick Williamsd849ec72016-08-17 14:59:38 -0500266 # Add hook support for libvirt
Patrick Williamse69d2352017-02-23 20:56:04 -0600267 mkdir -p ${D}/etc/libvirt/hooks
Patrick Williamsd849ec72016-08-17 14:59:38 -0500268
269 # remove .la references to our working diretory
270 for i in `find ${D}${libdir} -type f -name *.la`; do
271 sed -i -e 's#-L${B}/src/.libs##g' $i
272 done
273}
274
275EXTRA_OECONF += " \
276 --with-init-script=systemd \
277 "
278
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500279EXTRA_OEMAKE = "BUILD_DIR=${B} DEST_DIR=${D}${PTEST_PATH} PTEST_DIR=${PTEST_PATH} SYSTEMD_UNIT_DIR=${systemd_system_unitdir}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500280
281do_compile_ptest() {
282 oe_runmake -C tests buildtest-TESTS
283}
284
285do_install_ptest() {
286 oe_runmake -C tests install-ptest
287
Patrick Williamse69d2352017-02-23 20:56:04 -0600288 find ${S}/tests -maxdepth 1 -type d -exec cp -r {} ${D}${PTEST_PATH}/tests/ \;
289
Patrick Williamsd849ec72016-08-17 14:59:38 -0500290 # remove .la files for ptest, they aren't required and can trigger QA errors
Patrick Williamse69d2352017-02-23 20:56:04 -0600291 for i in `find ${D}${PTEST_PATH} -type f \( -name *.la -o -name *.o \)`; do
Patrick Williamsd849ec72016-08-17 14:59:38 -0500292 rm -f $i
293 done
294}
295
296pkg_postinst_libvirt() {
297 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
298 /etc/init.d/populate-volatile.sh update
299 fi
300}
301
302python () {
303 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
304 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
305}