/[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.19 - (show annotations) (download)
Fri Jul 17 18:02:35 2015 UTC (21 months, 1 week ago) by grknight
Branch: MAIN
CVS Tags: HEAD
Changes since 1.18: +1 -1 lines
FILE REMOVED
Drop old, unused eclasses wrt bug 551910

1 # Copyright 1999-2015 Gentoo Foundation
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.18 2015/06/17 19:23:34 grknight Exp $
4
5 # @ECLASS: php-ext-base-r1.eclass
6 # @MAINTAINER:
7 # Gentoo PHP team <php-bugs@gentoo.org>
8 # @AUTHOR:
9 # Author: Tal Peer <coredumb@gentoo.org>
10 # Author: Stuart Herbert <stuart@gentoo.org>
11 # Author: Luca Longinotti <chtekk@gentoo.org>
12 # Author: Jakub Moc <jakub@gentoo.org> (documentation)
13 # @BLURB: A unified interface for adding standalone PHP extensions.
14 # @DESCRIPTION:
15 # This eclass provides a unified interface for adding standalone
16 # PHP extensions (modules) to the php.ini files on your system.
17 #
18 # Combined with php-ext-source-r1, we have a standardised solution for supporting
19 # PHP extensions.
20 # This eclass is no longer in use and scheduled to be removed on 2015-07-17
21 # @DEAD
22
23 # Block ebuilds with minor version slotting. Quite temporary fix
24 DEPEND="!=dev-lang/php-5.3.3-r2
25 !=dev-lang/php-5.2.14-r1
26 !=dev-lang/php-5.3.3-r3
27 !=dev-lang/php-5.3.5
28 !=dev-lang/php-5.3.4-r1
29 !=dev-lang/php-5.3.4
30 !=dev-lang/php-5.2.16
31 !=dev-lang/php-5.2.17
32 !=dev-lang/php-5.2.14-r2"
33
34 inherit depend.php
35
36 EXPORT_FUNCTIONS src_install
37
38 # @ECLASS-VARIABLE: PHP_EXT_NAME
39 # @DESCRIPTION:
40 # The extension name. This must be set, otherwise the eclass dies.
41 # Only automagically set by php-ext-pecl-r1.eclass, so unless your ebuild
42 # inherits that eclass, you must set this manually before inherit.
43 [[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-base-r1 eclass"
44
45 # @ECLASS-VARIABLE: PHP_EXT_INI
46 # @DESCRIPTION:
47 # Controls whether or not to add a line to php.ini for the extension.
48 # Defaults to "yes" and should not be changed in most cases.
49 [[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes"
50
51 # @ECLASS-VARIABLE: PHP_EXT_ZENDEXT
52 # @DESCRIPTION:
53 # Controls whether the extension is a ZendEngine extension or not.
54 # Defaults to "no" and if you don't know what is it, you don't need it.
55 [[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no"
56
57
58 php-ext-base-r1_buildinilist() {
59 # Work out the list of <ext>.ini files to edit/add to
60 if [[ -z "${PHPSAPILIST}" ]] ; then
61 PHPSAPILIST="apache2 cli cgi fpm"
62 fi
63
64 PHPINIFILELIST=""
65
66 for x in ${PHPSAPILIST} ; do
67 if [[ -f "/etc/php/${x}-php${PHP_VERSION}/php.ini" ]] ; then
68 PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini"
69 fi
70 done
71 }
72
73 # @FUNCTION: php-ext-base-r1_src_install
74 # @DESCRIPTION:
75 # Takes care of standard install for PHP extensions (modules).
76 php-ext-base-r1_src_install() {
77 # Pull in the PHP settings
78 has_php
79 addpredict /usr/share/snmp/mibs/.index
80
81 # Build the list of <ext>.ini files to edit/add to
82 php-ext-base-r1_buildinilist
83
84 # Add the needed lines to the <ext>.ini files
85 if [[ "${PHP_EXT_INI}" = "yes" ]] ; then
86 php-ext-base-r1_addextension "${PHP_EXT_NAME}.so"
87 fi
88
89 # Symlink the <ext>.ini files from ext/ to ext-active/
90 for inifile in ${PHPINIFILELIST} ; do
91 inidir="${inifile/${PHP_EXT_NAME}.ini/}"
92 inidir="${inidir/ext/ext-active}"
93 dodir "/${inidir}"
94 dosym "/${inifile}" "/${inifile/ext/ext-active}"
95 done
96
97 # Add support for installing PHP files into a version dependant directory
98 PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}"
99 }
100
101 php-ext-base-r1_addextension() {
102 if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then
103 # We need the full path for ZendEngine extensions
104 # and we need to check for debugging enabled!
105 if has_zts ; then
106 if has_debug ; then
107 ext_type="zend_extension_debug_ts"
108 else
109 ext_type="zend_extension_ts"
110 fi
111 ext_file="${EXT_DIR}/$1"
112 else
113 if has_debug ; then
114 ext_type="zend_extension_debug"
115 else
116 ext_type="zend_extension"
117 fi
118 ext_file="${EXT_DIR}/$1"
119 fi
120
121 # php-5.3 unifies zend_extension loading and just requires the
122 # zend_extension keyword with no suffix
123 # TODO: drop previous code and this check once <php-5.3 support is
124 # discontinued
125 if has_version '>=dev-lang/php-5.3' ; then
126 ext_type="zend_extension"
127 fi
128 else
129 # We don't need the full path for normal extensions!
130 ext_type="extension"
131 ext_file="$1"
132 fi
133
134 php-ext-base-r1_addtoinifiles "${ext_type}" "${ext_file}" "Extension added"
135 }
136
137 # $1 - Setting name
138 # $2 - Setting value
139 # $3 - File to add to
140 # $4 - Sanitized text to output
141 php-ext-base-r1_addtoinifile() {
142 if [[ ! -d $(dirname $3) ]] ; then
143 mkdir -p $(dirname $3)
144 fi
145
146 # Are we adding the name of a section?
147 if [[ ${1:0:1} == "[" ]] ; then
148 echo "$1" >> "$3"
149 my_added="$1"
150 else
151 echo "$1=$2" >> "$3"
152 my_added="$1=$2"
153 fi
154
155 if [[ -z "$4" ]] ; then
156 einfo "Added '$my_added' to /$3"
157 else
158 einfo "$4 to /$3"
159 fi
160
161 insinto /$(dirname $3)
162 doins "$3"
163 }
164
165 # @FUNCTION: php-ext-base-r1_addtoinifiles
166 # @USAGE: <setting name> <setting value> [message to output]; or just [section name]
167 # @DESCRIPTION:
168 # Add value settings to php.ini file installed by the extension (module).
169 # You can also add a [section], see examples below.
170 #
171 # @CODE
172 # Add some settings for the extension:
173 #
174 # php-ext-base-r1_addtoinifiles "zend_optimizer.optimization_level" "15"
175 # php-ext-base-r1_addtoinifiles "zend_optimizer.enable_loader" "0"
176 # php-ext-base-r1_addtoinifiles "zend_optimizer.disable_licensing" "0"
177 #
178 # Adding values to a section in php.ini file installed by the extension:
179 #
180 # php-ext-base-r1_addtoinifiles "[Debugger]"
181 # php-ext-base-r1_addtoinifiles "debugger.enabled" "on"
182 # php-ext-base-r1_addtoinifiles "debugger.profiler_enabled" "on"
183 # @CODE
184 php-ext-base-r1_addtoinifiles() {
185 for x in ${PHPINIFILELIST} ; do
186 php-ext-base-r1_addtoinifile "$1" "$2" "$x" "$3"
187 done
188 }

  ViewVC Help
Powered by ViewVC 1.1.20