/[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.14 Revision 1.37
1# Copyright 1999-2005 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.14 2006/05/05 21:42:16 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.37 2015/07/17 18:29:39 grknight Exp $
4# 4
5# ======================================================================== 5# @DEAD
6#
7# depend.php.eclass 6# @ECLASS: depend.php.eclass
8# functions to allow ebuilds to depend on php4 and/or php5 7# @MAINTAINER:
9# 8# Gentoo PHP team <php-bugs@gentoo.org>
10# Author: Stuart Herbert 9# @AUTHOR:
11# <stuart@gentoo.org> 10# Author: Stuart Herbert <stuart@gentoo.org>
12# 11# Author: Luca Longinotti <chtekk@gentoo.org>
13# Author: Luca Longinotti 12# Author: Jakub Moc <jakub@gentoo.org> (documentation)
14# <chtekk@gentoo.org> 13# @BLURB: Functions to allow ebuilds to depend on php5 and check for specific features.
15# 14# @DESCRIPTION:
16# Maintained by the PHP Herd <php-bugs@gentoo.org> 15# This eclass provides functions that allow ebuilds to depend on php5 and check
17# 16# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
18# ======================================================================== 17# documentation for PHP packages to php-specific location.
18# This eclass is deprecated and is set to be removed 30 days after bug 552836 is resolved
19 19
20inherit eutils phpconfutils 20inherit eutils multilib
21
22# PHP4-only depend functions
23need_php4_cli() {
24 DEPEND="${DEPEND} =virtual/php-4*"
25 RDEPEND="${RDEPEND} =virtual/php-4*"
26 PHP_VERSION="4"
27}
28
29need_php4_httpd() {
30 DEPEND="${DEPEND} =virtual/httpd-php-4*"
31 RDEPEND="${RDEPEND} =virtual/httpd-php-4*"
32 PHP_VERSION="4"
33}
34
35need_php4() {
36 DEPEND="${DEPEND} =dev-lang/php-4*"
37 RDEPEND="${RDEPEND} =dev-lang/php-4*"
38 PHP_VERSION="4"
39 PHP_SHARED_CAT="php4"
40}
41
42# common settings go in here
43uses_php4() {
44 # cache this
45 libdir=$(get_libdir)
46
47 PHPIZE="/usr/${libdir}/php4/bin/phpize"
48 PHPCONFIG="/usr/${libdir}/php4/bin/php-config"
49 PHPCLI="/usr/${libdir}/php4/bin/php"
50 PHPCGI="/usr/${libdir}/php4/bin/php-cgi"
51 PHP_PKG="`best_version =dev-lang/php-4*`"
52 PHPPREFIX="/usr/${libdir}/php4"
53
54 einfo
55 einfo "Using ${PHP_PKG}"
56 einfo
57}
58 21
59# PHP5-only depend functions 22# PHP5-only depend functions
60need_php5_cli() {
61 DEPEND="${DEPEND} =virtual/php-5*"
62 RDEPEND="${RDEPEND} =virtual/php-5*"
63 PHP_VERSION="5"
64}
65 23
66need_php5_httpd() { 24# @FUNCTION: need_php5
67 DEPEND="${DEPEND} =virtual/httpd-php-5*" 25# @DESCRIPTION:
68 RDEPEND="${RDEPEND} =virtual/httpd-php-5*" 26# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
69 PHP_VERSION="5" 27# (with any SAPI).
70}
71
72need_php5() { 28need_php5() {
73 DEPEND="${DEPEND} =dev-lang/php-5*" 29 DEPEND="${DEPEND} =dev-lang/php-5*"
74 RDEPEND="${RDEPEND} =dev-lang/php-5*" 30 RDEPEND="${RDEPEND} =dev-lang/php-5*"
75 PHP_VERSION="5" 31 PHP_VERSION="5"
76 PHP_SHARED_CAT="php5" 32 PHP_SHARED_CAT="php5"
83 39
84 PHPIZE="/usr/${libdir}/php5/bin/phpize" 40 PHPIZE="/usr/${libdir}/php5/bin/phpize"
85 PHPCONFIG="/usr/${libdir}/php5/bin/php-config" 41 PHPCONFIG="/usr/${libdir}/php5/bin/php-config"
86 PHPCLI="/usr/${libdir}/php5/bin/php" 42 PHPCLI="/usr/${libdir}/php5/bin/php"
87 PHPCGI="/usr/${libdir}/php5/bin/php-cgi" 43 PHPCGI="/usr/${libdir}/php5/bin/php-cgi"
88 PHP_PKG="`best_version =dev-lang/php-5*`" 44 PHP_PKG="$(best_version =dev-lang/php-5*)"
89 PHPPREFIX="/usr/${libdir}/php5" 45 PHPPREFIX="/usr/${libdir}/php5"
46 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
90 47
91 einfo 48 einfo
92 einfo "Using ${PHP_PKG}" 49 einfo "Using ${PHP_PKG}"
93 einfo 50 einfo
94} 51}
95 52
96# general PHP depend functions 53# general PHP depend functions
97need_php_cli() {
98 DEPEND="${DEPEND} virtual/php"
99 RDEPEND="${RDEPEND} virtual/php"
100}
101 54
55# @FUNCTION: need_php_httpd
56# @DESCRIPTION:
57# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
58# (any version) with either cgi or apache2 SAPI.
102need_php_httpd() { 59need_php_httpd() {
103 DEPEND="${DEPEND} virtual/httpd-php" 60 DEPEND="${DEPEND} virtual/httpd-php"
104 RDEPEND="${RDEPEND} virtual/httpd-php" 61 RDEPEND="${RDEPEND} virtual/httpd-php"
105} 62}
106 63
64# @FUNCTION: need_php
65# @DESCRIPTION:
66# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
67# (any version with any SAPI).
107need_php() { 68need_php() {
108 DEPEND="${DEPEND} dev-lang/php" 69 DEPEND="${DEPEND} dev-lang/php"
109 RDEPEND="${RDEPEND} dev-lang/php" 70 RDEPEND="${RDEPEND} dev-lang/php"
110 PHP_SHARED_CAT="php" 71 PHP_SHARED_CAT="php"
111} 72}
112 73
113need_php_by_category() { 74# @FUNCTION: has_php
114 case "${CATEGORY}" in 75# @DESCRIPTION:
115 dev-php) need_php ;;
116 dev-php4) need_php4 ;;
117 dev-php5) need_php5 ;;
118 *) die "I don't know which version of PHP packages in ${CATEGORY} require"
119 esac
120}
121
122# Call this function from your pkg_setup, src_compile and src_install methods 76# Call this function from your pkg_setup, src_compile, src_install etc. if you
123# if you need to know where the PHP binaries are installed and their data 77# need to know which PHP version is being used and where the PHP binaries/data
124 78# are installed.
125has_php() { 79has_php() {
126 # If PHP_PKG is already set, then we have remembered our PHP settings
127 # from last time
128 if [[ -n ${PHP_PKG} ]] ; then
129 return
130 fi
131
132 if [[ -z ${PHP_VERSION} ]] ; then
133 # Detect which PHP version we have installed 80 # Detect which PHP version we have installed
134 if has_version '=dev-lang/php-5*' ; then 81 if has_version '=dev-lang/php-5*' ; then
135 PHP_VERSION="5" 82 PHP_VERSION="5"
136 elif has_version '=dev-lang/php-4*' ; then
137 PHP_VERSION="4"
138 else 83 else
139 die "Unable to find an installed dev-lang/php package" 84 die "Unable to find an installed dev-lang/php package"
140 fi
141 fi 85 fi
142 86
143 # If we get here, then PHP_VERSION tells us which version of PHP we 87 # If we get here, then PHP_VERSION tells us which version of PHP we
144 # want to use 88 # want to use
145 uses_php${PHP_VERSION} 89 uses_php${PHP_VERSION}
146} 90}
147 91
92# @FUNCTION: require_php_with_use
93# @USAGE: <list of USE flags>
94# @DESCRIPTION:
148# Call this function from pkg_setup if your package only works with 95# Call this function from pkg_setup if your package requires PHP compiled
149# specific SAPIs 96# with specific USE flags. Returns if all of the listed USE flags are enabled.
97# Dies if any of the listed USE flags are disabled.
98
99# @VARIABLE: PHPCHECKNODIE
100# @DESCRIPTION:
101# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple
102# require_php_with_(any)_use checks without making the ebuild die on every failure.
103# This is useful in cases when certain PHP features are only required if specific
104# USE flag(s) are enabled for that ebuild.
105# @CODE
106# Example:
150# 107#
151# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache, apache2) 108# local flags="pcre session snmp sockets wddx"
152# 109# use mysql && flags="${flags} mysql"
153# Returns if any one of the listed SAPIs have been installed 110# use postgres && flags="${flags} postgres"
154# Dies if none of the listed SAPIs have been installed 111# if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \
155 112# || ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then
156require_php_sapi_from() { 113# die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external"
157 has_php 114# fi
158 115# @CODE
159 local has_sapi="0"
160 local x
161
162 einfo "Checking for compatible SAPI(s)"
163
164 for x in $@ ; do
165 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
166 einfo " Discovered compatible SAPI ${x}"
167 has_sapi="1"
168 fi
169 done
170
171 if [[ "${has_sapi}" == "1" ]] ; then
172 return
173 fi
174
175 eerror
176 eerror "${PHP_PKG} needs to be re-installed with one of the following"
177 eerror "USE flags enabled:"
178 eerror
179 eerror " $@"
180 eerror
181 die "No compatible PHP SAPIs found"
182}
183
184# Call this function from pkg_setup if your package requires PHP compiled
185# with specific USE flags
186#
187# $1 ... a list of USE flags
188#
189# Returns if all of the listed USE flags are enabled
190# Dies if any of the listed USE flags are disabled
191
192require_php_with_use() { 116require_php_with_use() {
193 has_php 117 has_php
194 118
195 local missing_use="" 119 local missing_use=""
196 local x 120 local x
197 121
198 einfo "Checking for required PHP feature(s) ..." 122 einfo "Checking for required PHP feature(s) ..."
199 123
200 for x in $@ ; do 124 for x in $@ ; do
201 if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then 125 case $x in
126 pcre|spl|reflection|mhash)
127 eqawarn "require_php_with_use MUST NOT check for the pcre, spl, mhash or reflection USE flag."
128 eqawarn "These USE flags are removed from >=dev-lang/php-5.3 and your ebuild will break"
129 eqawarn "if you check the USE flags against PHP 5.3 ebuilds."
130 eqawarn "Please use USE dependencies from EAPI 2 instead"
131 ;;
132 esac
133
134 if ! built_with_use =${PHP_PKG} ${x} ; then
202 einfo " Discovered missing USE flag: ${x}" 135 einfo " Discovered missing USE flag: ${x}"
203 missing_use="${missing_use} ${x}" 136 missing_use="${missing_use} ${x}"
204 fi 137 fi
205 done 138 done
206 139
207 if [[ -z ${missing_use} ]] ; then 140 if [[ -z "${missing_use}" ]] ; then
208 return 141 if [[ -z "${PHPCHECKNODIE}" ]] ; then
209 fi
210
211 eerror
212 eerror "${PHP_PKG} needs to be re-installed with all of the following"
213 eerror "USE flags enabled:"
214 eerror
215 eerror " $@"
216 eerror
217 die "Missing PHP USE flags found"
218}
219
220# Call this function from pkg_setup if your package requires PHP compiled
221# with any of specified USE flags
222#
223# $1 ... a list of USE flags
224#
225# Returns if any of the listed USE flags are enabled
226# Dies if all of the listed USE flags are disabled
227
228require_php_with_any_use() {
229 has_php
230
231 local missing_use=""
232 local x
233
234 einfo "Checking for required PHP feature(s) ..."
235
236 for x in $@ ; do
237 if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then
238 einfo " USE flag ${x} is enabled, ok ..."
239 return 142 return
240 else 143 else
241 missing_use="${missing_use} ${x}" 144 return 0
242 fi 145 fi
243 done
244
245 if [[ -z ${missing_use} ]] ; then
246 return
247 fi 146 fi
248 147
148 if [[ -z "${PHPCHECKNODIE}" ]] ; then
249 eerror 149 eerror
250 eerror "${PHP_PKG} needs to be re-installed with any of the following" 150 eerror "${PHP_PKG} needs to be re-installed with all of the following"
251 eerror "USE flags enabled:" 151 eerror "USE flags enabled:"
252 eerror 152 eerror
253 eerror " $@" 153 eerror " $@"
254 eerror 154 eerror
255 die "Missing PHP USE flags found" 155 die "Missing PHP USE flags found"
256} 156 else
257
258# ========================================================================
259# has_*() functions
260#
261# These functions return 0 if the condition is satisfied, 1 otherwise
262# ========================================================================
263
264# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled
265
266has_zts() {
267 has_php
268
269 if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then
270 return 0
271 fi
272
273 return 1 157 return 1
274}
275
276# Check if our PHP was built with Hardened-PHP enabled
277
278has_hardenedphp() {
279 has_php
280
281 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
282 return 0
283 fi 158 fi
284
285 return 1
286} 159}
287 160
288# Check if our PHP was built with debug support enabled
289
290has_debug() {
291 has_php
292
293 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
294 return 0
295 fi
296
297 return 1
298}
299 161
300# ======================================================================== 162# ========================================================================
301# require_*() functions 163# require_*() functions
302# 164#
303# These functions die() if PHP was built without the required features 165# These functions die() if PHP was built without the required features
304# ======================================================================== 166# ========================================================================
305 167
306# Require a PHP built with PDO support (PHP5 only) 168# @FUNCTION: require_php_cgi
307 169# @DESCRIPTION:
308require_pdo() {
309 has_php
310
311 # Do we have PHP5 installed?
312 if [[ "${PHP_VERSION}" == "4" ]] ; then
313 eerror
314 eerror "This package requires PDO."
315 eerror "PDO is only available for PHP 5."
316 eerror "You must install =dev-lang/php-5.0* with"
317 eerror "the 'pdo-external' USE flag or you must"
318 eerror "install >=dev-lang/php-5.1 with either"
319 eerror "the 'pdo' or the 'pdo-external' USE flags"
320 eerror "turned on."
321 eerror
322 die "PHP 5 not installed"
323 fi
324
325 # Was PHP5 compiled with internal PDO support?
326 if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then
327 return
328 fi
329
330 # Ok, maybe PDO was built as an external extension?
331 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
333 fi
334
335 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support
336 if has_version 'dev-php5/pecl-pdo' ; then
337 return
338 fi
339
340 # If we get here, then we have no PDO support
341 eerror
342 eerror "No PDO extension for PHP found."
343 eerror "Please note that PDO only exists for PHP 5."
344 eerror "Please install a PDO extension for PHP 5,"
345 eerror "you must install =dev-lang/php-5.0* with"
346 eerror "the 'pdo-external' USE flag or you must"
347 eerror "install >=dev-lang/php-5.1 with either"
348 eerror "the 'pdo' or the 'pdo-external' USE flags"
349 eerror "turned on."
350 eerror
351 die "No PDO extension for PHP 5 found"
352}
353
354# Determines which installed PHP version has the CLI SAPI enabled,
355# useful for PEAR stuff, or anything which needs to run PHP
356# scripts depending on the CLI SAPI
357
358require_php_cli() {
359 # If PHP_PKG is set, then we have remembered our PHP settings
360 # from last time
361 if [[ -n ${PHP_PKG} ]] ; then
362 return
363 fi
364
365 local PHP_PACKAGE_FOUND=""
366
367 # Detect which PHP version we have installed
368 if has_version '=dev-lang/php-4*' ; then
369 PHP_PACKAGE_FOUND="1"
370 pkg="`best_version '=dev-lang/php-4*'`"
371 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
372 PHP_VERSION="4"
373 fi
374 fi
375
376 if has_version '=dev-lang/php-5*' ; then
377 PHP_PACKAGE_FOUND="1"
378 pkg="`best_version '=dev-lang/php-5*'`"
379 if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then
380 PHP_VERSION="5"
381 fi
382 fi
383
384 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
385 die "Unable to find an installed dev-lang/php package"
386 fi
387
388 if [[ -z ${PHP_VERSION} ]] ; then
389 die "No PHP CLI installed"
390 fi
391
392 # If we get here, then PHP_VERSION tells us which version of PHP we
393 # want to use
394 uses_php${PHP_VERSION}
395}
396
397# Determines which installed PHP version has the CGI SAPI enabled, 170# Determines which installed PHP version has the CGI SAPI enabled.
398# useful for anything which needs to run PHP scripts 171# Useful for anything which needs to run PHP scripts depending on the CGI SAPI.
399# depending on the CGI SAPI 172# @RETURN: die if feature is missing
400
401require_php_cgi() { 173require_php_cgi() {
402 # If PHP_PKG is set, then we have remembered our PHP settings 174 # If PHP_PKG is set, then we have remembered our PHP settings
403 # from last time 175 # from last time
404 if [[ -n ${PHP_PKG} ]] ; then 176 if [[ -n ${PHP_PKG} ]] ; then
405 return 177 return
406 fi 178 fi
407 179
408 local PHP_PACKAGE_FOUND="" 180 local PHP_PACKAGE_FOUND=""
409 181
410 # Detect which PHP version we have installed
411 if has_version '=dev-lang/php-4*' ; then
412 PHP_PACKAGE_FOUND="1"
413 pkg="`best_version '=dev-lang/php-4*'`"
414 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then
415 PHP_VERSION="4"
416 fi
417 fi
418
419 if has_version '=dev-lang/php-5*' ; then 182 if has_version '=dev-lang/php-5*' ; then
420 PHP_PACKAGE_FOUND="1" 183 PHP_PACKAGE_FOUND="1"
421 pkg="`best_version '=dev-lang/php-5*'`" 184 pkg="$(best_version '=dev-lang/php-5*')"
422 if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then 185 if built_with_use =${pkg} cgi ; then
423 PHP_VERSION="5" 186 PHP_VERSION="5"
424 fi 187 fi
425 fi 188 fi
426 189
427 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 190 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
428 die "Unable to find an installed dev-lang/php package" 191 die "Unable to find an installed dev-lang/php package"
429 fi 192 fi
430 193
431 if [[ -z ${PHP_VERSION} ]] ; then 194 if [[ -z ${PHP_VERSION} ]] ; then
432 die "No PHP CGI installed" 195 die "No PHP CGI installed. Re-emerge dev-lang/php with USE=cgi."
433 fi 196 fi
434 197
435 # If we get here, then PHP_VERSION tells us which version of PHP we 198 # If we get here, then PHP_VERSION tells us which version of PHP we
436 # want to use 199 # want to use
437 uses_php${PHP_VERSION} 200 uses_php${PHP_VERSION}
438} 201}
439 202
440# Require a PHP built with SQLite support
441
442require_sqlite() {
443 has_php
444
445 # Has our PHP been built with SQLite support?
446 if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then
447 return
448 fi
449
450 # Do we have pecl-sqlite installed for PHP4?
451 if [[ "${PHP_VERSION}" == "4" ]] ; then
452 if has_version 'dev-php4/pecl-sqlite' ; then
453 return
454 fi
455 fi
456
457 # If we get here, then we don't have any SQLite support for PHP installed
458 eerror
459 eerror "No SQLite extension for PHP found."
460 eerror "Please install an SQLite extension for PHP,"
461 eerror "this is done best by simply adding the"
462 eerror "'sqlite' USE flag when emerging dev-lang/php."
463 eerror
464 die "No SQLite extension for PHP found"
465}
466
467# Require a PHP built with GD support
468
469require_gd() {
470 has_php
471
472 # Do we have the internal GD support installed?
473 if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then
474 return
475 fi
476
477 # Ok, maybe GD was built using the external library support?
478 if built_with_use =${PHP_PKG} gd-external || phpconfutils_built_with_use =${PHP_PKG} gd-external ; then
479 return
480 fi
481
482 # If we get here, then we have no GD support
483 eerror
484 eerror "No GD support for PHP found."
485 eerror "Please install the GD support for PHP,"
486 eerror "you must install dev-lang/php with either"
487 eerror "the 'gd' or the 'gd-external' USE flags"
488 eerror "turned on."
489 eerror
490 die "No GD support found for PHP"
491}
492
493# ======================================================================== 203# ========================================================================
494# Misc functions 204# Misc functions
495# 205#
496# These functions provide miscellaneous checks and functionality. 206# These functions provide miscellaneous checks and functionality.
497# ======================================================================== 207# ========================================================================
498 208
499# Executes some checks needed when installing a binary PHP extension 209# @FUNCTION: dodoc-php
500 210# @USAGE: <list of docs>
501php_binary_extension() { 211# @DESCRIPTION:
502 has_php
503
504 local PUSE_ENABLED=""
505
506 # Binary extensions do not support the change of PHP
507 # API version, so they can't be installed when USE flags
508 # are enabled wich change the PHP API version
509
510 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
511 eerror
512 eerror "You cannot install binary PHP extensions"
513 eerror "when the 'hardenedphp' USE flag is enabled!"
514 eerror "Please reemerge dev-lang/php with the"
515 eerror "'hardenedphp' USE flag turned off."
516 eerror
517 PUSE_ENABLED="1"
518 fi
519
520 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
521 eerror
522 eerror "You cannot install binary PHP extensions"
523 eerror "when the 'debug' USE flag is enabled!"
524 eerror "Please reemerge dev-lang/php with the"
525 eerror "'debug' USE flag turned off."
526 eerror
527 PUSE_ENABLED="1"
528 fi
529
530 if [[ -n ${PUSE_ENABLED} ]] ; then
531 die "'hardenedphp' and/or 'debug' USE flags turned on"
532 fi
533}
534
535# Alternative to dodoc function for use in our PHP eclasses and 212# Alternative to dodoc function for use in our PHP eclasses and ebuilds.
536# ebuilds.
537# Stored here because depend.php gets always sourced everywhere 213# Stored here because depend.php gets always sourced everywhere in the PHP
538# in the PHP ebuilds and eclasses.
539# It simply is dodoc with a changed path to the docs. 214# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
540# NOTE: no support for docinto is given! 215# NOTE: No support for docinto is provided!
541
542dodoc-php() { 216dodoc-php() {
543if [[ $# -lt 1 ]] ; then 217if [[ $# -lt 1 ]] ; then
544 echo "$0: at least one argument needed" 1>&2 218 echo "$0: at least one argument needed" 1>&2
545 exit 1 219 exit 1
546fi 220fi
547 221
548phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/" 222phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
549
550if [[ ! -d "${phpdocdir}" ]] ; then
551 install -d "${phpdocdir}"
552fi
553 223
554for x in $@ ; do 224for x in $@ ; do
555 if [[ -s "${x}" ]] ; then 225 if [[ -s "${x}" ]] ; then
556 install -m0644 "${x}" "${phpdocdir}" 226 insinto "${phpdocdir}"
227 doins "${x}"
557 gzip -f -9 "${phpdocdir}/${x##*/}" 228 gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
558 elif [[ ! -e "${x}" ]] ; then 229 elif [[ ! -e "${x}" ]] ; then
559 echo "dodoc-php: ${x} does not exist" 1>&2 230 echo "dodoc-php: ${x} does not exist" 1>&2
560 fi 231 fi
561done 232done
562} 233}
234
235# @FUNCTION: dohtml-php
236# @USAGE: <list of html docs>
237# @DESCRIPTION:
238# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
239# Stored here because depend.php gets always sourced everywhere in the PHP
240# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
241# NOTE: No support for [-a|-A|-p|-x] options is provided!
242dohtml-php() {
243if [[ $# -lt 1 ]] ; then
244 echo "$0: at least one argument needed" 1>&2
245 exit 1
246fi
247
248phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
249
250for x in $@ ; do
251 if [[ -s "${x}" ]] ; then
252 insinto "${phphtmldir}"
253 doins "${x}"
254 elif [[ ! -e "${x}" ]] ; then
255 echo "dohtml-php: ${x} does not exist" 1>&2
256 fi
257done
258}

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.20