/[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.26 Revision 1.35
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2015 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.26 2010/07/13 23:48:46 mabi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.35 2015/06/18 14:22:59 grknight Exp $
4 4
5# @ECLASS: depend.php.eclass
6# @MAINTAINER:
7# Gentoo PHP team <php-bugs@gentoo.org>
8# @AUTHOR:
5# Author: Stuart Herbert <stuart@gentoo.org> 9# Author: Stuart Herbert <stuart@gentoo.org>
6# Author: Luca Longinotti <chtekk@gentoo.org> 10# Author: Luca Longinotti <chtekk@gentoo.org>
7# Author: Jakub Moc <jakub@gentoo.org> (documentation) 11# Author: Jakub Moc <jakub@gentoo.org> (documentation)
8
9# @ECLASS: depend.php.eclass
10# @MAINTAINER:
11# Gentoo PHP team <php-bugs@gentoo.org>
12# @BLURB: Functions to allow ebuilds to depend on php5 and check for specific features. 12# @BLURB: Functions to allow ebuilds to depend on php5 and check for specific features.
13# @DESCRIPTION: 13# @DESCRIPTION:
14# This eclass provides functions that allow ebuilds to depend on php5 and check 14# This eclass provides functions that allow ebuilds to depend on php5 and check
15# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install 15# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
16# documentation for PHP packages to php-specific location. 16# documentation for PHP packages to php-specific location.
17 17
18
19inherit eutils phpconfutils 18inherit eutils multilib
20 19
21# PHP5-only depend functions 20# PHP5-only depend functions
22 21
23# @FUNCTION: need_php5_cli 22# @FUNCTION: need_php5_cli
24# @DESCRIPTION: 23# @DESCRIPTION:
25# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 24# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
26# with cli SAPI. 25# with cli SAPI.
27need_php5_cli() { 26need_php5_cli() {
27 eqawarn "(need_php5_cli) Deprecated function call. Set to be removed on 2015-07-17"
28 DEPEND="${DEPEND} =virtual/php-5*" 28 DEPEND="${DEPEND} =dev-lang/php-5*"
29 RDEPEND="${RDEPEND} =virtual/php-5*" 29 RDEPEND="${RDEPEND} =dev-lang/php-5*"
30 PHP_VERSION="5" 30 PHP_VERSION="5"
31} 31}
32 32
33# @FUNCTION: need_php5_httpd 33# @FUNCTION: need_php5_httpd
34# @DESCRIPTION: 34# @DESCRIPTION:
35# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 35# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
36# with either cgi or apache2 SAPI. 36# with either cgi or apache2 SAPI.
37need_php5_httpd() { 37need_php5_httpd() {
38 eqawarn "(need_php5_httpd) Deprecated function call. Set to be removed on 2015-07-17"
38 DEPEND="${DEPEND} =virtual/httpd-php-5*" 39 DEPEND="${DEPEND} =virtual/httpd-php-5*"
39 RDEPEND="${RDEPEND} =virtual/httpd-php-5*" 40 RDEPEND="${RDEPEND} =virtual/httpd-php-5*"
40 PHP_VERSION="5" 41 PHP_VERSION="5"
41} 42}
42 43
74# @FUNCTION: need_php_cli 75# @FUNCTION: need_php_cli
75# @DESCRIPTION: 76# @DESCRIPTION:
76# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP 77# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
77# (any version) with cli SAPI. 78# (any version) with cli SAPI.
78need_php_cli() { 79need_php_cli() {
80 eqawarn "(need_php_cli) Deprecated function call. Set to be removed on 2015-07-17"
79 DEPEND="${DEPEND} virtual/php" 81 DEPEND="${DEPEND} dev-lang/php"
80 RDEPEND="${RDEPEND} virtual/php" 82 RDEPEND="${RDEPEND} dev-lang/php"
81} 83}
82 84
83# @FUNCTION: need_php_httpd 85# @FUNCTION: need_php_httpd
84# @DESCRIPTION: 86# @DESCRIPTION:
85# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP 87# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
103# @DESCRIPTION: 105# @DESCRIPTION:
104# Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version 106# Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version
105# determined by ${CATEGORY} - any PHP version or PHP5 for dev-php or 107# determined by ${CATEGORY} - any PHP version or PHP5 for dev-php or
106# dev-php5, respectively. 108# dev-php5, respectively.
107need_php_by_category() { 109need_php_by_category() {
110 eqawarn "(need_php_by_category) Deprecated function call. Set to be removed on 2015-07-17"
108 case "${CATEGORY}" in 111 case "${CATEGORY}" in
109 dev-php) need_php ;; 112 dev-php) need_php ;;
110 dev-php5) need_php5 ;;
111 *) die "Version of PHP required by packages in category ${CATEGORY} unknown" 113 *) die "Version of PHP required by packages in category ${CATEGORY} unknown"
112 esac 114 esac
113} 115}
114 116
115 117
145# require_php_cli or require_php_cgi) in pkg_setup until we are able to 147# require_php_cli or require_php_cgi) in pkg_setup until we are able to
146# depend on USE flags being enabled. The above described need_php[45]_cli 148# depend on USE flags being enabled. The above described need_php[45]_cli
147# and need_php[45]_httpd functions cannot guarantee these requirements. 149# and need_php[45]_httpd functions cannot guarantee these requirements.
148# See Bug 2272 for details. 150# See Bug 2272 for details.
149require_php_sapi_from() { 151require_php_sapi_from() {
152 eqawarn "(require_php_sapi_from) Deprecated function call. Set to be removed on 2015-07-17"
150 has_php 153 has_php
151 154
152 local has_sapi="0" 155 local has_sapi="0"
153 local x 156 local x
154 157
155 einfo "Checking for compatible SAPI(s)" 158 einfo "Checking for compatible SAPI(s)"
156 159
157 for x in $@ ; do 160 for x in $@ ; do
158 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 161 if built_with_use =${PHP_PKG} ${x} ; then
159 einfo " Discovered compatible SAPI ${x}" 162 einfo " Discovered compatible SAPI ${x}"
160 has_sapi="1" 163 has_sapi="1"
161 fi 164 fi
162 done 165 done
163 166
205 local x 208 local x
206 209
207 einfo "Checking for required PHP feature(s) ..." 210 einfo "Checking for required PHP feature(s) ..."
208 211
209 for x in $@ ; do 212 for x in $@ ; do
210 if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 213 case $x in
214 pcre|spl|reflection|mhash)
215 eqawarn "require_php_with_use MUST NOT check for the pcre, spl, mhash or reflection USE flag."
216 eqawarn "These USE flags are removed from >=dev-lang/php-5.3 and your ebuild will break"
217 eqawarn "if you check the USE flags against PHP 5.3 ebuilds."
218 eqawarn "Please use USE dependencies from EAPI 2 instead"
219 ;;
220 esac
221
222 if ! built_with_use =${PHP_PKG} ${x} ; then
211 einfo " Discovered missing USE flag: ${x}" 223 einfo " Discovered missing USE flag: ${x}"
212 missing_use="${missing_use} ${x}" 224 missing_use="${missing_use} ${x}"
213 fi 225 fi
214 done 226 done
215 227
239# @DESCRIPTION: 251# @DESCRIPTION:
240# Call this function from pkg_setup if your package requires PHP compiled with 252# Call this function from pkg_setup if your package requires PHP compiled with
241# any of specified USE flags. Returns if any of the listed USE flags are enabled. 253# any of specified USE flags. Returns if any of the listed USE flags are enabled.
242# Dies if all of the listed USE flags are disabled. 254# Dies if all of the listed USE flags are disabled.
243require_php_with_any_use() { 255require_php_with_any_use() {
256 eqawarn "(require_php_with_any_use) Deprecated function call. Set to be removed on 2015-07-17"
244 has_php 257 has_php
245 258
246 local missing_use="" 259 local missing_use=""
247 local x 260 local x
248 261
249 einfo "Checking for required PHP feature(s) ..." 262 einfo "Checking for required PHP feature(s) ..."
250 263
251 for x in $@ ; do 264 for x in $@ ; do
252 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 265 if built_with_use =${PHP_PKG} ${x} ; then
253 einfo " USE flag ${x} is enabled, ok ..." 266 einfo " USE flag ${x} is enabled, ok ..."
254 return 267 return
255 else 268 else
256 missing_use="${missing_use} ${x}" 269 missing_use="${missing_use} ${x}"
257 fi 270 fi
287# @FUNCTION: has_zts 300# @FUNCTION: has_zts
288# @DESCRIPTION: 301# @DESCRIPTION:
289# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled. 302# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled.
290# @RETURN: 0 if true, 1 otherwise 303# @RETURN: 0 if true, 1 otherwise
291has_zts() { 304has_zts() {
305 eqawarn "(has_zts) Deprecated function call. Set to be removed on 2015-07-17"
292 has_php 306 has_php
293 307
294 if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then 308 if built_with_use =${PHP_PKG} apache2 threads ; then
295 return 0 309 return 0
296 fi 310 fi
297 311
298 return 1 312 return 1
299} 313}
301# @FUNCTION: has_debug 315# @FUNCTION: has_debug
302# @DESCRIPTION: 316# @DESCRIPTION:
303# Check if our PHP was built with debug support enabled. 317# Check if our PHP was built with debug support enabled.
304# @RETURN: 0 if true, 1 otherwise 318# @RETURN: 0 if true, 1 otherwise
305has_debug() { 319has_debug() {
320 eqawarn "(has_debug) Deprecated function call. Set to be removed on 2015-07-17"
306 has_php 321 has_php
307 322
308 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then 323 if built_with_use =${PHP_PKG} debug ; then
309 return 0 324 return 0
310 fi 325 fi
311 326
312 return 1 327 return 1
313} 328}
315# @FUNCTION: has_concurrentmodphp 330# @FUNCTION: has_concurrentmodphp
316# @DESCRIPTION: 331# @DESCRIPTION:
317# Check if our PHP was built with the concurrentmodphp support enabled. 332# Check if our PHP was built with the concurrentmodphp support enabled.
318# @RETURN: 0 if true, 1 otherwise 333# @RETURN: 0 if true, 1 otherwise
319has_concurrentmodphp() { 334has_concurrentmodphp() {
335 eqawarn "(has_concurrentmodphp) Deprecated function call. Set to be removed on 2015-07-17"
320 has_php 336 has_php
321 337
322 if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then 338 if built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then
323 return 0 339 return 0
324 fi 340 fi
325 341
326 return 1 342 return 1
327} 343}
338# This function is now redundant and DEPRECATED since 354# This function is now redundant and DEPRECATED since
339# pdo-external use flag and pecl-pdo-* ebuilds were removed. 355# pdo-external use flag and pecl-pdo-* ebuilds were removed.
340# You should use require_php_with_use pdo instead now. 356# You should use require_php_with_use pdo instead now.
341# @RETURN: die if feature is missing 357# @RETURN: die if feature is missing
342require_pdo() { 358require_pdo() {
359 eqawarn "(require_pdo) Deprecated function call. Set to be removed on 2015-07-17"
343 has_php 360 has_php
344 361
345 # Was PHP5 compiled with internal PDO support? 362 # Was PHP5 compiled with internal PDO support?
346 if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then 363 if built_with_use =${PHP_PKG} pdo ; then
347 return 364 return
348 else 365 else
349 eerror 366 eerror
350 eerror "No PDO extension for PHP found." 367 eerror "No PDO extension for PHP found."
351 eerror "Please note that PDO only exists for PHP 5." 368 eerror "Please note that PDO only exists for PHP 5."
361# Determines which installed PHP version has the CLI SAPI enabled. 378# Determines which installed PHP version has the CLI SAPI enabled.
362# Useful for PEAR stuff, or anything which needs to run PHP script 379# Useful for PEAR stuff, or anything which needs to run PHP script
363# depending on the CLI SAPI. 380# depending on the CLI SAPI.
364# @RETURN: die if feature is missing 381# @RETURN: die if feature is missing
365require_php_cli() { 382require_php_cli() {
383 eqawarn "(require_php_cli) Deprecated function call. Set to be removed on 2015-07-17"
366 # If PHP_PKG is set, then we have remembered our PHP settings 384 # If PHP_PKG is set, then we have remembered our PHP settings
367 # from last time 385 # from last time
368 if [[ -n ${PHP_PKG} ]] ; then 386 if [[ -n ${PHP_PKG} ]] ; then
369 return 387 return
370 fi 388 fi
372 local PHP_PACKAGE_FOUND="" 390 local PHP_PACKAGE_FOUND=""
373 391
374 if has_version '=dev-lang/php-5*' ; then 392 if has_version '=dev-lang/php-5*' ; then
375 PHP_PACKAGE_FOUND="1" 393 PHP_PACKAGE_FOUND="1"
376 pkg="$(best_version '=dev-lang/php-5*')" 394 pkg="$(best_version '=dev-lang/php-5*')"
377 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then 395 if built_with_use =${pkg} cli ; then
378 PHP_VERSION="5" 396 PHP_VERSION="5"
379 fi 397 fi
380 fi 398 fi
381 399
382 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 400 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
407 local PHP_PACKAGE_FOUND="" 425 local PHP_PACKAGE_FOUND=""
408 426
409 if has_version '=dev-lang/php-5*' ; then 427 if has_version '=dev-lang/php-5*' ; then
410 PHP_PACKAGE_FOUND="1" 428 PHP_PACKAGE_FOUND="1"
411 pkg="$(best_version '=dev-lang/php-5*')" 429 pkg="$(best_version '=dev-lang/php-5*')"
412 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then 430 if built_with_use =${pkg} cgi ; then
413 PHP_VERSION="5" 431 PHP_VERSION="5"
414 fi 432 fi
415 fi 433 fi
416 434
417 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 435 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
430# @FUNCTION: require_sqlite 448# @FUNCTION: require_sqlite
431# @DESCRIPTION: 449# @DESCRIPTION:
432# Require a PHP built with SQLite support 450# Require a PHP built with SQLite support
433# @RETURN: die if feature is missing 451# @RETURN: die if feature is missing
434require_sqlite() { 452require_sqlite() {
453 eqawarn "(require_sqlite) Deprecated function call. Set to be removed on 2015-07-17"
435 has_php 454 has_php
436 455
437 # Has our PHP been built with SQLite support? 456 # Has our PHP been built with SQLite support?
438 if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then 457 if built_with_use =${PHP_PKG} sqlite ; then
439 return 458 return
440 fi 459 fi
441 460
442 # If we get here, then we don't have any SQLite support for PHP installed 461 # If we get here, then we don't have any SQLite support for PHP installed
443 eerror 462 eerror
452# @FUNCTION: require_gd 471# @FUNCTION: require_gd
453# @DESCRIPTION: 472# @DESCRIPTION:
454# Require a PHP built with GD support 473# Require a PHP built with GD support
455# @RETURN: die if feature is missing 474# @RETURN: die if feature is missing
456require_gd() { 475require_gd() {
476 eqawarn "(require_gd) Deprecated function call. Set to be removed on 2015-07-17"
457 has_php 477 has_php
458 478
459 # Do we have the internal GD support installed? 479 # Do we have the internal GD support installed?
460 if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then 480 if built_with_use =${PHP_PKG} gd ; then
461 return 481 return
462 fi 482 fi
463 483
464 # Ok, maybe GD was built using the external library support? 484 # Ok, maybe GD was built using the external library support?
465 if built_with_use =${PHP_PKG} gd-external || phpconfutils_built_with_use =${PHP_PKG} gd-external ; then 485 if built_with_use =${PHP_PKG} gd-external ; then
466 return 486 return
467 fi 487 fi
468 488
469 # If we get here, then we have no GD support 489 # If we get here, then we have no GD support
470 eerror 490 eerror
485 505
486# @FUNCTION: php_binary_extension 506# @FUNCTION: php_binary_extension
487# @DESCRIPTION: 507# @DESCRIPTION:
488# Executes some checks needed when installing a binary PHP extension. 508# Executes some checks needed when installing a binary PHP extension.
489php_binary_extension() { 509php_binary_extension() {
510 eqawarn "(php_binary_extension) Deprecated function call. Set to be removed on 2015-07-17"
490 has_php 511 has_php
491 512
492 local PUSE_ENABLED="" 513 local PUSE_ENABLED=""
493 514
494 # Binary extensions do not support the change of PHP 515 # Binary extensions do not support the change of PHP

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.20