/[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.1.1.1 - (hide annotations) (download) (vendor branch)
Wed Nov 30 09:59:18 2005 UTC (8 years, 8 months ago) by chriswhite
Changes since 1.1: +18 -7 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.20