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

Contents of /eclass/depend.php.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.30 - (hide annotations) (download)
Mon Aug 22 04:46:31 2011 UTC (3 years, 4 months ago) by vapier
Branch: MAIN
Changes since 1.29: +6 -7 lines
fix random bugs in eclass documentation, and convert to new @AUTHOR tag

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

  ViewVC Help
Powered by ViewVC 1.1.20