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