| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2011 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/php-lib-r1.eclass,v 1.3 2005/10/31 14:08:42 chtekk Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/php-lib-r1.eclass,v 1.11 2012/02/12 21:48:58 mabi Exp $ |
| 4 | # |
4 | |
|
|
5 | # @ECLASS: php-lib-r1.eclass |
|
|
6 | # @MAINTAINER: |
|
|
7 | # Gentoo PHP team <php-bugs@gentoo.org> |
|
|
8 | # @AUTHOR: |
| 5 | # Author: Stuart Herbert <stuart@gentoo.org> |
9 | # Author: Stuart Herbert <stuart@gentoo.org> |
| 6 | # |
10 | # Author: Luca Longinotti <chtekk@gentoo.org> |
|
|
11 | # @BLURB: A unified interface for adding new PHP libraries. |
|
|
12 | # @DESCRIPTION: |
| 7 | # The php-lib eclass provides a unified interface for adding new |
13 | # This eclass provides a unified interface for adding new PHP libraries. |
| 8 | # PHP libraries. PHP libraries are PHP scripts designed for reuse inside |
14 | # PHP libraries are PHP scripts designed for reuse inside other PHP scripts. |
| 9 | # other PHP scripts. |
|
|
| 10 | # |
|
|
| 11 | # This eclass doesn't do a lot (yet) |
|
|
| 12 | |
15 | |
| 13 | inherit depend.php |
16 | inherit depend.php |
| 14 | |
17 | |
| 15 | RESTRICT="${RESTRICT} nostrip" |
|
|
| 16 | |
|
|
| 17 | EXPORT_FUNCTIONS src_install |
18 | EXPORT_FUNCTIONS src_install |
| 18 | |
19 | |
| 19 | # ---begin ebuild configurable settings |
20 | DEPEND="dev-lang/php" |
|
|
21 | RDEPEND="${DEPEND}" |
| 20 | |
22 | |
| 21 | # provide default extension name if necessary |
23 | # @ECLASS-VARIABLE: PHP_LIB_NAME |
|
|
24 | # @DESCRIPTION: |
|
|
25 | # Defaults to ${PN} unless set manually in the ebuild. |
| 22 | [ -z "${PHP_LIB_NAME}" ] && PHP_LIB_NAME="${PN}" |
26 | [[ -z "${PHP_LIB_NAME}" ]] && PHP_LIB_NAME="${PN}" |
| 23 | # ---end ebuild configurable settings |
|
|
| 24 | |
27 | |
| 25 | DEPEND="${DEPEND} dev-lang/php" |
28 | # @FUNCTION: php-lib-r1_src_install |
| 26 | RDEPEND="${RDEPEND} ${DEPEND}" |
29 | # @USAGE: <directory to install from> <list of files> |
|
|
30 | # @DESCRIPTION: |
|
|
31 | # Takes care of install for PHP libraries. |
|
|
32 | # You have to pass in a list of the PHP files to install. |
| 27 | |
33 | |
| 28 | # you have to pass in a list of the PHP files to install |
34 | # @VARIABLE: DOCS |
| 29 | # |
35 | # @DESCRIPTION: |
|
|
36 | # Set in ebuild if you wish to install additional, package-specific documentation. |
|
|
37 | |
| 30 | # $1 - directory in ${S} to insert from |
38 | # $1 - directory in ${S} to insert from |
| 31 | # $2 ... list of files to install |
39 | # $2 ... list of files to install |
| 32 | |
|
|
| 33 | php-lib-r1_src_install() { |
40 | php-lib-r1_src_install() { |
| 34 | has_php |
|
|
| 35 | |
|
|
| 36 | # install to the correct phpX folder, if not specified |
|
|
| 37 | # fall back to /usr/share/php |
|
|
| 38 | if [ -n "${PHP_SHARED_CAT}" ] ; then |
|
|
| 39 | PHP_LIB_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_LIB_NAME}" |
|
|
| 40 | else |
|
|
| 41 | PHP_LIB_DIR="/usr/share/php/${PHP_LIB_NAME}" |
|
|
| 42 | fi |
|
|
| 43 | |
|
|
| 44 | local x |
41 | local x |
| 45 | |
42 | |
| 46 | S_DIR="$1" |
43 | S_DIR="$1" |
| 47 | shift |
44 | shift |
| 48 | |
45 | |
| 49 | for x in $@ ; do |
46 | for x in $@ ; do |
| 50 | SUBDIR="`dirname ${x}`" |
47 | SUBDIR="$(dirname ${x})" |
| 51 | insinto ${PHP_LIB_DIR}/${SUBDIR} |
48 | insinto "/usr/share/php/${PHP_LIB_NAME}/${SUBDIR}" |
| 52 | doins "${S_DIR}/${x}" |
49 | doins "${S_DIR}/${x}" |
| 53 | done |
50 | done |
|
|
51 | |
|
|
52 | for doc in ${DOCS} ; do |
|
|
53 | [[ -s ${doc} ]] && dodoc-php ${doc} |
|
|
54 | done |
| 54 | } |
55 | } |