1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_{5,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"
24 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
28 # FIXME: selinux support is automagic
32 >=app-misc/hivex-1.3.1
37 >=app-emulation/qemu-2.0[qemu_softmmu_targets_x86_64,systemtap?,selinux?,filecaps]
40 libvirt? ( app-emulation/libvirt )
42 >=sys-apps/fakechroot-2.8
43 >=app-admin/augeas-1.8.0
44 sys-fs/squashfs-tools:*
51 app-arch/unzip[natspec]
53 virtual/perl-ExtUtils-MakeMaker
54 >=dev-perl/Sys-Virt-0.2.4
55 virtual/perl-Getopt-Long
56 virtual/perl-Data-Dumper
58 >=app-misc/hivex-1.3.1[perl?]
59 dev-perl/String-ShellQuote
61 python? ( ${PYTHON_DEPS} )
62 fuse? ( sys-fs/fuse:= )
64 >=dev-libs/glib-2.26:2
65 >=dev-libs/gobject-introspection-1.30.0:=
71 systemtap? ( dev-util/systemtap )
72 ocaml? ( >=dev-lang/ocaml-4.03[ocamlopt] )
73 erlang? ( dev-lang/erlang )
80 lua? ( dev-lang/lua:* )
89 DEPEND="${COMMON_DEPEND}
91 >=dev-lang/ocaml-4.03[ocamlopt]
92 dev-ml/findlib[ocamlopt]
95 doc? ( app-text/po4a )
96 ruby? ( dev-lang/ruby virtual/rubygems dev-ruby/rake )
97 test? ( introspection? ( dev-libs/gjs ) )
99 RDEPEND="${COMMON_DEPEND}
100 app-emulation/libguestfs-appliance
103 DOCS=( AUTHORS BUGS ChangeLog HACKING README TODO )
106 "${FILESDIR}"/${MY_PV_1}/
110 CONFIG_CHECK="~KVM ~VIRTIO"
111 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
113 use python && python-single-r1_pkg_setup
118 xdg_environment_reset
123 # Disable feature test for kvm for more reason
124 # i.e: not loaded module in __build__ time,
125 # build server not supported kvm, etc. ...
127 # In fact, this feature is virtio support and requires
129 export vmchannel_test=no
132 --with-bashcompletiondir="$(get_bashcompdir)" \
133 $(use_with libvirt) \
134 --disable-appliance \
136 --with-extra="-gentoo" \
139 $(use_enable python) \
143 $(use_enable ocaml) \
147 $(use_enable introspection gobject) \
148 $(use_enable introspection) \
149 $(use_enable erlang) \
150 $(use_enable static-libs static) \
151 $(use_enable systemtap probes) \
153 --with-gtk=$(usex gtk 3 no) \
154 $(usex doc '' PO4A=no)
159 emake DESTDIR="${D}" install "LINGUAS=""${LINGUAS}"""
160 find "${ED}" -name '*.la' -delete || die
161 use perl && perl_delete_localpod
166 einfo "virt-p2v NOT installed"
168 if ! use ocaml ; then
169 einfo "Ocaml based tools and bindings (sysprep, ...) NOT installed"
172 einfo "Perl based tools NOT build"