x11-themes/gentoo10-backgrounds: Cleanup per bug #85210
[gentoo.git] / eclass / php-ext-pecl-r3.eclass
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: php-ext-pecl-r3.eclass
6 # @MAINTAINER:
7 # Gentoo PHP team <php-bugs@gentoo.org>
8 # @BLURB: A uniform way to install PECL extensions
9 # @DESCRIPTION:
10 # This eclass should be used by all dev-php/pecl-* ebuilds as a uniform
11 # way of installing PECL extensions. For more information about PECL,
12 # see http://pecl.php.net/
13
14 # @ECLASS-VARIABLE: PHP_EXT_PECL_PKG
15 # @DESCRIPTION:
16 # Set in ebuild before inheriting this eclass if the tarball name
17 # differs from ${PN/pecl-/} so that SRC_URI and HOMEPAGE get set
18 # correctly by the eclass.
19 #
20 # Setting this variable manually also affects PHP_EXT_NAME and ${S}
21 # unless you override those in ebuild. If that is not desired, please
22 # use PHP_EXT_PECL_FILENAME instead.
23 [[ -z "${PHP_EXT_PECL_PKG}" ]] && PHP_EXT_PECL_PKG="${PN/pecl-/}"
24
25 # @ECLASS-VARIABLE: PHP_EXT_PECL_FILENAME
26 # @DEFAULT_UNSET
27 # @DESCRIPTION:
28 # Set in ebuild before inheriting this eclass if the tarball name
29 # differs from "${PN/pecl-/}-${PV}.tgz" so that SRC_URI gets set
30 # correctly by the eclass.
31 #
32 # Unlike PHP_EXT_PECL_PKG, setting this variable does not affect
33 # HOMEPAGE, PHP_EXT_NAME or ${S}.
34
35
36 # Set PHP_EXT_NAME for php-ext-source-r3.eclass.
37 [[ -z "${PHP_EXT_NAME}" ]] && PHP_EXT_NAME="${PHP_EXT_PECL_PKG}"
38
39 # Try to guess the upstream name of the package/version. We only use
40 # this variable temporarily before unsetting it.
41 PHP_EXT_PECL_PKG_V="${PHP_EXT_PECL_PKG}-${PV/_/}"
42
43 # It's important that we determine and set $S before we inherit below.
44 S="${WORKDIR}/${PHP_EXT_PECL_PKG_V}"
45
46 inherit php-ext-source-r3
47
48 EXPORT_FUNCTIONS src_install src_test
49
50 if [[ -z "${PHP_EXT_PECL_FILENAME}" ]] ; then
51         SRC_URI="http://pecl.php.net/get/${PHP_EXT_PECL_PKG_V}.tgz"
52 else
53         SRC_URI="http://pecl.php.net/get/${PHP_EXT_PECL_FILENAME}"
54 fi
55
56 # Don't leave this laying around in the environment.
57 unset PHP_EXT_PECL_PKG_V
58
59 HOMEPAGE="http://pecl.php.net/${PHP_EXT_PECL_PKG}"
60
61
62 # @FUNCTION: php-ext-pecl-r3_src_install
63 # @DESCRIPTION:
64 # Install a standard PECL package. First we delegate to
65 # php-ext-source-r3.eclass, and then we attempt to install examples
66 # found in a standard location.
67 php-ext-pecl-r3_src_install() {
68         php-ext-source-r3_src_install
69
70         if in_iuse examples && use examples ; then
71                 dodoc -r examples
72         fi
73 }
74
75
76 # @FUNCTION: php-ext-pecl-r3_src_test
77 # @DESCRIPTION:
78 # Run tests delivered with the PECL package. Phpize will have generated
79 # a run-tests.php file to be executed by `make test`. We only need to
80 # force the test suite to run in non-interactive mode.
81 php-ext-pecl-r3_src_test() {
82         for slot in $(php_get_slots); do
83                 php_init_slot_env "${slot}"
84                 NO_INTERACTION="yes" emake test
85         done
86 }