/[gentoo-x86]/eclass/depend.php.eclass
Gentoo

Diff of /eclass/depend.php.eclass

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

Revision 1.12 Revision 1.16
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/depend.php.eclass,v 1.12 2006/03/24 23:05:47 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.16 2006/08/07 07:10:16 chtekk Exp $
4# 4#
5# ======================================================================== 5# ========================================================================
6# 6#
7# depend.php.eclass 7# depend.php.eclass
8# functions to allow ebuilds to depend on php4 and/or php5 8# functions to allow ebuilds to depend on php4 and/or php5
160 local x 160 local x
161 161
162 einfo "Checking for compatible SAPI(s)" 162 einfo "Checking for compatible SAPI(s)"
163 163
164 for x in $@ ; do 164 for x in $@ ; do
165 if built_with_use =${PHP_PKG} ${x} ; then 165 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
166 einfo " Discovered compatible SAPI ${x}" 166 einfo " Discovered compatible SAPI ${x}"
167 has_sapi="1" 167 has_sapi="1"
168 fi 168 fi
169 done 169 done
170 170
193 has_php 193 has_php
194 194
195 local missing_use="" 195 local missing_use=""
196 local x 196 local x
197 197
198 einfo "Checking for required PHP feature(s):" 198 einfo "Checking for required PHP feature(s) ..."
199 199
200 for x in $@ ; do 200 for x in $@ ; do
201 if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 201 if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
202 einfo " Discovered missing USE flag ${x}" 202 einfo " Discovered missing USE flag: ${x}"
203 missing_use="${missing_use} ${x}" 203 missing_use="${missing_use} ${x}"
204 fi 204 fi
205 done 205 done
206 206
207 if [[ -z ${missing_use} ]] ; then 207 if [[ -z "${missing_use}" ]] ; then
208 if [[ -z "${PHPCHECKNODIE}" ]] ; then
208 return 209 return
210 else
211 return 0
209 fi 212 fi
213 fi
210 214
215 if [[ -z "${PHPCHECKNODIE}" ]] ; then
211 eerror 216 eerror
212 eerror "${PHP_PKG} needs to be re-installed with all of the following" 217 eerror "${PHP_PKG} needs to be re-installed with all of the following"
213 eerror "USE flags enabled:" 218 eerror "USE flags enabled:"
214 eerror 219 eerror
215 eerror " $@" 220 eerror " $@"
216 eerror 221 eerror
217 die "Missing PHP USE flags found" 222 die "Missing PHP USE flags found"
223 else
224 return 1
225 fi
218} 226}
219 227
220# Call this function from pkg_setup if your package requires PHP compiled 228# Call this function from pkg_setup if your package requires PHP compiled
221# with any of specified USE flags 229# with any of specified USE flags
222# 230#
229 has_php 237 has_php
230 238
231 local missing_use="" 239 local missing_use=""
232 local x 240 local x
233 241
234 einfo "Checking for required PHP feature(s):" 242 einfo "Checking for required PHP feature(s) ..."
235 243
236 for x in $@ ; do 244 for x in $@ ; do
237 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 245 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
238 einfo " USE flag ${x} is enabled, ok ..." 246 einfo " USE flag ${x} is enabled, ok ..."
239 return 247 return
240 else 248 else
241 missing_use="${missing_use} ${x}" 249 missing_use="${missing_use} ${x}"
242 fi 250 fi
243 done 251 done
244 252
245 if [[ -z ${missing_use} ]] ; then 253 if [[ -z "${missing_use}" ]] ; then
254 if [[ -z "${PHPCHECKNODIE}" ]] ; then
246 return 255 return
256 else
257 return 0
247 fi 258 fi
259 fi
248 260
261 if [[ -z "${PHPCHECKNODIE}" ]] ; then
249 eerror 262 eerror
250 eerror "${PHP_PKG} needs to be re-installed with any of the following" 263 eerror "${PHP_PKG} needs to be re-installed with any of the following"
251 eerror "USE flags enabled:" 264 eerror "USE flags enabled:"
252 eerror 265 eerror
253 eerror " $@" 266 eerror " $@"
254 eerror 267 eerror
255 die "Missing PHP USE flags found" 268 die "Missing PHP USE flags found"
269 else
270 return 1
271 fi
256} 272}
257 273
258# ======================================================================== 274# ========================================================================
259# has_*() functions 275# has_*() functions
260# 276#
264# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled 280# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled
265 281
266has_zts() { 282has_zts() {
267 has_php 283 has_php
268 284
269 if built_with_use =${PHP_PKG} apache2 threads ; then 285 if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then
270 return 0 286 return 0
271 fi 287 fi
272 288
273 return 1 289 return 1
274} 290}
276# Check if our PHP was built with Hardened-PHP enabled 292# Check if our PHP was built with Hardened-PHP enabled
277 293
278has_hardenedphp() { 294has_hardenedphp() {
279 has_php 295 has_php
280 296
281 if built_with_use =${PHP_PKG} hardenedphp ; then 297 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
282 return 0 298 return 0
283 fi 299 fi
284 300
285 return 1 301 return 1
286} 302}
288# Check if our PHP was built with debug support enabled 304# Check if our PHP was built with debug support enabled
289 305
290has_debug() { 306has_debug() {
291 has_php 307 has_php
292 308
293 if built_with_use =${PHP_PKG} debug ; then 309 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
294 return 0 310 return 0
295 fi 311 fi
296 312
297 return 1 313 return 1
298} 314}
321 eerror 337 eerror
322 die "PHP 5 not installed" 338 die "PHP 5 not installed"
323 fi 339 fi
324 340
325 # Was PHP5 compiled with internal PDO support? 341 # Was PHP5 compiled with internal PDO support?
326 if built_with_use =${PHP_PKG} pdo ; then 342 if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then
327 return 343 return
328 fi 344 fi
329 345
330 # Ok, maybe PDO was built as an external extension? 346 # Ok, maybe PDO was built as an external extension?
331 if built_with_use =${PHP_PKG} pdo-external && has_version 'dev-php5/pecl-pdo' ; then 347 if ( built_with_use =${PHP_PKG} pdo-external || phpconfutils_built_with_use =${PHP_PKG} pdo-external ) && has_version 'dev-php5/pecl-pdo' ; then
332 return 348 return
333 fi 349 fi
334 350
335 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support 351 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support
336 if has_version 'dev-php5/pecl-pdo' ; then 352 if has_version 'dev-php5/pecl-pdo' ; then
366 382
367 # Detect which PHP version we have installed 383 # Detect which PHP version we have installed
368 if has_version '=dev-lang/php-4*' ; then 384 if has_version '=dev-lang/php-4*' ; then
369 PHP_PACKAGE_FOUND="1" 385 PHP_PACKAGE_FOUND="1"
370 pkg="`best_version '=dev-lang/php-4*'`" 386 pkg="`best_version '=dev-lang/php-4*'`"
371 if built_with_use =${pkg} cli ; then 387 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
372 PHP_VERSION="4" 388 PHP_VERSION="4"
373 fi 389 fi
374 fi 390 fi
375 391
376 if has_version '=dev-lang/php-5*' ; then 392 if has_version '=dev-lang/php-5*' ; then
377 PHP_PACKAGE_FOUND="1" 393 PHP_PACKAGE_FOUND="1"
378 pkg="`best_version '=dev-lang/php-5*'`" 394 pkg="`best_version '=dev-lang/php-5*'`"
379 if built_with_use =${pkg} cli ; then 395 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
380 PHP_VERSION="5" 396 PHP_VERSION="5"
381 fi 397 fi
382 fi 398 fi
383 399
384 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 400 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
409 425
410 # Detect which PHP version we have installed 426 # Detect which PHP version we have installed
411 if has_version '=dev-lang/php-4*' ; then 427 if has_version '=dev-lang/php-4*' ; then
412 PHP_PACKAGE_FOUND="1" 428 PHP_PACKAGE_FOUND="1"
413 pkg="`best_version '=dev-lang/php-4*'`" 429 pkg="`best_version '=dev-lang/php-4*'`"
414 if built_with_use =${pkg} cgi ; then 430 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
415 PHP_VERSION="4" 431 PHP_VERSION="4"
416 fi 432 fi
417 fi 433 fi
418 434
419 if has_version '=dev-lang/php-5*' ; then 435 if has_version '=dev-lang/php-5*' ; then
420 PHP_PACKAGE_FOUND="1" 436 PHP_PACKAGE_FOUND="1"
421 pkg="`best_version '=dev-lang/php-5*'`" 437 pkg="`best_version '=dev-lang/php-5*'`"
422 if built_with_use =${pkg} cgi ; then 438 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
423 PHP_VERSION="5" 439 PHP_VERSION="5"
424 fi 440 fi
425 fi 441 fi
426 442
427 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 443 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
503 519
504 local PUSE_ENABLED="" 520 local PUSE_ENABLED=""
505 521
506 # Binary extensions do not support the change of PHP 522 # Binary extensions do not support the change of PHP
507 # API version, so they can't be installed when USE flags 523 # API version, so they can't be installed when USE flags
508 # are enabled wich change the PHP API version 524 # are enabled which change the PHP API version, they also
525 # don't provide correctly versioned symbols for our use
509 526
510 if built_with_use =${PHP_PKG} hardenedphp ; then 527 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
511 eerror 528 eerror
512 eerror "You cannot install binary PHP extensions" 529 eerror "You cannot install binary PHP extensions"
513 eerror "when the 'hardenedphp' USE flag is enabled!" 530 eerror "when the 'hardenedphp' USE flag is enabled!"
514 eerror "Please reemerge dev-lang/php with the" 531 eerror "Please reemerge dev-lang/php with the"
515 eerror "'hardenedphp' USE flag turned off." 532 eerror "'hardenedphp' USE flag turned off."
516 eerror 533 eerror
517 PUSE_ENABLED="1" 534 PUSE_ENABLED="1"
518 fi 535 fi
519 536
520 if built_with_use =${PHP_PKG} debug ; then 537 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
521 eerror 538 eerror
522 eerror "You cannot install binary PHP extensions" 539 eerror "You cannot install binary PHP extensions"
523 eerror "when the 'debug' USE flag is enabled!" 540 eerror "when the 'debug' USE flag is enabled!"
524 eerror "Please reemerge dev-lang/php with the" 541 eerror "Please reemerge dev-lang/php with the"
525 eerror "'debug' USE flag turned off." 542 eerror "'debug' USE flag turned off."
526 eerror 543 eerror
527 PUSE_ENABLED="1" 544 PUSE_ENABLED="1"
528 fi 545 fi
529 546
547 if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then
548 eerror
549 eerror "You cannot install binary PHP extensions when"
550 eerror "the 'concurrentmodphp' USE flag is enabled!"
551 eerror "Please reemerge dev-lang/php with the"
552 eerror "'concurrentmodphp' USE flag turned off."
553 eerror
554 PUSE_ENABLED="1"
555 fi
556
530 if [[ -n ${PUSE_ENABLED} ]] ; then 557 if [[ -n ${PUSE_ENABLED} ]] ; then
531 die "'hardenedphp' and/or 'debug' USE flags turned on" 558 die "'hardenedphp' and/or 'debug' and/or 'concurrentmodphp' USE flags turned on!"
532 fi 559 fi
533} 560}
534 561
535# Alternative to dodoc function for use in our PHP eclasses and 562# Alternative to dodoc function for use in our PHP eclasses and
536# ebuilds. 563# ebuilds.

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20