/[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.20 Revision 1.25
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.20 2007/08/16 22:11:00 hoffie Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.25 2008/02/26 16:26:08 armin76 Exp $
4 4
5# ======================================================================== 5# Author: Stuart Herbert <stuart@gentoo.org>
6# 6# Author: Luca Longinotti <chtekk@gentoo.org>
7# Author: Jakub Moc <jakub@gentoo.org> (documentation)
8
7# depend.php.eclass 9# @ECLASS: depend.php.eclass
8# Functions to allow ebuilds to depend on php4 and/or php5 10# @MAINTAINER:
9#
10# Author: Stuart Herbert
11# <stuart@gentoo.org>
12#
13# Author: Luca Longinotti
14# <chtekk@gentoo.org>
15#
16# Maintained by the PHP Team <php-bugs@gentoo.org> 11# Gentoo PHP team <php-bugs@gentoo.org>
17# 12# @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features.
18# ======================================================================== 13# @DESCRIPTION:
14# This eclass provides functions that allow ebuilds to depend on php[45] and check
15# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
16# documentation for PHP packages to php-specific location.
17
19 18
20inherit eutils phpconfutils 19inherit eutils phpconfutils
21 20
22# PHP4-only depend functions 21# PHP4-only depend functions
22
23# @FUNCTION: need_php4_cli
24# @DESCRIPTION:
25# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
26# with cli SAPI.
23need_php4_cli() { 27need_php4_cli() {
24 DEPEND="${DEPEND} =virtual/php-4*" 28 DEPEND="${DEPEND} =virtual/php-4*"
25 RDEPEND="${RDEPEND} =virtual/php-4*" 29 RDEPEND="${RDEPEND} =virtual/php-4*"
26 PHP_VERSION="4" 30 PHP_VERSION="4"
27} 31}
28 32
33# @FUNCTION: need_php4_httpd
34# @DESCRIPTION:
35# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
36# with either cgi or apache2 SAPI.
29need_php4_httpd() { 37need_php4_httpd() {
30 DEPEND="${DEPEND} =virtual/httpd-php-4*" 38 DEPEND="${DEPEND} =virtual/httpd-php-4*"
31 RDEPEND="${RDEPEND} =virtual/httpd-php-4*" 39 RDEPEND="${RDEPEND} =virtual/httpd-php-4*"
32 PHP_VERSION="4" 40 PHP_VERSION="4"
33} 41}
34 42
43# @FUNCTION: need_php4
44# @DESCRIPTION:
45# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4
46# (with any SAPI).
35need_php4() { 47need_php4() {
36 DEPEND="${DEPEND} =dev-lang/php-4*" 48 DEPEND="${DEPEND} =dev-lang/php-4*"
37 RDEPEND="${RDEPEND} =dev-lang/php-4*" 49 RDEPEND="${RDEPEND} =dev-lang/php-4*"
38 PHP_VERSION="4" 50 PHP_VERSION="4"
39 PHP_SHARED_CAT="php4" 51 PHP_SHARED_CAT="php4"
46 58
47 PHPIZE="/usr/${libdir}/php4/bin/phpize" 59 PHPIZE="/usr/${libdir}/php4/bin/phpize"
48 PHPCONFIG="/usr/${libdir}/php4/bin/php-config" 60 PHPCONFIG="/usr/${libdir}/php4/bin/php-config"
49 PHPCLI="/usr/${libdir}/php4/bin/php" 61 PHPCLI="/usr/${libdir}/php4/bin/php"
50 PHPCGI="/usr/${libdir}/php4/bin/php-cgi" 62 PHPCGI="/usr/${libdir}/php4/bin/php-cgi"
51 PHP_PKG="`best_version =dev-lang/php-4*`" 63 PHP_PKG="$(best_version =dev-lang/php-4*)"
52 PHPPREFIX="/usr/${libdir}/php4" 64 PHPPREFIX="/usr/${libdir}/php4"
53 EXT_DIR="`${PHPCONFIG} --extension-dir 2>/dev/null`" 65 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
54 66
55 einfo 67 einfo
56 einfo "Using ${PHP_PKG}" 68 einfo "Using ${PHP_PKG}"
57 einfo 69 einfo
58} 70}
59 71
60# PHP5-only depend functions 72# PHP5-only depend functions
73
74# @FUNCTION: need_php5_cli
75# @DESCRIPTION:
76# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
77# with cli SAPI.
61need_php5_cli() { 78need_php5_cli() {
62 DEPEND="${DEPEND} =virtual/php-5*" 79 DEPEND="${DEPEND} =virtual/php-5*"
63 RDEPEND="${RDEPEND} =virtual/php-5*" 80 RDEPEND="${RDEPEND} =virtual/php-5*"
64 PHP_VERSION="5" 81 PHP_VERSION="5"
65} 82}
66 83
84# @FUNCTION: need_php5_httpd
85# @DESCRIPTION:
86# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
87# with either cgi or apache2 SAPI.
67need_php5_httpd() { 88need_php5_httpd() {
68 DEPEND="${DEPEND} =virtual/httpd-php-5*" 89 DEPEND="${DEPEND} =virtual/httpd-php-5*"
69 RDEPEND="${RDEPEND} =virtual/httpd-php-5*" 90 RDEPEND="${RDEPEND} =virtual/httpd-php-5*"
70 PHP_VERSION="5" 91 PHP_VERSION="5"
71} 92}
72 93
94# @FUNCTION: need_php5
95# @DESCRIPTION:
96# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
97# (with any SAPI).
73need_php5() { 98need_php5() {
74 DEPEND="${DEPEND} =dev-lang/php-5*" 99 DEPEND="${DEPEND} =dev-lang/php-5*"
75 RDEPEND="${RDEPEND} =dev-lang/php-5*" 100 RDEPEND="${RDEPEND} =dev-lang/php-5*"
76 PHP_VERSION="5" 101 PHP_VERSION="5"
77 PHP_SHARED_CAT="php5" 102 PHP_SHARED_CAT="php5"
84 109
85 PHPIZE="/usr/${libdir}/php5/bin/phpize" 110 PHPIZE="/usr/${libdir}/php5/bin/phpize"
86 PHPCONFIG="/usr/${libdir}/php5/bin/php-config" 111 PHPCONFIG="/usr/${libdir}/php5/bin/php-config"
87 PHPCLI="/usr/${libdir}/php5/bin/php" 112 PHPCLI="/usr/${libdir}/php5/bin/php"
88 PHPCGI="/usr/${libdir}/php5/bin/php-cgi" 113 PHPCGI="/usr/${libdir}/php5/bin/php-cgi"
89 PHP_PKG="`best_version =dev-lang/php-5*`" 114 PHP_PKG="$(best_version =dev-lang/php-5*)"
90 PHPPREFIX="/usr/${libdir}/php5" 115 PHPPREFIX="/usr/${libdir}/php5"
91 EXT_DIR="`${PHPCONFIG} --extension-dir 2>/dev/null`" 116 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
92 117
93 einfo 118 einfo
94 einfo "Using ${PHP_PKG}" 119 einfo "Using ${PHP_PKG}"
95 einfo 120 einfo
96} 121}
97 122
98# general PHP depend functions 123# general PHP depend functions
124
125# @FUNCTION: need_php_cli
126# @DESCRIPTION:
127# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
128# (any version) with cli SAPI.
99need_php_cli() { 129need_php_cli() {
100 DEPEND="${DEPEND} virtual/php" 130 DEPEND="${DEPEND} virtual/php"
101 RDEPEND="${RDEPEND} virtual/php" 131 RDEPEND="${RDEPEND} virtual/php"
102} 132}
103 133
134# @FUNCTION: need_php_httpd
135# @DESCRIPTION:
136# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
137# (any version) with either cgi or apache2 SAPI.
104need_php_httpd() { 138need_php_httpd() {
105 DEPEND="${DEPEND} virtual/httpd-php" 139 DEPEND="${DEPEND} virtual/httpd-php"
106 RDEPEND="${RDEPEND} virtual/httpd-php" 140 RDEPEND="${RDEPEND} virtual/httpd-php"
107} 141}
108 142
143# @FUNCTION: need_php
144# @DESCRIPTION:
145# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
146# (any version with any SAPI).
109need_php() { 147need_php() {
110 DEPEND="${DEPEND} dev-lang/php" 148 DEPEND="${DEPEND} dev-lang/php"
111 RDEPEND="${RDEPEND} dev-lang/php" 149 RDEPEND="${RDEPEND} dev-lang/php"
112 PHP_SHARED_CAT="php" 150 PHP_SHARED_CAT="php"
113} 151}
114 152
153# @FUNCTION: need_php_by_category
154# @DESCRIPTION:
155# Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version
156# determined by ${CATEGORY} - any PHP version, PHP4 or PHP5 for dev-php, dev-php4 and
157# dev-php5, respectively.
115need_php_by_category() { 158need_php_by_category() {
116 case "${CATEGORY}" in 159 case "${CATEGORY}" in
117 dev-php) need_php ;; 160 dev-php) need_php ;;
118 dev-php4) need_php4 ;; 161 dev-php4) need_php4 ;;
119 dev-php5) need_php5 ;; 162 dev-php5) need_php5 ;;
120 *) die "Version of PHP required by packages in category ${CATEGORY} unknown" 163 *) die "Version of PHP required by packages in category ${CATEGORY} unknown"
121 esac 164 esac
122} 165}
123 166
167
168# @FUNCTION: has_php
169# @DESCRIPTION:
124# Call this function from your pkg_setup, src_compile and src_install methods 170# Call this function from your pkg_setup, src_compile, src_install etc. if you
125# if you need to know where the PHP binaries are installed and their data 171# need to know which PHP version is being used and where the PHP binaries/data
126 172# are installed.
127has_php() { 173has_php() {
128 # If PHP_PKG is already set, then we have remembered our PHP settings
129 # from last time
130 if [[ -n ${PHP_PKG} ]] ; then
131 return
132 fi
133
134 if [[ -z ${PHP_VERSION} ]] ; then
135 # Detect which PHP version we have installed 174 # Detect which PHP version we have installed
136 if has_version '=dev-lang/php-5*' ; then 175 if has_version '=dev-lang/php-5*' ; then
137 PHP_VERSION="5" 176 PHP_VERSION="5"
138 elif has_version '=dev-lang/php-4*' ; then 177 elif has_version '=dev-lang/php-4*' ; then
139 PHP_VERSION="4" 178 PHP_VERSION="4"
140 else 179 else
141 die "Unable to find an installed dev-lang/php package" 180 die "Unable to find an installed dev-lang/php package"
142 fi
143 fi 181 fi
144 182
145 # If we get here, then PHP_VERSION tells us which version of PHP we 183 # If we get here, then PHP_VERSION tells us which version of PHP we
146 # want to use 184 # want to use
147 uses_php${PHP_VERSION} 185 uses_php${PHP_VERSION}
148} 186}
149 187
188# @FUNCTION: require_php_sapi_from
189# @USAGE: <list of SAPIs>
190# @DESCRIPTION:
150# Call this function from pkg_setup if your package only works with 191# Call this function from pkg_setup if your package only works with
151# specific SAPIs 192# specific SAPI(s) and specify a list of PHP SAPI USE flags that are
193# required (one or more from cli, cgi, apache2) as arguments.
194# Returns if any of the listed SAPIs have been installed, dies if none
195# of them is available.
152# 196#
153# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache2) 197# Unfortunately, if you want to be really sure that the required SAPI is
154# 198# provided by PHP, you will have to use this function or similar ones (like
155# Returns if any one of the listed SAPIs have been installed 199# require_php_cli or require_php_cgi) in pkg_setup until we are able to
156# Dies if none of the listed SAPIs have been installed 200# depend on USE flags being enabled. The above described need_php[45]_cli
157 201# and need_php[45]_httpd functions cannot guarantee these requirements.
202# See Bug 2272 for details.
158require_php_sapi_from() { 203require_php_sapi_from() {
159 has_php 204 has_php
160 205
161 local has_sapi="0" 206 local has_sapi="0"
162 local x 207 local x
181 eerror " $@" 226 eerror " $@"
182 eerror 227 eerror
183 die "No compatible PHP SAPIs found" 228 die "No compatible PHP SAPIs found"
184} 229}
185 230
231# @FUNCTION: require_php_with_use
232# @USAGE: <list of USE flags>
233# @DESCRIPTION:
186# Call this function from pkg_setup if your package requires PHP compiled 234# Call this function from pkg_setup if your package requires PHP compiled
187# with specific USE flags 235# with specific USE flags. Returns if all of the listed USE flags are enabled.
236# Dies if any of the listed USE flags are disabled.
237
238# @VARIABLE: PHPCHECKNODIE
239# @DESCRIPTION:
240# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple
241# require_php_with_(any)_use checks without making the ebuild die on every failure.
242# This is useful in cases when certain PHP features are only required if specific
243# USE flag(s) are enabled for that ebuild.
244# @CODE
245# Example:
188# 246#
189# $1 ... a list of USE flags 247# local flags="pcre session snmp sockets wddx"
190# 248# use mysql && flags="${flags} mysql"
191# Returns if all of the listed USE flags are enabled 249# use postgres && flags="${flags} postgres"
192# Dies if any of the listed USE flags are disabled 250# if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \
193 251# || ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then
252# die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external"
253# fi
254# @CODE
194require_php_with_use() { 255require_php_with_use() {
195 has_php 256 has_php
196 257
197 local missing_use="" 258 local missing_use=""
198 local x 259 local x
225 else 286 else
226 return 1 287 return 1
227 fi 288 fi
228} 289}
229 290
291# @FUNCTION: require_php_with_any_use
292# @USAGE: <list of USE flags>
293# @DESCRIPTION:
230# Call this function from pkg_setup if your package requires PHP compiled 294# Call this function from pkg_setup if your package requires PHP compiled with
231# with any of specified USE flags
232#
233# $1 ... a list of USE flags
234#
235# Returns if any of the listed USE flags are enabled 295# any of specified USE flags. Returns if any of the listed USE flags are enabled.
236# Dies if all of the listed USE flags are disabled 296# Dies if all of the listed USE flags are disabled.
237
238require_php_with_any_use() { 297require_php_with_any_use() {
239 has_php 298 has_php
240 299
241 local missing_use="" 300 local missing_use=""
242 local x 301 local x
277# has_*() functions 336# has_*() functions
278# 337#
279# These functions return 0 if the condition is satisfied, 1 otherwise 338# These functions return 0 if the condition is satisfied, 1 otherwise
280# ======================================================================== 339# ========================================================================
281 340
341# @FUNCTION: has_zts
342# @DESCRIPTION:
282# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled 343# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled.
283 344# @RETURN: 0 if true, 1 otherwise
284has_zts() { 345has_zts() {
285 has_php 346 has_php
286 347
287 if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then 348 if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then
288 return 0 349 return 0
289 fi 350 fi
290 351
291 return 1 352 return 1
292} 353}
293 354
355# @FUNCTION: has_debug
356# @DESCRIPTION:
294# Check if our PHP was built with debug support enabled 357# Check if our PHP was built with debug support enabled.
295 358# @RETURN: 0 if true, 1 otherwise
296has_debug() { 359has_debug() {
297 has_php 360 has_php
298 361
299 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then 362 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
300 return 0 363 return 0
301 fi 364 fi
302 365
303 return 1 366 return 1
304} 367}
305 368
369# @FUNCTION: has_concurrentmodphp
370# @DESCRIPTION:
306# Check if our PHP was built with the concurrentmodphp support enabled 371# Check if our PHP was built with the concurrentmodphp support enabled.
307 372# @RETURN: 0 if true, 1 otherwise
308has_concurrentmodphp() { 373has_concurrentmodphp() {
309 has_php 374 has_php
310 375
311 if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then 376 if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then
312 return 0 377 return 0
319# require_*() functions 384# require_*() functions
320# 385#
321# These functions die() if PHP was built without the required features 386# These functions die() if PHP was built without the required features
322# ======================================================================== 387# ========================================================================
323 388
389# @FUNCTION: require_pdo
390# @DESCRIPTION:
324# Require a PHP built with PDO support (PHP5 only) 391# Require a PHP built with PDO support (PHP5 only).
325 392# This function is now redundant and DEPRECATED since
393# pdo-external use flag and pecl-pdo-* ebuilds were removed.
394# You should use require_php_with_use pdo instead now.
395# @RETURN: die if feature is missing
326require_pdo() { 396require_pdo() {
327 has_php 397 has_php
328 398
329 # Do we have PHP5 installed? 399 # Do we have PHP5 installed?
330 if [[ "${PHP_VERSION}" == "4" ]] ; then 400 if [[ "${PHP_VERSION}" == "4" ]] ; then
331 eerror 401 eerror
332 eerror "This package requires PDO." 402 eerror "This package requires PDO."
333 eerror "PDO is only available for PHP 5." 403 eerror "PDO is only available for PHP 5."
334 eerror "You must install >=dev-lang/php-5.1 with" 404 eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"."
335 eerror "either the 'pdo' or the 'pdo-external'"
336 eerror "USE flags turned on." 405 eerror "pdo USE flags turned on."
337 eerror 406 eerror
338 die "PHP 5 not installed" 407 die "PHP 5 not installed"
339 fi 408 fi
340 409
341 # Was PHP5 compiled with internal PDO support? 410 # Was PHP5 compiled with internal PDO support?
342 if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then 411 if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then
343 return 412 return
344 fi 413 else
345
346 # Ok, maybe PDO was built as an external extension?
347 if ( built_with_use =${PHP_PKG} pdo-external || phpconfutils_built_with_use =${PHP_PKG} pdo-external ) && has_version 'dev-php5/pecl-pdo' ; then
348 return
349 fi
350
351 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support
352 if has_version 'dev-php5/pecl-pdo' ; then
353 return
354 fi
355
356 # If we get here, then we don't have PDO support
357 eerror 414 eerror
358 eerror "No PDO extension for PHP found." 415 eerror "No PDO extension for PHP found."
359 eerror "Please note that PDO only exists for PHP 5." 416 eerror "Please note that PDO only exists for PHP 5."
360 eerror "Please install a PDO extension for PHP 5," 417 eerror "Please install a PDO extension for PHP 5."
361 eerror "you must install >=dev-lang/php-5.1 with" 418 eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"."
362 eerror "either the 'pdo' or the 'pdo-external'"
363 eerror "USE flags turned on."
364 eerror 419 eerror
365 die "No PDO extension for PHP 5 found" 420 die "No PDO extension for PHP 5 found"
421 fi
366} 422}
367 423
424# @FUNCTION: require_php_cli
425# @DESCRIPTION:
368# Determines which installed PHP version has the CLI SAPI enabled, 426# Determines which installed PHP version has the CLI SAPI enabled.
369# useful for PEAR stuff, or anything which needs to run PHP 427# Useful for PEAR stuff, or anything which needs to run PHP script
370# scripts depending on the CLI SAPI 428# depending on the CLI SAPI.
371 429# @RETURN: die if feature is missing
372require_php_cli() { 430require_php_cli() {
373 # If PHP_PKG is set, then we have remembered our PHP settings 431 # If PHP_PKG is set, then we have remembered our PHP settings
374 # from last time 432 # from last time
375 if [[ -n ${PHP_PKG} ]] ; then 433 if [[ -n ${PHP_PKG} ]] ; then
376 return 434 return
379 local PHP_PACKAGE_FOUND="" 437 local PHP_PACKAGE_FOUND=""
380 438
381 # Detect which PHP version we have installed 439 # Detect which PHP version we have installed
382 if has_version '=dev-lang/php-4*' ; then 440 if has_version '=dev-lang/php-4*' ; then
383 PHP_PACKAGE_FOUND="1" 441 PHP_PACKAGE_FOUND="1"
384 pkg="`best_version '=dev-lang/php-4*'`" 442 pkg="$(best_version '=dev-lang/php-4*')"
385 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then 443 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
386 PHP_VERSION="4" 444 PHP_VERSION="4"
387 fi 445 fi
388 fi 446 fi
389 447
390 if has_version '=dev-lang/php-5*' ; then 448 if has_version '=dev-lang/php-5*' ; then
391 PHP_PACKAGE_FOUND="1" 449 PHP_PACKAGE_FOUND="1"
392 pkg="`best_version '=dev-lang/php-5*'`" 450 pkg="$(best_version '=dev-lang/php-5*')"
393 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then 451 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
394 PHP_VERSION="5" 452 PHP_VERSION="5"
395 fi 453 fi
396 fi 454 fi
397 455
406 # If we get here, then PHP_VERSION tells us which version of PHP we 464 # If we get here, then PHP_VERSION tells us which version of PHP we
407 # want to use 465 # want to use
408 uses_php${PHP_VERSION} 466 uses_php${PHP_VERSION}
409} 467}
410 468
469# @FUNCTION: require_php_cgi
470# @DESCRIPTION:
411# Determines which installed PHP version has the CGI SAPI enabled, 471# Determines which installed PHP version has the CGI SAPI enabled.
412# useful for anything which needs to run PHP scripts 472# Useful for anything which needs to run PHP scripts depending on the CGI SAPI.
413# depending on the CGI SAPI 473# @RETURN: die if feature is missing
414
415require_php_cgi() { 474require_php_cgi() {
416 # If PHP_PKG is set, then we have remembered our PHP settings 475 # If PHP_PKG is set, then we have remembered our PHP settings
417 # from last time 476 # from last time
418 if [[ -n ${PHP_PKG} ]] ; then 477 if [[ -n ${PHP_PKG} ]] ; then
419 return 478 return
422 local PHP_PACKAGE_FOUND="" 481 local PHP_PACKAGE_FOUND=""
423 482
424 # Detect which PHP version we have installed 483 # Detect which PHP version we have installed
425 if has_version '=dev-lang/php-4*' ; then 484 if has_version '=dev-lang/php-4*' ; then
426 PHP_PACKAGE_FOUND="1" 485 PHP_PACKAGE_FOUND="1"
427 pkg="`best_version '=dev-lang/php-4*'`" 486 pkg="$(best_version '=dev-lang/php-4*')"
428 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then 487 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
429 PHP_VERSION="4" 488 PHP_VERSION="4"
430 fi 489 fi
431 fi 490 fi
432 491
433 if has_version '=dev-lang/php-5*' ; then 492 if has_version '=dev-lang/php-5*' ; then
434 PHP_PACKAGE_FOUND="1" 493 PHP_PACKAGE_FOUND="1"
435 pkg="`best_version '=dev-lang/php-5*'`" 494 pkg="$(best_version '=dev-lang/php-5*')"
436 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then 495 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
437 PHP_VERSION="5" 496 PHP_VERSION="5"
438 fi 497 fi
439 fi 498 fi
440 499
449 # If we get here, then PHP_VERSION tells us which version of PHP we 508 # If we get here, then PHP_VERSION tells us which version of PHP we
450 # want to use 509 # want to use
451 uses_php${PHP_VERSION} 510 uses_php${PHP_VERSION}
452} 511}
453 512
513# @FUNCTION: require_sqlite
514# @DESCRIPTION:
454# Require a PHP built with SQLite support 515# Require a PHP built with SQLite support
455 516# @RETURN: die if feature is missing
456require_sqlite() { 517require_sqlite() {
457 has_php 518 has_php
458 519
459 # Has our PHP been built with SQLite support? 520 # Has our PHP been built with SQLite support?
460 if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then 521 if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then
476 eerror "'sqlite' USE flag when emerging dev-lang/php." 537 eerror "'sqlite' USE flag when emerging dev-lang/php."
477 eerror 538 eerror
478 die "No SQLite extension for PHP found" 539 die "No SQLite extension for PHP found"
479} 540}
480 541
542# @FUNCTION: require_gd
543# @DESCRIPTION:
481# Require a PHP built with GD support 544# Require a PHP built with GD support
482 545# @RETURN: die if feature is missing
483require_gd() { 546require_gd() {
484 has_php 547 has_php
485 548
486 # Do we have the internal GD support installed? 549 # Do we have the internal GD support installed?
487 if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then 550 if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then
508# Misc functions 571# Misc functions
509# 572#
510# These functions provide miscellaneous checks and functionality. 573# These functions provide miscellaneous checks and functionality.
511# ======================================================================== 574# ========================================================================
512 575
576# @FUNCTION: php_binary_extension
577# @DESCRIPTION:
513# Executes some checks needed when installing a binary PHP extension 578# Executes some checks needed when installing a binary PHP extension.
514
515php_binary_extension() { 579php_binary_extension() {
516 has_php 580 has_php
517 581
518 local PUSE_ENABLED="" 582 local PUSE_ENABLED=""
519 583
545 if [[ -n ${PUSE_ENABLED} ]] ; then 609 if [[ -n ${PUSE_ENABLED} ]] ; then
546 die "'debug' and/or 'concurrentmodphp' USE flags turned on!" 610 die "'debug' and/or 'concurrentmodphp' USE flags turned on!"
547 fi 611 fi
548} 612}
549 613
614# @FUNCTION: dodoc-php
615# @USAGE: <list of docs>
616# @DESCRIPTION:
550# Alternative to dodoc function for use in our PHP eclasses and 617# Alternative to dodoc function for use in our PHP eclasses and ebuilds.
551# ebuilds.
552# Stored here because depend.php gets always sourced everywhere 618# Stored here because depend.php gets always sourced everywhere in the PHP
553# in the PHP ebuilds and eclasses.
554# It simply is dodoc with a changed path to the docs. 619# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
555# NOTE: no support for docinto is given! 620# NOTE: No support for docinto is provided!
556
557dodoc-php() { 621dodoc-php() {
558if [[ $# -lt 1 ]] ; then 622if [[ $# -lt 1 ]] ; then
559 echo "$0: at least one argument needed" 1>&2 623 echo "$0: at least one argument needed" 1>&2
560 exit 1 624 exit 1
561fi 625fi
562 626
563phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/" 627phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
564
565if [[ ! -d "${phpdocdir}" ]] ; then
566 install -d "${phpdocdir}"
567fi
568 628
569for x in $@ ; do 629for x in $@ ; do
570 if [[ -s "${x}" ]] ; then 630 if [[ -s "${x}" ]] ; then
571 install -m0644 "${x}" "${phpdocdir}" 631 insinto "${phpdocdir}"
632 doins "${x}"
572 gzip -f -9 "${phpdocdir}/${x##*/}" 633 gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
573 elif [[ ! -e "${x}" ]] ; then 634 elif [[ ! -e "${x}" ]] ; then
574 echo "dodoc-php: ${x} does not exist" 1>&2 635 echo "dodoc-php: ${x} does not exist" 1>&2
575 fi 636 fi
576done 637done
577} 638}
639
640# @FUNCTION: dohtml-php
641# @USAGE: <list of html docs>
642# @DESCRIPTION:
643# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
644# Stored here because depend.php gets always sourced everywhere in the PHP
645# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
646# NOTE: No support for [-a|-A|-p|-x] options is provided!
647dohtml-php() {
648if [[ $# -lt 1 ]] ; then
649 echo "$0: at least one argument needed" 1>&2
650 exit 1
651fi
652
653phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
654
655for x in $@ ; do
656 if [[ -s "${x}" ]] ; then
657 insinto "${phphtmldir}"
658 doins "${x}"
659 elif [[ ! -e "${x}" ]] ; then
660 echo "dohtml-php: ${x} does not exist" 1>&2
661 fi
662done
663}

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20