/[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.5 - (hide annotations) (download)
Fri Feb 2 19:09:33 2007 UTC (7 years, 9 months ago) by chtekk
Branch: MAIN
Changes since 1.4: +1 -4 lines
Fix Paludis installs.

1 stuart 1.1 # Copyright 1999-2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 chtekk 1.5 # $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 chtekk 1.4 # Maintained by the PHP Herd <php-bugs@gentoo.org>
8 stuart 1.1 #
9 chtekk 1.4 # 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 chtekk 1.4 # 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     # ---end ebuild configurable settings
33    
34     DEPEND="${DEPEND}
35 kloeri 1.2 >=sys-devel/m4-1.4.3
36     >=sys-devel/libtool-1.5.18
37     >=sys-devel/automake-1.9.6
38     sys-devel/automake-wrapper
39     >=sys-devel/autoconf-2.59
40     sys-devel/autoconf-wrapper"
41 stuart 1.1
42     php-ext-base-r1_buildinilist() {
43     # work out the list of .ini files to edit/add to
44     if [ -z "${PHPSAPILIST}" ]; then
45     PHPSAPILIST="apache1 apache2 cli cgi"
46     fi
47    
48     PHPINIFILELIST=
49    
50     for x in ${PHPSAPILIST} ; do
51     if [ -f /etc/php/${x}-php${PHP_VERSION}/php.ini ]; then
52     PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini"
53     fi
54     done
55     }
56    
57     php-ext-base-r1_src_install() {
58     has_php
59     addpredict /usr/share/snmp/mibs/.index
60     php-ext-base-r1_buildinilist
61     if [ "${PHP_EXT_INI}" = "yes" ] ; then
62     php-ext-base-r1_addextension "${PHP_EXT_NAME}.so"
63     fi
64 chtekk 1.3 for inifile in ${PHPINIFILELIST} ; do
65     inidir=${inifile/${PHP_EXT_NAME}.ini/}
66     inidir=${inidir/ext/ext-active}
67     dodir "/${inidir}"
68     dosym "/${inifile}" "/${inifile/ext/ext-active}"
69     done
70 stuart 1.1 # add support for installing php files into a version dependant directory
71     PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}"
72     }
73    
74     php-ext-base-r1_addextension() {
75     if [ "${PHP_EXT_ZENDEXT}" = "yes" ] ; then
76 kloeri 1.2 if has_zts ; then
77 stuart 1.1 ext_type="zend_extension_ts"
78     ext_file="${EXT_DIR}/$1"
79     else
80     ext_type="zend_extension"
81     ext_file="${EXT_DIR}/$1"
82     fi
83     else
84     # we do *not* add the full path for the extension!
85     ext_type="extension"
86     ext_file="$1"
87     fi
88    
89     php-ext-base-r1_addtoinifiles "${ext_type}" "${ext_file}" "Extension added"
90     }
91    
92     # $1 - setting name
93     # $2 - setting value
94     # $3 - file to add to
95     # $4 - sanitised text to output
96    
97     php-ext-base-r1_addtoinifile() {
98     if [[ ! -d `dirname $3` ]]; then
99     mkdir -p `dirname $3`
100     fi
101    
102     # are we adding the name of a section?
103     if [[ ${1:0:1} == "[" ]] ; then
104     echo "$1" >> $3
105     my_added="$1"
106     else
107     echo "$1=$2" >> $3
108     my_added="$1=$2"
109     fi
110    
111     if [ -z "$4" ]; then
112     einfo "Added '$my_added' to /$3"
113     else
114     einfo "$4 to /$3"
115     fi
116    
117     # yes, this is inefficient - but it works every time ;-)
118    
119     insinto /`dirname $3`
120     doins $3
121     }
122    
123     php-ext-base-r1_addtoinifiles() {
124     for x in ${PHPINIFILELIST} ; do
125     php-ext-base-r1_addtoinifile "$1" "$2" "$x" "$3"
126     done
127     }

  ViewVC Help
Powered by ViewVC 1.1.20