*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-emulation / libguestfs / libguestfs-1.36.15.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python{2_7,3_6} )
7
8 inherit autotools bash-completion-r1 eapi7-ver eutils linux-info perl-functions python-single-r1 xdg-utils
9
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"
13
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"
17
18 LICENSE="GPL-2 LGPL-2"
19 SLOT="0/"${MY_PV_1}""
20
21 KEYWORDS="~amd64"
22 IUSE="doc erlang +fuse gtk inspect-icons introspection libvirt lua ocaml +perl python ruby selinux static-libs systemtap test"
23 RESTRICT="!test? ( test )"
24
25 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26
27 # Failures - doc
28
29 # FIXME: selinux support is automagic
30 COMMON_DEPEND="
31         sys-libs/ncurses:0=
32         sys-devel/gettext
33         >=app-misc/hivex-1.3.1
34         dev-libs/libpcre:3
35         app-arch/cpio
36         dev-lang/perl:=
37         virtual/cdrtools
38         >=app-emulation/qemu-2.0[qemu_softmmu_targets_x86_64,systemtap?,selinux?,filecaps]
39         sys-apps/fakeroot
40         sys-apps/file
41         libvirt? ( app-emulation/libvirt )
42         dev-libs/libxml2:2
43         >=sys-apps/fakechroot-2.8
44         >=app-admin/augeas-1.0.0
45         sys-fs/squashfs-tools:*
46         dev-libs/libconfig
47         sys-libs/readline:0=
48         >=sys-libs/db-4.6:*
49         app-arch/xz-utils
50         app-arch/lzma
51         app-crypt/gnupg
52         app-arch/unzip[natspec]
53         perl? (
54                 virtual/perl-ExtUtils-MakeMaker
55                 >=dev-perl/Sys-Virt-0.2.4
56                 virtual/perl-Getopt-Long
57                 virtual/perl-Data-Dumper
58                 dev-perl/libintl-perl
59                 >=app-misc/hivex-1.3.1[perl?]
60                 dev-perl/String-ShellQuote
61         )
62         python? ( ${PYTHON_DEPS} )
63         fuse? ( sys-fs/fuse:= )
64         introspection? (
65                 >=dev-libs/glib-2.26:2
66                 >=dev-libs/gobject-introspection-1.30.0:=
67         )
68         selinux? (
69                 sys-libs/libselinux
70                 sys-libs/libsemanage
71         )
72         systemtap? ( dev-util/systemtap )
73         ocaml? (
74                 >=dev-lang/ocaml-4.02[ocamlopt]
75                 dev-ml/findlib[ocamlopt]
76                 dev-ml/ocaml-gettext
77                 >=dev-ml/ounit-2
78         )
79         erlang? ( dev-lang/erlang )
80         inspect-icons? (
81                 media-libs/netpbm
82                 media-gfx/icoutils
83         )
84         virtual/acl
85         sys-libs/libcap
86         lua? ( dev-lang/lua:* )
87         >=dev-libs/yajl-2.0.4
88         gtk? (
89                 sys-apps/dbus
90                 x11-libs/gtk+:3
91         )
92         net-libs/libtirpc
93         sys-libs/libxcrypt
94         "
95 DEPEND="${COMMON_DEPEND}
96         dev-util/gperf
97         doc? ( app-text/po4a )
98         ruby? ( dev-lang/ruby virtual/rubygems dev-ruby/rake )
99         test? ( introspection? ( dev-libs/gjs ) )
100         "
101 RDEPEND="${COMMON_DEPEND}
102         app-emulation/libguestfs-appliance
103         "
104
105 DOCS=( AUTHORS BUGS ChangeLog HACKING README TODO )
106
107 PATCHES=(
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
112 )
113
114 pkg_setup () {
115                 CONFIG_CHECK="~KVM ~VIRTIO"
116                 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
117
118                 use python && python-single-r1_pkg_setup
119 }
120
121 src_prepare() {
122         default
123         xdg_environment_reset
124         eautoreconf
125 }
126
127 src_configure() {
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. ...
131         #
132         # In fact, this feature is virtio support and requires
133         # configured kernel.
134         export vmchannel_test=no
135
136         econf \
137                 --with-bashcompletiondir="$(get_bashcompdir)" \
138                 $(use_with libvirt) \
139                 --disable-appliance \
140                 --disable-daemon \
141                 --with-extra="-gentoo" \
142                 --with-readline \
143                 --disable-php \
144                 $(use_enable python) \
145                 --without-java \
146                 $(use_enable perl) \
147                 $(use_enable fuse) \
148                 $(use_enable ocaml) \
149                 $(use_enable ruby) \
150                 --disable-haskell \
151                 --disable-golang \
152                 $(use_enable introspection gobject) \
153                 $(use_enable introspection) \
154                 $(use_enable erlang) \
155                 $(use_enable static-libs static) \
156                 $(use_enable systemtap probes) \
157                 $(use_enable lua) \
158                 --with-gtk=$(usex gtk 3 no) \
159                 $(usex doc '' PO4A=no)
160 }
161
162 src_install() {
163         strip-linguas -i po
164         emake DESTDIR="${D}" install "LINGUAS=""${LINGUAS}"""
165         find "${ED}" -name '*.la' -delete || die
166         use perl && perl_delete_localpod
167 }
168
169 pkg_postinst() {
170         if ! use gtk ; then
171                 einfo "virt-p2v NOT installed"
172         fi
173         if ! use ocaml ; then
174                 einfo "Ocaml based tools ( sysprep , ... ) NOT installed"
175         fi
176         if ! use perl ; then
177                 einfo "Perl based tools NOT build"
178         fi
179 }