| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gnome-python-common.eclass,v 1.16 2012/03/25 15:31:01 eva Exp $
|
| 4 |
|
| 5 |
# Original Author: Arun Raghavan <ford_prefect@gentoo.org> (based on the
|
| 6 |
# gnome-python-desktop eclass by Jim Ramsay <lack@gentoo.org>)
|
| 7 |
#
|
| 8 |
# Purpose: Provides common functionality required for building the gnome-python*
|
| 9 |
# bindings
|
| 10 |
#
|
| 11 |
# Important environment variables:
|
| 12 |
#
|
| 13 |
# G_PY_PN: Which gnome-python* package bindings we're working with. Defaults to
|
| 14 |
# gnome-python if unset.
|
| 15 |
#
|
| 16 |
# G_PY_BINDINGS: The actual '--enable-<binding>' name, which by default is ${PN}
|
| 17 |
# excluding the -python at the end. May be overridden if necessary.
|
| 18 |
#
|
| 19 |
# EXAMPLES: The set of example files to be installed if the 'examples' USE flag
|
| 20 |
# is set.
|
| 21 |
#
|
| 22 |
# The naming convention for all bindings is as follows:
|
| 23 |
# dev-python/<original-${PN}-for-which-this-is-the-binding>-python
|
| 24 |
#
|
| 25 |
# So, for example, with the bonobo bindings, the original package is libbonobo
|
| 26 |
# and the packages is named dev-python/libbonobo-python
|
| 27 |
|
| 28 |
SUPPORT_PYTHON_ABIS="1"
|
| 29 |
RESTRICT_PYTHON_ABIS="3.* *-jython 2.7-pypy-*"
|
| 30 |
|
| 31 |
inherit autotools gnome2 python versionator
|
| 32 |
|
| 33 |
case "${EAPI:-0}" in
|
| 34 |
0|1)
|
| 35 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm
|
| 36 |
;;
|
| 37 |
*)
|
| 38 |
EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm
|
| 39 |
;;
|
| 40 |
esac
|
| 41 |
|
| 42 |
G_PY_PN=${G_PY_PN:-gnome-python}
|
| 43 |
G_PY_BINDINGS=${G_PY_BINDINGS:-${PN%-python}}
|
| 44 |
|
| 45 |
PVP="$(get_version_component_range 1-2)"
|
| 46 |
SRC_URI="mirror://gnome/sources/${G_PY_PN}/${PVP}/${G_PY_PN}-${PV}.tar.bz2"
|
| 47 |
HOMEPAGE="http://pygtk.org/"
|
| 48 |
|
| 49 |
RESTRICT="${RESTRICT} test"
|
| 50 |
|
| 51 |
GCONF_DEBUG="no"
|
| 52 |
DOCS="AUTHORS ChangeLog NEWS README"
|
| 53 |
|
| 54 |
if [[ ${G_PY_PN} != "gnome-python" ]]; then
|
| 55 |
DOCS="${DOCS} MAINTAINERS"
|
| 56 |
fi
|
| 57 |
|
| 58 |
S="${WORKDIR}/${G_PY_PN}-${PV}"
|
| 59 |
|
| 60 |
# add blockers, we can probably remove them later on
|
| 61 |
if [[ ${G_PY_PN} == "gnome-python-extras" ]]; then
|
| 62 |
RDEPEND="!<=dev-python/gnome-python-extras-2.19.1-r2"
|
| 63 |
fi
|
| 64 |
|
| 65 |
RDEPEND="${RDEPEND} ~dev-python/${G_PY_PN}-base-${PV}"
|
| 66 |
DEPEND="${RDEPEND}
|
| 67 |
virtual/pkgconfig"
|
| 68 |
|
| 69 |
# Enable the required bindings as specified by the G_PY_BINDINGS variable
|
| 70 |
gnome-python-common_pkg_setup() {
|
| 71 |
python_pkg_setup
|
| 72 |
|
| 73 |
G2CONF="${G2CONF} --disable-allbindings"
|
| 74 |
for binding in ${G_PY_BINDINGS}; do
|
| 75 |
G2CONF="${G2CONF} --enable-${binding}"
|
| 76 |
done
|
| 77 |
}
|
| 78 |
|
| 79 |
gnome-python-common_src_unpack() {
|
| 80 |
gnome2_src_unpack
|
| 81 |
|
| 82 |
has ${EAPI:-0} 0 1 && gnome-python-common_src_prepare
|
| 83 |
}
|
| 84 |
|
| 85 |
gnome-python-common_src_prepare() {
|
| 86 |
gnome2_src_prepare
|
| 87 |
python_clean_py-compile_files
|
| 88 |
|
| 89 |
# The .pc file is installed by respective gnome-python*-base package
|
| 90 |
sed -i '/^pkgconfig_DATA/d' Makefile.in || die "sed failed"
|
| 91 |
sed -i '/^pkgconfigdir/d' Makefile.in || die "sed failed"
|
| 92 |
|
| 93 |
python_copy_sources
|
| 94 |
}
|
| 95 |
|
| 96 |
gnome-python-common_src_configure() {
|
| 97 |
python_execute_function -s gnome2_src_configure "$@"
|
| 98 |
}
|
| 99 |
|
| 100 |
gnome-python-common_src_compile() {
|
| 101 |
if has ${EAPI:-0} 0 1; then
|
| 102 |
gnome-python-common_src_configure "$@"
|
| 103 |
building() {
|
| 104 |
emake "$@"
|
| 105 |
}
|
| 106 |
python_execute_function -s building "$@"
|
| 107 |
else
|
| 108 |
python_src_compile "$@"
|
| 109 |
fi
|
| 110 |
}
|
| 111 |
|
| 112 |
gnome-python-common_src_test() {
|
| 113 |
if has ${EAPI:-0} 0 1; then
|
| 114 |
testing() {
|
| 115 |
if emake -j1 -n check &> /dev/null; then
|
| 116 |
emake -j1 check "$@"
|
| 117 |
elif emake -j1 -n test &> /dev/null; then
|
| 118 |
emake -j1 test "$@"
|
| 119 |
fi
|
| 120 |
}
|
| 121 |
python_execute_function -s testing "$@"
|
| 122 |
else
|
| 123 |
python_src_test "$@"
|
| 124 |
fi
|
| 125 |
}
|
| 126 |
|
| 127 |
# Do a regular gnome2 src_install and then install examples if required.
|
| 128 |
# Set the variable EXAMPLES to provide the set of examples to be installed.
|
| 129 |
# (to install a directory recursively, specify it with a trailing '/' - for
|
| 130 |
# example, foo/bar/)
|
| 131 |
gnome-python-common_src_install() {
|
| 132 |
python_execute_function -s gnome2_src_install "$@"
|
| 133 |
python_clean_installation_image
|
| 134 |
|
| 135 |
if has examples ${IUSE} && use examples; then
|
| 136 |
insinto /usr/share/doc/${PF}/examples
|
| 137 |
|
| 138 |
for example in ${EXAMPLES}; do
|
| 139 |
if [[ ${example: -1} = "/" ]]; then
|
| 140 |
doins -r ${example}
|
| 141 |
else
|
| 142 |
doins ${example}
|
| 143 |
fi
|
| 144 |
done
|
| 145 |
fi
|
| 146 |
}
|
| 147 |
|
| 148 |
gnome-python-common_pkg_postinst() {
|
| 149 |
python_mod_optimize gtk-2.0
|
| 150 |
}
|
| 151 |
|
| 152 |
gnome-python-common_pkg_postrm() {
|
| 153 |
python_mod_cleanup gtk-2.0
|
| 154 |
}
|