| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2007 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/php-ext-pecl-r1.eclass,v 1.3 2005/11/20 01:35:05 chtekk Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/php-ext-pecl-r1.eclass,v 1.12 2010/09/13 13:44:14 mabi Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Tal Peer <coredumb@gentoo.org> |
5 | # Author: Tal Peer <coredumb@gentoo.org> |
| 6 | # Maintained by the PHP Herd <php-bugs@gentoo.org> |
6 | # Author: Luca Longinotti <chtekk@gentoo.org> |
|
|
7 | # Author: Jakub Moc <jakub@gentoo.org> |
|
|
8 | |
|
|
9 | # @ECLASS: php-ext-pecl-r1.eclass |
|
|
10 | # @MAINTAINER: |
|
|
11 | # Gentoo PHP team <php-bugs@gentoo.org> |
|
|
12 | # @BLURB: A uniform way of installing PECL extensions |
|
|
13 | # @DESCRIPTION: |
|
|
14 | # This eclass should be used by all dev-php[45]/pecl-* ebuilds |
|
|
15 | # as a uniform way of installing PECL extensions. |
|
|
16 | # For more information about PECL, see http://pecl.php.net/ |
|
|
17 | |
|
|
18 | # @ECLASS-VARIABLE: PHP_EXT_PECL_PKG |
|
|
19 | # @DESCRIPTION: |
|
|
20 | # Set in ebuild before inheriting this eclass if the tarball name |
|
|
21 | # differs from ${PN/pecl-/} so that SRC_URI and HOMEPAGE gets set |
|
|
22 | # correctly by the eclass. |
| 7 | # |
23 | # |
| 8 | # This eclass should be used by all dev-php[4,5]/pecl-* ebuilds, as a uniform way of installing PECL extensions. |
24 | # Setting this variable manually also affects PHP_EXT_NAME and ${S} |
| 9 | # For more information about PECL, see: http://pecl.php.net |
25 | # unless you override those in ebuild. Also see PHP_EXT_PECL_FILENAME |
|
|
26 | # if this is not desired for whatever reason. |
| 10 | |
27 | |
| 11 | [ -z "${PHP_EXT_PECL_PKG}" ] && PHP_EXT_PECL_PKG=${PN/pecl-/} |
28 | # @ECLASS-VARIABLE: PHP_EXT_PECL_FILENAME |
| 12 | PECL_PKG=${PHP_EXT_PECL_PKG} |
29 | # @DESCRIPTION: |
| 13 | PECL_PKG_V=${PECL_PKG}-${PV} |
30 | # Set in ebuild before inheriting this eclass if the tarball name |
|
|
31 | # differs from ${PN/pecl-/} so that SRC_URI gets set correctly by |
|
|
32 | # the eclass. |
|
|
33 | # |
|
|
34 | # Unlike PHP_EXT_PECL_PKG, setting this variable does not affect |
|
|
35 | # HOMEPAGE, PHP_EXT_NAME or ${S}. |
| 14 | |
36 | |
| 15 | [ -z "${PHP_EXT_NAME}" ] && PHP_EXT_NAME=${PECL_PKG} |
|
|
| 16 | |
37 | |
| 17 | inherit php-ext-source-r1 |
38 | [[ -z "${PHP_EXT_PECL_PKG}" ]] && PHP_EXT_PECL_PKG="${PN/pecl-/}" |
| 18 | |
39 | |
| 19 | EXPORT_FUNCTIONS src_compile src_install |
40 | PECL_PKG="${PHP_EXT_PECL_PKG}" |
|
|
41 | MY_PV="${PV/_/}" |
|
|
42 | PECL_PKG_V="${PECL_PKG}-${MY_PV}" |
| 20 | |
43 | |
| 21 | # ---begin ebuild configurable settings |
44 | [[ -z "${PHP_EXT_NAME}" ]] && PHP_EXT_NAME="${PECL_PKG}" |
| 22 | |
45 | |
| 23 | # Needs to be set if the filename is other than the package name |
46 | inherit php-ext-source-r1 depend.php |
|
|
47 | |
|
|
48 | EXPORT_FUNCTIONS src_compile src_install src_test |
|
|
49 | |
| 24 | if [ -n "${PHP_EXT_PECL_FILENAME}" ]; then |
50 | if [[ -n "${PHP_EXT_PECL_FILENAME}" ]] ; then |
| 25 | FILENAME="${PHP_EXT_PECL_FILENAME}-${PV}.tgz" |
51 | FILENAME="${PHP_EXT_PECL_FILENAME}-${MY_PV}.tgz" |
| 26 | else |
52 | else |
| 27 | FILENAME="${PECL_PKG_V}.tgz" |
53 | FILENAME="${PECL_PKG_V}.tgz" |
| 28 | fi |
54 | fi |
| 29 | |
|
|
| 30 | # ---end ebuild configurable settings |
|
|
| 31 | |
55 | |
| 32 | SRC_URI="http://pecl.php.net/get/${FILENAME}" |
56 | SRC_URI="http://pecl.php.net/get/${FILENAME}" |
| 33 | HOMEPAGE="http://pecl.php.net/${PECL_PKG}" |
57 | HOMEPAGE="http://pecl.php.net/${PECL_PKG}" |
| 34 | |
58 | |
| 35 | S="${WORKDIR}/${PECL_PKG_V}" |
59 | S="${WORKDIR}/${PECL_PKG_V}" |
| 36 | |
60 | |
|
|
61 | # @FUNCTION: php-ext-pecl-r1_src_compile |
|
|
62 | # @DESCRIPTION: |
|
|
63 | # Takes care of standard compile for PECL packages. |
| 37 | php-ext-pecl-r1_src_compile() { |
64 | php-ext-pecl-r1_src_compile() { |
| 38 | has_php |
65 | has_php |
| 39 | php-ext-source-r1_src_compile |
66 | php-ext-source-r1_src_compile |
| 40 | } |
67 | } |
| 41 | |
68 | |
|
|
69 | # @FUNCTION: php-ext-pecl-r1_src_install |
|
|
70 | # @DESCRIPTION: |
|
|
71 | # Takes care of standard install for PECL packages. |
|
|
72 | # You can also simply add examples to IUSE to automagically install |
|
|
73 | # examples supplied with the package. |
|
|
74 | |
|
|
75 | # @VARIABLE: DOCS |
|
|
76 | # @DESCRIPTION: |
|
|
77 | # Set in ebuild if you wish to install additional, package-specific documentation. |
| 42 | php-ext-pecl-r1_src_install() { |
78 | php-ext-pecl-r1_src_install() { |
| 43 | has_php |
79 | has_php |
| 44 | php-ext-source-r1_src_install |
80 | php-ext-source-r1_src_install |
| 45 | |
81 | |
| 46 | # Those two are always present |
82 | for doc in ${DOCS} "${WORKDIR}"/package.xml CREDITS ; do |
| 47 | dodoc-php "${WORKDIR}/package.xml" CREDITS |
83 | [[ -s ${doc} ]] && dodoc-php ${doc} |
|
|
84 | done |
|
|
85 | |
|
|
86 | if has examples ${IUSE} && use examples ; then |
|
|
87 | insinto /usr/share/doc/${CATEGORY}/${PF}/examples |
|
|
88 | doins -r examples/* |
|
|
89 | fi |
| 48 | } |
90 | } |
|
|
91 | |
|
|
92 | # @FUNCTION: php-ext-pecl-r1_src_test |
|
|
93 | # @DESCRIPTION: |
|
|
94 | # Takes care of running any tests delivered with the PECL package. |
|
|
95 | # Testing is somewhat standardized across pecl extensions through phpize's |
|
|
96 | # run-tests.php - unfortunatly there are some quirks we need to work around |
|
|
97 | php-ext-pecl-r1_src_test() { |
|
|
98 | # Makefile passes a hard-coded -d extension_dir=./modules, we move the lib |
|
|
99 | # away from there in src_compile |
|
|
100 | ln -s "${WORKDIR}/${PHP_EXT_NAME}-default.so" "${S}/modules/${PHP_EXT_NAME}.so" |
|
|
101 | |
|
|
102 | NO_INTERACTION="yes" emake test |
|
|
103 | } |