1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_6} )
8 inherit autotools bash-completion-r1 eapi7-ver eutils linux-info perl-functions python-single-r1 xdg-utils
10 MY_PV_1="$(ver_cut 1-2)"
11 MY_PV_2="$(ver_cut 2)"
12 [[ $(( ${MY_PV_2} % 2 )) -eq 0 ]] && SD="stable" || SD="development"
14 DESCRIPTION="Tools for accessing, inspect and modifying virtual machine (VM) disk images"
15 HOMEPAGE="http://libguestfs.org/"
16 SRC_URI="http://libguestfs.org/download/${MY_PV_1}-${SD}/${P}.tar.gz"
18 LICENSE="GPL-2 LGPL-2"
22 IUSE="doc erlang +fuse gtk inspect-icons introspection libvirt lua ocaml +perl python ruby selinux static-libs systemtap test"
23 RESTRICT="!test? ( test )"
25 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
29 # FIXME: selinux support is automagic
33 >=app-misc/hivex-1.3.1
38 >=app-emulation/qemu-2.0[qemu_softmmu_targets_x86_64,systemtap?,selinux?,filecaps]
41 libvirt? ( app-emulation/libvirt )
43 >=sys-apps/fakechroot-2.8
44 >=app-admin/augeas-1.0.0
45 sys-fs/squashfs-tools:*
52 app-arch/unzip[natspec]
54 virtual/perl-ExtUtils-MakeMaker
55 >=dev-perl/Sys-Virt-0.2.4
56 virtual/perl-Getopt-Long
57 virtual/perl-Data-Dumper
59 >=app-misc/hivex-1.3.1[perl?]
60 dev-perl/String-ShellQuote
62 python? ( ${PYTHON_DEPS} )
63 fuse? ( sys-fs/fuse:= )
65 >=dev-libs/glib-2.26:2
66 >=dev-libs/gobject-introspection-1.30.0:=
72 systemtap? ( dev-util/systemtap )
74 >=dev-lang/ocaml-4.02[ocamlopt]
75 dev-ml/findlib[ocamlopt]
79 erlang? ( dev-lang/erlang )
86 lua? ( dev-lang/lua:* )
95 DEPEND="${COMMON_DEPEND}
97 doc? ( app-text/po4a )
98 ruby? ( dev-lang/ruby virtual/rubygems dev-ruby/rake )
99 test? ( introspection? ( dev-libs/gjs ) )
101 RDEPEND="${COMMON_DEPEND}
102 app-emulation/libguestfs-appliance
105 DOCS=( AUTHORS BUGS ChangeLog HACKING README TODO )
108 "${FILESDIR}"/${MY_PV_1}/0001-Update-libtool-initialization.patch
109 "${FILESDIR}"/${MY_PV_1}/0002-Add-support-for-Gentoo-in-distribution-detection.patch
110 "${FILESDIR}"/${MY_PV_1}/0003-Fix-install-failure-when-not-built-with-OCaml-suppor.patch
111 "${FILESDIR}"/${MY_PV_1}/0004-Loosen-build-time-requirement-on-bash-completion.patch
115 CONFIG_CHECK="~KVM ~VIRTIO"
116 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
118 use python && python-single-r1_pkg_setup
123 xdg_environment_reset
128 # Disable feature test for kvm for more reason
129 # i.e: not loaded module in __build__ time,
130 # build server not supported kvm, etc. ...
132 # In fact, this feature is virtio support and requires
134 export vmchannel_test=no
137 --with-bashcompletiondir="$(get_bashcompdir)" \
138 $(use_with libvirt) \
139 --disable-appliance \
141 --with-extra="-gentoo" \
144 $(use_enable python) \
148 $(use_enable ocaml) \
152 $(use_enable introspection gobject) \
153 $(use_enable introspection) \
154 $(use_enable erlang) \
155 $(use_enable static-libs static) \
156 $(use_enable systemtap probes) \
158 --with-gtk=$(usex gtk 3 no) \
159 $(usex doc '' PO4A=no)
164 emake DESTDIR="${D}" install "LINGUAS=""${LINGUAS}"""
165 find "${ED}" -name '*.la' -delete || die
166 use perl && perl_delete_localpod
171 einfo "virt-p2v NOT installed"
173 if ! use ocaml ; then
174 einfo "Ocaml based tools ( sysprep , ... ) NOT installed"
177 einfo "Perl based tools NOT build"