perl-functions.eclass: should 'just work' in EAPI=6
[gentoo.git] / eclass / gnome-python-common-r1.eclass
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: gnome-python-common-r1.eclass
6 # @MAINTAINER:
7 # GNOME team <gnome@gentoo.org>
8 # @AUTHOR:
9 # Author: Michał Górny <mgorny@gentoo.org>
10 # Based on the work of: Arun raghaven <ford_prefect@gentoo.org>
11 # which in turn was based on the work of Jim Ramsay <lack@gentoo.org>
12 # @BLURB: Common functionality for building gnome-python* bindings
13 # @DESCRIPTION:
14 # This eclass provides python-r1 support for the GNOME2 library Python
15 # bindings.
16
17 : ${GNOME_ORG_MODULE:=gnome-python}
18 : ${GNOME_TARBALL_SUFFIX:=bz2}
19 : ${GNOME2_LA_PUNT:=yes}
20 : ${GCONF_DEBUG:=no}
21
22 # @ECLASS-VARIABLE: G_PY_BINDINGS
23 # @DESCRIPTION:
24 # The actual '--enable-<binding>' name. If multiple bindings are to
25 # be enabled, must be an array.
26 : ${G_PY_BINDINGS:=${PN%-python}}
27
28 # @ECLASS-VARIABLE: EXAMPLES
29 # @DEFAULT_UNSET
30 # @DESCRIPTION:
31 # The set of example files to be installed if the 'examples' USE flag
32 # is set.
33
34 case "${EAPI:-0}" in
35         0|1|2|3|4)
36                 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
37                 ;;
38         5)
39                 ;;
40         *)
41                 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
42                 ;;
43 esac
44
45 inherit eutils gnome2 python-r1
46
47 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
48
49 HOMEPAGE="http://pygtk.org/"
50
51 RESTRICT="${RESTRICT} test"
52
53 DOCS="AUTHORS ChangeLog NEWS README"
54
55 if [[ ${GNOME_ORG_MODULE} != "gnome-python" ]]; then
56         DOCS="${DOCS} MAINTAINERS"
57 fi
58
59 RDEPEND="~dev-python/${GNOME_ORG_MODULE}-base-${PV}
60         ${PYTHON_DEPS}"
61 DEPEND="${RDEPEND}
62         virtual/pkgconfig"
63
64 REQUIRED_USE=${PYTHON_REQUIRED_USE}
65
66 gnome-python-common-r1_src_prepare() {
67         gnome2_src_prepare
68
69         # The .pc file is installed by respective gnome-python*-base package
70         sed -i '/^pkgconfig_DATA/d' Makefile.in || die "sed failed"
71         sed -i '/^pkgconfigdir/d' Makefile.in || die "sed failed"
72 #
73 #       python_copy_sources
74 }
75
76 gnome-python-common-r1_src_configure() {
77         local myconf=(
78                 --disable-allbindings
79                 "${G_PY_BINDINGS[@]/#/--enable-}"
80         )
81
82         ECONF_SOURCE=${S} \
83         python_parallel_foreach_impl \
84                 gnome2_src_configure "${myconf[@]}" "${@}"
85 }
86
87 gnome-python-common-r1_src_compile() {
88         python_foreach_impl default
89 }
90
91 gnome-python-common-r1_src_test() {
92         python_foreach_impl default
93 }
94
95 # Do a regular gnome2 src_install and then install examples if required.
96 # Set the variable EXAMPLES to provide the set of examples to be installed.
97 # (to install a directory recursively, specify it with a trailing '/' - for
98 # example, foo/bar/)
99 gnome-python-common-r1_src_install() {
100         python_foreach_impl gnome2_src_install
101
102         if in_iuse examples && use examples; then
103                 docinto examples
104                 dodoc -r "${EXAMPLES[@]}"
105         fi
106 }