Gentoo Archives: gentoo-commits

From: "Ole Markus With (olemarkus)" <olemarkus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: php-ext-source-r2.eclass
Date: Tue, 02 Nov 2010 17:10:04
Message-Id: 20101102170956.D701A20051@flycatcher.gentoo.org
1 olemarkus 10/11/02 17:09:56
2
3 Modified: php-ext-source-r2.eclass
4 Log:
5 Cleanup of eclass. Also added depend.php back in as it is still required for some parts
6
7 Revision Changes Path
8 1.3 eclass/php-ext-source-r2.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/php-ext-source-r2.eclass?rev=1.3&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/php-ext-source-r2.eclass?rev=1.3&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/php-ext-source-r2.eclass?r1=1.2&r2=1.3
13
14 Index: php-ext-source-r2.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v
17 retrieving revision 1.2
18 retrieving revision 1.3
19 diff -u -r1.2 -r1.3
20 --- php-ext-source-r2.eclass 6 Oct 2010 19:58:45 -0000 1.2
21 +++ php-ext-source-r2.eclass 2 Nov 2010 17:09:56 -0000 1.3
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2007 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v 1.2 2010/10/06 19:58:45 olemarkus Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v 1.3 2010/11/02 17:09:56 olemarkus Exp $
27 #
28 # Author: Tal Peer <coredumb@g.o>
29 # Author: Stuart Herbert <stuart@g.o>
30 @@ -16,7 +16,7 @@
31 # This eclass provides a unified interface for compiling and installing standalone
32 # PHP extensions (modules).
33
34 -inherit flag-o-matic autotools
35 +inherit flag-o-matic autotools depend.php
36
37 EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install
38
39 @@ -60,22 +60,22 @@
40 # @ECLASS-VARIABLE: USE_PHP
41 # @DESCRIPTION:
42 # Lists the PHP slots compatibile the extension is compatibile with
43 -[[ -z "$USE_PHP" ]] && USE_PHP="php5-2 php5-3"
44 +[[ -z "${USE_PHP}" ]] && USE_PHP="php5-2 php5-3"
45
46 #Make sure at least one target is installed. Abuses USE dependencies.
47 -for target in $USE_PHP; do
48 - IUSE="${IUSE} php_targets_$target"
49 +for target in ${USE_PHP}; do
50 + IUSE="${IUSE} php_targets_${target}"
51 target=${target/+}
52 - SELFDEPEND="$SELFDEPEND =$CATEGORY/$PF[php_targets_$target]"
53 + SELFDEPEND="${SELFDEPEND} =${CATEGORY}/${PF}[php_targets_${target}]"
54 slot=${target/php}
55 slot=${slot/-/.}
56 - PHPDEPEND="$PHPDEPEND
57 - php_targets_$target? ( dev-lang/php:${slot} )"
58 + PHPDEPEND="${PHPDEPEND}
59 + php_targets_${target}? ( dev-lang/php:${slot} )"
60 done
61
62 RDEPEND="${RDEPEND}
63 - || ( $SELFDEPEND )
64 - $PHPDEPEND"
65 + || ( ${SELFDEPEND} )
66 + ${PHPDEPEND}"
67
68
69 # @FUNCTION: php-ext-source-r2_src_unpack
70 @@ -91,8 +91,8 @@
71 unpack ${A}
72 local slot orig_s="$S"
73 for slot in $(php_get_slots); do
74 - cp -r "$orig_s" "${WORKDIR}/$slot"
75 - php_init_slot_env $slot
76 + cp -r "${orig_s}" "${WORKDIR}/${slot}"
77 + php_init_slot_env ${slot}
78 if [[ "${PHP_EXT_SKIP_PHPIZE}" != 'yes' ]] ; then
79 php-ext-source-r2_phpize
80 fi
81 @@ -123,7 +123,7 @@
82 php-ext-source-r2_src_configure() {
83 local slot
84 for slot in $(php_get_slots); do
85 - php_init_slot_env $slot
86 + php_init_slot_env ${slot}
87 # Set the correct config options
88 # We cannot use econf here, phpize/php-config deals with setting
89 # --prefix etc to whatever the php slot was configured to use
90 @@ -141,7 +141,7 @@
91 addpredict /session_mm_cli0.sem
92 local slot
93 for slot in $(php_get_slots); do
94 - php_init_slot_env $slot
95 + php_init_slot_env ${slot}
96 emake || die "Unable to make code"
97
98 done
99 @@ -157,12 +157,13 @@
100 php-ext-source-r2_src_install() {
101 local slot
102 for slot in $(php_get_slots); do
103 - php_init_slot_env $slot
104 + php_init_slot_env ${slot}
105
106 # Let's put the default module away
107 insinto "${EXT_DIR}"
108 newins "modules/${PHP_EXT_NAME}.so" "${PHP_EXT_NAME}.so" || die "Unable to install extension"
109
110 + local doc
111 for doc in ${DOCS} ; do
112 [[ -s ${doc} ]] && dodoc ${doc}
113 done
114 @@ -173,10 +174,9 @@
115
116
117 php_get_slots() {
118 - local s
119 - local slot
120 - for slot in $USE_PHP; do
121 - use php_targets_$slot && s+=" ${slot/-/.}"
122 + local s slot
123 + for slot in ${USE_PHP}; do
124 + use php_targets_${slot} && s+=" ${slot/-/.}"
125 done
126 echo $s
127 }
128 @@ -184,16 +184,16 @@
129 php_init_slot_env() {
130 libdir=$(get_libdir)
131
132 - PHPIZE="/usr/${libdir}/$1/bin/phpize"
133 - PHPCONFIG="/usr/${libdir}/$1/bin/php-config"
134 - PHPCLI="/usr/${libdir}/$1/bin/php"
135 - PHPCGI="/usr/${libdir}/$1/bin/php-cgi"
136 + PHPIZE="/usr/${libdir}/${1}/bin/phpize"
137 + PHPCONFIG="/usr/${libdir}/${1}/bin/php-config"
138 + PHPCLI="/usr/${libdir}/${1}/bin/php"
139 + PHPCGI="/usr/${libdir}/${1}/bin/php-cgi"
140 PHP_PKG="$(best_version =dev-lang/php-${1:3}*)"
141 - PHPPREFIX="/usr/${libdir}/$slot"
142 + PHPPREFIX="/usr/${libdir}/${slot}"
143 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
144
145 - S="${WORKDIR}/$1"
146 - cd $S
147 + S="${WORKDIR}/${1}"
148 + cd "${S}"
149 }
150
151 php-ext-source-r2_buildinilist() {
152 @@ -203,7 +203,7 @@
153 fi
154
155 PHPINIFILELIST=""
156 -
157 + local x
158 for x in ${PHPSAPILIST} ; do
159 if [[ -f "/etc/php/${x}-${1}/php.ini" ]] ; then
160 PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
161 @@ -217,11 +217,11 @@
162 php-ext-source-r2_createinifiles() {
163 local slot
164 for slot in $(php_get_slots); do
165 - php_init_slot_env $slot
166 + php_init_slot_env ${slot}
167 # Pull in the PHP settings
168
169 # Build the list of <ext>.ini files to edit/add to
170 - php-ext-source-r2_buildinilist $slot
171 + php-ext-source-r2_buildinilist ${slot}
172
173 # Add the needed lines to the <ext>.ini files
174 if [[ "${PHP_EXT_INI}" = "yes" ]] ; then
175 @@ -251,14 +251,14 @@
176 else
177 ext_type="zend_extension_ts"
178 fi
179 - ext_file="${EXT_DIR}/$1"
180 + ext_file="${EXT_DIR}/${1}"
181 else
182 if has_debug ; then
183 ext_type="zend_extension_debug"
184 else
185 ext_type="zend_extension"
186 fi
187 - ext_file="${EXT_DIR}/$1"
188 + ext_file="${EXT_DIR}/${1}"
189 fi
190
191 # php-5.3 unifies zend_extension loading and just requires the
192 @@ -271,7 +271,7 @@
193 else
194 # We don't need the full path for normal extensions!
195 ext_type="extension"
196 - ext_file="$1"
197 + ext_file="${1}"
198 fi
199
200 php-ext-source-r2_addtoinifiles "${ext_type}" "${ext_file}" "Extension added"
201 @@ -282,27 +282,27 @@
202 # $3 - File to add to
203 # $4 - Sanitized text to output
204 php-ext-source-r2_addtoinifile() {
205 - if [[ ! -d $(dirname $3) ]] ; then
206 - mkdir -p $(dirname $3)
207 + if [[ ! -d $(dirname ${3}) ]] ; then
208 + mkdir -p $(dirname ${3})
209 fi
210
211 # Are we adding the name of a section?
212 if [[ ${1:0:1} == "[" ]] ; then
213 - echo "$1" >> "$3"
214 - my_added="$1"
215 + echo "${1}" >> "${3}"
216 + my_added="${1}"
217 else
218 - echo "$1=$2" >> "$3"
219 - my_added="$1=$2"
220 + echo "${1}=${2}" >> "${3}"
221 + my_added="${1}=${2}"
222 fi
223
224 - if [[ -z "$4" ]] ; then
225 - einfo "Added '$my_added' to /$3"
226 + if [[ -z "${4}" ]] ; then
227 + einfo "Added '${my_added}' to /${3}"
228 else
229 - einfo "$4 to /$3"
230 + einfo "${4} to /${3}"
231 fi
232
233 - insinto /$(dirname $3)
234 - doins "$3"
235 + insinto /$(dirname ${3})
236 + doins "${3}"
237 }
238
239 # @FUNCTION: php-ext-source-r2_addtoinifiles
240 @@ -325,7 +325,8 @@
241 # php-ext-source-r2_addtoinifiles "debugger.profiler_enabled" "on"
242 # @CODE
243 php-ext-source-r2_addtoinifiles() {
244 + local x
245 for x in ${PHPINIFILELIST} ; do
246 - php-ext-source-r2_addtoinifile "$1" "$2" "$x" "$3"
247 + php-ext-source-r2_addtoinifile "${1}" "${2}" "${x}" "${3}"
248 done
249 }