/[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.3 - (show annotations) (download)
Mon Oct 31 14:08:42 2005 UTC (9 years ago) by chtekk
Branch: MAIN
Changes since 1.2: +7 -1 lines
New-style PHP update, see dev-lang/php ChangeLog for detailed list of changes.

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

  ViewVC Help
Powered by ViewVC 1.1.20