/[gentoo-x86]/eclass/php-ext-base-r1.eclass
Gentoo

Contents of /eclass/php-ext-base-r1.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Sat May 12 02:54:35 2007 UTC (7 years, 3 months ago) by chtekk
Branch: MAIN
Changes since 1.6: +2 -2 lines
Apache 1.X masking.

1 chtekk 1.6 # Copyright 1999-2007 Gentoo Foundation
2 stuart 1.1 # Distributed under the terms of the GNU General Public License v2
3 chtekk 1.7 # $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-base-r1.eclass,v 1.6 2007/03/05 01:50:47 chtekk Exp $
4 stuart 1.1 #
5     # Author: Tal Peer <coredumb@gentoo.org>
6     # Author: Stuart Herbert <stuart@gentoo.org>
7 chtekk 1.6 # Author: Luca Longinotti <chtekk@gentoo.org>
8     # Maintained by the PHP Team <php-bugs@gentoo.org>
9 stuart 1.1 #
10 chtekk 1.4 # The php-ext-base-r1 eclass provides a unified interface for adding standalone
11 stuart 1.1 # PHP extensions ('modules') to the php.ini files on your system.
12     #
13 chtekk 1.4 # Combined with php-ext-source-r1, we have a standardised solution for supporting
14     # PHP extensions.
15 stuart 1.1
16     inherit depend.php
17    
18     EXPORT_FUNCTIONS src_install
19    
20 chtekk 1.6 # The extension name, this must be set, otherwise we die
21     [[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-base-r1 eclass"
22 stuart 1.1
23 chtekk 1.6 # Wether or not to add a line to php.ini for the extension
24 stuart 1.1 # (defaults to "yes" and shouldn't be changed in most cases)
25 chtekk 1.6 [[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes"
26 stuart 1.1
27 chtekk 1.6 # Wether the extension is a ZendEngine extension or not
28     # (defaults to "no" and if you don't know what is it, you don't need it)
29     [[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no"
30 stuart 1.1
31     php-ext-base-r1_buildinilist() {
32 chtekk 1.6 # Work out the list of <ext>.ini files to edit/add to
33     if [[ -z "${PHPSAPILIST}" ]] ; then
34 chtekk 1.7 PHPSAPILIST="apache2 cli cgi"
35 stuart 1.1 fi
36    
37 chtekk 1.6 PHPINIFILELIST=""
38 stuart 1.1
39     for x in ${PHPSAPILIST} ; do
40 chtekk 1.6 if [[ -f "/etc/php/${x}-php${PHP_VERSION}/php.ini" ]] ; then
41 stuart 1.1 PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini"
42     fi
43     done
44     }
45    
46     php-ext-base-r1_src_install() {
47 chtekk 1.6 # Pull in the PHP settings
48 stuart 1.1 has_php
49     addpredict /usr/share/snmp/mibs/.index
50 chtekk 1.6
51     # Build the list of <ext>.ini files to edit/add to
52 stuart 1.1 php-ext-base-r1_buildinilist
53 chtekk 1.6
54     # Add the needed lines to the <ext>.ini files
55     if [[ "${PHP_EXT_INI}" = "yes" ]] ; then
56 stuart 1.1 php-ext-base-r1_addextension "${PHP_EXT_NAME}.so"
57     fi
58 chtekk 1.6
59     # Symlink the <ext>.ini files from ext/ to ext-active/
60 chtekk 1.3 for inifile in ${PHPINIFILELIST} ; do
61 chtekk 1.6 inidir="${inifile/${PHP_EXT_NAME}.ini/}"
62     inidir="${inidir/ext/ext-active}"
63 chtekk 1.3 dodir "/${inidir}"
64     dosym "/${inifile}" "/${inifile/ext/ext-active}"
65     done
66 chtekk 1.6
67     # Add support for installing PHP files into a version dependant directory
68 stuart 1.1 PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}"
69     }
70    
71     php-ext-base-r1_addextension() {
72 chtekk 1.6 if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then
73     # We need the full path for ZendEngine extensions
74     # and we need to check for debugging enabled!
75 kloeri 1.2 if has_zts ; then
76 chtekk 1.6 if has_debug ; then
77     ext_type="zend_extension_debug_ts"
78     else
79     ext_type="zend_extension_ts"
80     fi
81 stuart 1.1 ext_file="${EXT_DIR}/$1"
82     else
83 chtekk 1.6 if has_debug ; then
84     ext_type="zend_extension_debug"
85     else
86     ext_type="zend_extension"
87     fi
88 stuart 1.1 ext_file="${EXT_DIR}/$1"
89     fi
90     else
91 chtekk 1.6 # We don't need the full path for normal extensions!
92 stuart 1.1 ext_type="extension"
93     ext_file="$1"
94     fi
95    
96     php-ext-base-r1_addtoinifiles "${ext_type}" "${ext_file}" "Extension added"
97     }
98    
99 chtekk 1.6 # $1 - Setting name
100     # $2 - Setting value
101     # $3 - File to add to
102     # $4 - Sanitized text to output
103 stuart 1.1
104     php-ext-base-r1_addtoinifile() {
105 chtekk 1.6 if [[ ! -d `dirname $3` ]] ; then
106 stuart 1.1 mkdir -p `dirname $3`
107     fi
108    
109 chtekk 1.6 # Are we adding the name of a section?
110 stuart 1.1 if [[ ${1:0:1} == "[" ]] ; then
111 chtekk 1.6 echo "$1" >> "$3"
112 stuart 1.1 my_added="$1"
113     else
114 chtekk 1.6 echo "$1=$2" >> "$3"
115 stuart 1.1 my_added="$1=$2"
116     fi
117    
118 chtekk 1.6 if [[ -z "$4" ]] ; then
119 stuart 1.1 einfo "Added '$my_added' to /$3"
120     else
121     einfo "$4 to /$3"
122     fi
123    
124     insinto /`dirname $3`
125 chtekk 1.6 doins "$3"
126 stuart 1.1 }
127    
128     php-ext-base-r1_addtoinifiles() {
129     for x in ${PHPINIFILELIST} ; do
130     php-ext-base-r1_addtoinifile "$1" "$2" "$x" "$3"
131     done
132     }

  ViewVC Help
Powered by ViewVC 1.1.20