# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 # Packages which get releases together: # app-emacs/nxml-libvirt-schemas # dev-python/libvirt-python # dev-perl/Sys-Virt # app-emulation/libvirt # Please bump them together! PYTHON_COMPAT=( python3_{11..14} ) VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/libvirt.org.asc inherit meson flag-o-matic linux-info python-any-r1 readme.gentoo-r1 inherit tmpfiles verify-sig if [[ ${PV} = *9999* ]]; then inherit git-r3 EGIT_REPO_URI="https://gitlab.com/libvirt/libvirt.git" EGIT_BRANCH="master" else SRC_URI="https://download.libvirt.org/${P}.tar.xz verify-sig? ( https://download.libvirt.org/${P}.tar.xz.asc )" KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" fi DESCRIPTION="C toolkit to manipulate virtual machines" HOMEPAGE="https://www.libvirt.org/ https://gitlab.com/libvirt/libvirt/" LICENSE="LGPL-2.1" SLOT="0/${PV}" IUSE=" apparmor audit bash-completion +caps dtrace firewalld fuse glusterfs iscsi iscsi-direct +libvirtd lvm libssh libssh2 lxc nbd nfs nls numa parted pcap policykit +qemu rbd sasl selinux test +udev virtiofsd virtualbox +virt-network wireshark-plugins xen zfs " RESTRICT="!test? ( test )" REQUIRED_USE=" firewalld? ( virt-network ) libvirtd? ( || ( lxc qemu virtualbox xen ) ) lxc? ( caps libvirtd ) qemu? ( libvirtd ) virt-network? ( libvirtd ) virtualbox? ( libvirtd ) xen? ( libvirtd )" BDEPEND=" app-text/xhtml1 dev-lang/perl dev-libs/libxslt dev-perl/XML-XPath dev-python/docutils virtual/pkgconfig bash-completion? ( >=app-shells/bash-completion-2.0 ) verify-sig? ( > ${native_file} <<-EOF || die [binaries] dtrace='stap-dtrace' EOF emesonargs+=( --native-file "${native_file}" ) fi meson_src_configure } src_test() { export VIR_TEST_DEBUG=1 # Don't run the syntax check tests, they're fragile and not relevant # to us downstream anyway. # We also crank up the timeout (as Fedora does) just to preempt failures # on slower arches. meson_src_test --no-suite syntax-check --timeout-multiplier 10 } src_install() { meson_src_install # Depending on configuration option, libvirt will create some bogus # directoreis. They are either not used, or libvirtd is able to create # them on demand, so let's remove them. # # Note, we are using -f here so that rm does not fail or warn if the # directory is nonexistent. rm -rf "${D}"/etc/sysconfig rm -rf "${D}"/var rm -rf "${D}"/run use libvirtd || return 0 # From here, only libvirtd-related instructions, be warned! newtmpfiles "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf newinitd "${S}/libvirtd.init" libvirtd newinitd "${FILESDIR}/libvirt-guests.init-r4" libvirt-guests newinitd "${FILESDIR}/virtlockd.init-r2" virtlockd newinitd "${FILESDIR}/virtlogd.init-r2" virtlogd newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r3") DISABLE_AUTOFORMATTING=true readme.gentoo_create_doc } pkg_postinst() { if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml || die fi use libvirtd || return 0 # From here, only libvirtd-related instructions, be warned! tmpfiles_process libvirtd.conf readme.gentoo_print_elog }