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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20