/[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 - (hide annotations) (download)
Fri Jul 17 18:02:35 2015 UTC (19 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 grknight 1.18 # Copyright 1999-2015 Gentoo Foundation
2 stuart 1.1 # Distributed under the terms of the GNU General Public License v2
3 grknight 1.19 # $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-base-r1.eclass,v 1.18 2015/06/17 19:23:34 grknight Exp $
4 vapier 1.17
5     # @ECLASS: php-ext-base-r1.eclass
6     # @MAINTAINER:
7     # Gentoo PHP team <php-bugs@gentoo.org>
8     # @AUTHOR:
9 stuart 1.1 # Author: Tal Peer <coredumb@gentoo.org>
10     # Author: Stuart Herbert <stuart@gentoo.org>
11 chtekk 1.6 # Author: Luca Longinotti <chtekk@gentoo.org>
12 jokey 1.8 # 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 stuart 1.1 #
18 chtekk 1.4 # Combined with php-ext-source-r1, we have a standardised solution for supporting
19     # PHP extensions.
20 grknight 1.18 # This eclass is no longer in use and scheduled to be removed on 2015-07-17
21     # @DEAD
22 stuart 1.1
23 olemarkus 1.13 # Block ebuilds with minor version slotting. Quite temporary fix
24     DEPEND="!=dev-lang/php-5.3.3-r2
25 olemarkus 1.14 !=dev-lang/php-5.2.14-r1
26     !=dev-lang/php-5.3.3-r3
27 olemarkus 1.16 !=dev-lang/php-5.3.5
28     !=dev-lang/php-5.3.4-r1
29 olemarkus 1.15 !=dev-lang/php-5.3.4
30     !=dev-lang/php-5.2.16
31 olemarkus 1.16 !=dev-lang/php-5.2.17
32 olemarkus 1.14 !=dev-lang/php-5.2.14-r2"
33 olemarkus 1.12
34 stuart 1.1 inherit depend.php
35    
36     EXPORT_FUNCTIONS src_install
37    
38 jokey 1.8 # @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 chtekk 1.6 [[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-base-r1 eclass"
44 stuart 1.1
45 jokey 1.8 # @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 chtekk 1.6 [[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes"
50 stuart 1.1
51 jokey 1.8 # @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 chtekk 1.6 [[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no"
56 stuart 1.1
57 jokey 1.8
58 stuart 1.1 php-ext-base-r1_buildinilist() {
59 chtekk 1.6 # Work out the list of <ext>.ini files to edit/add to
60     if [[ -z "${PHPSAPILIST}" ]] ; then
61 mabi 1.11 PHPSAPILIST="apache2 cli cgi fpm"
62 stuart 1.1 fi
63    
64 chtekk 1.6 PHPINIFILELIST=""
65 stuart 1.1
66     for x in ${PHPSAPILIST} ; do
67 chtekk 1.6 if [[ -f "/etc/php/${x}-php${PHP_VERSION}/php.ini" ]] ; then
68 stuart 1.1 PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini"
69     fi
70     done
71     }
72    
73 jokey 1.8 # @FUNCTION: php-ext-base-r1_src_install
74     # @DESCRIPTION:
75     # Takes care of standard install for PHP extensions (modules).
76 stuart 1.1 php-ext-base-r1_src_install() {
77 chtekk 1.6 # Pull in the PHP settings
78 stuart 1.1 has_php
79     addpredict /usr/share/snmp/mibs/.index
80 chtekk 1.6
81     # Build the list of <ext>.ini files to edit/add to
82 stuart 1.1 php-ext-base-r1_buildinilist
83 chtekk 1.6
84     # Add the needed lines to the <ext>.ini files
85     if [[ "${PHP_EXT_INI}" = "yes" ]] ; then
86 stuart 1.1 php-ext-base-r1_addextension "${PHP_EXT_NAME}.so"
87     fi
88 chtekk 1.6
89     # Symlink the <ext>.ini files from ext/ to ext-active/
90 chtekk 1.3 for inifile in ${PHPINIFILELIST} ; do
91 chtekk 1.6 inidir="${inifile/${PHP_EXT_NAME}.ini/}"
92     inidir="${inidir/ext/ext-active}"
93 chtekk 1.3 dodir "/${inidir}"
94     dosym "/${inifile}" "/${inifile/ext/ext-active}"
95     done
96 chtekk 1.6
97     # Add support for installing PHP files into a version dependant directory
98 stuart 1.1 PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}"
99     }
100    
101     php-ext-base-r1_addextension() {
102 chtekk 1.6 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 kloeri 1.2 if has_zts ; then
106 chtekk 1.6 if has_debug ; then
107     ext_type="zend_extension_debug_ts"
108     else
109     ext_type="zend_extension_ts"
110     fi
111 stuart 1.1 ext_file="${EXT_DIR}/$1"
112     else
113 chtekk 1.6 if has_debug ; then
114     ext_type="zend_extension_debug"
115     else
116     ext_type="zend_extension"
117     fi
118 stuart 1.1 ext_file="${EXT_DIR}/$1"
119     fi
120 hoffie 1.10
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 stuart 1.1 else
129 chtekk 1.6 # We don't need the full path for normal extensions!
130 stuart 1.1 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 chtekk 1.6 # $1 - Setting name
138     # $2 - Setting value
139     # $3 - File to add to
140     # $4 - Sanitized text to output
141 stuart 1.1 php-ext-base-r1_addtoinifile() {
142 jokey 1.9 if [[ ! -d $(dirname $3) ]] ; then
143     mkdir -p $(dirname $3)
144 stuart 1.1 fi
145    
146 chtekk 1.6 # Are we adding the name of a section?
147 stuart 1.1 if [[ ${1:0:1} == "[" ]] ; then
148 chtekk 1.6 echo "$1" >> "$3"
149 stuart 1.1 my_added="$1"
150     else
151 chtekk 1.6 echo "$1=$2" >> "$3"
152 stuart 1.1 my_added="$1=$2"
153     fi
154    
155 chtekk 1.6 if [[ -z "$4" ]] ; then
156 stuart 1.1 einfo "Added '$my_added' to /$3"
157     else
158     einfo "$4 to /$3"
159     fi
160    
161 jokey 1.9 insinto /$(dirname $3)
162 chtekk 1.6 doins "$3"
163 stuart 1.1 }
164    
165 jokey 1.8 # @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 stuart 1.1 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