/[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.10 Revision 1.11
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.10 2006/01/21 09:15:08 sebastian Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.11 2006/01/21 11:48:29 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
184 184
185require_php_with_use() 185require_php_with_use()
186{ 186{
187 has_php 187 has_php
188 188
189 local missing_use= 189 local missing_use=""
190 local x 190 local x
191 191
192 einfo "Checking for required PHP feature(s):" 192 einfo "Checking for required PHP feature(s):"
193 193
194 for x in $@ ; do 194 for x in $@ ; do
196 einfo " Discovered missing USE flag ${x}" 196 einfo " Discovered missing USE flag ${x}"
197 missing_use="${missing_use} ${x}" 197 missing_use="${missing_use} ${x}"
198 fi 198 fi
199 done 199 done
200 200
201 if [[ -z ${missing_use} ]]; then 201 if [[ -z ${missing_use} ]] ; then
202 return 202 return
203 fi 203 fi
204 204
205 eerror 205 eerror
206 eerror "${PHP_PKG} needs to be re-installed with all of the following" 206 eerror "${PHP_PKG} needs to be re-installed with all of the following"
217has_php() 217has_php()
218{ 218{
219 # if PHP_PKG is set, then we have remembered our PHP settings 219 # if PHP_PKG is set, then we have remembered our PHP settings
220 # from last time 220 # from last time
221 221
222 if [[ -n ${PHP_PKG} ]]; then 222 if [[ -n ${PHP_PKG} ]] ; then
223 return 223 return
224 fi 224 fi
225 225
226 if [[ -z ${PHP_VERSION} ]]; then 226 if [[ -z ${PHP_VERSION} ]] ; then
227 # detect which PHP version installed 227 # detect which PHP version installed
228 if has_version '=dev-lang/php-5*' ; then
229 PHP_VERSION=5
228 if has_version '=dev-lang/php-4*' ; then 230 elif has_version '=dev-lang/php-4*' ; then
229 PHP_VERSION=4 231 PHP_VERSION=4
230 elif has_version '=dev-lang/php-5*' ; then
231 PHP_VERSION=5
232 else 232 else
233 die "Unable to find an installed dev-lang/php package" 233 die "Unable to find an installed dev-lang/php package"
234 fi 234 fi
235 fi 235 fi
236 236
282 282
283require_pdo() 283require_pdo()
284{ 284{
285 has_php 285 has_php
286 286
287 # do we have php5.1 installed? 287 # do we have php5 installed?
288 288
289 if [[ ${PHP_VERSION} == 4 ]] ; then 289 if [[ ${PHP_VERSION} == 4 ]] ; then
290 eerror 290 eerror
291 eerror "This package requires PDO." 291 eerror "This package requires PDO."
292 eerror "PDO is only available for PHP 5." 292 eerror "PDO is only available for PHP 5."
293 eerror "Please install dev-lang/php-5*" 293 eerror "You must install =dev-lang/php-5.0* with"
294 eerror "the 'pdo-external' USE flag or you must"
295 eerror "install >=dev-lang/php-5.1 with either"
296 eerror "the 'pdo' or the 'pdo-external' USE flags"
297 eerror "turned on."
294 eerror 298 eerror
295 die "PHP 5 not installed" 299 die "PHP 5 not installed"
296 fi 300 fi
297 301
298 # was php5 compiled w/ pdo support? 302 # was php5 compiled w/ pdo support?
317 321
318 eerror 322 eerror
319 eerror "No PDO extension for PHP found." 323 eerror "No PDO extension for PHP found."
320 eerror "Please note that PDO only exists for PHP 5." 324 eerror "Please note that PDO only exists for PHP 5."
321 eerror "Please install a PDO extension for PHP 5," 325 eerror "Please install a PDO extension for PHP 5,"
322 eerror "you must install dev-lang/php-5.0* with" 326 eerror "you must install =dev-lang/php-5.0* with"
323 eerror "the 'pdo-external' USE flag or you must" 327 eerror "the 'pdo-external' USE flag or you must"
324 eerror "install dev-lang/php-5.1* with either" 328 eerror "install >=dev-lang/php-5.1 with either"
325 eerror "the 'pdo' or the 'pdo-external' USE flags" 329 eerror "the 'pdo' or the 'pdo-external' USE flags"
326 eerror "turned on." 330 eerror "turned on."
327 eerror 331 eerror
328 die "No PDO extension found for PHP 5" 332 die "No PDO extension found for PHP 5"
329} 333}
335require_php_cli() 339require_php_cli()
336{ 340{
337 # if PHP_PKG is set, then we have remembered our PHP settings 341 # if PHP_PKG is set, then we have remembered our PHP settings
338 # from last time 342 # from last time
339 343
340 if [[ -n ${PHP_PKG} ]]; then 344 if [[ -n ${PHP_PKG} ]] ; then
341 return 345 return
342 fi 346 fi
343 347
344 # detect which PHP version installed 348 # detect which PHP version installed
345 if has_version '=dev-lang/php-4*' ; then 349 if has_version '=dev-lang/php-4*' ; then
356 if built_with_use =${pkg} cli ; then 360 if built_with_use =${pkg} cli ; then
357 PHP_VERSION=5 361 PHP_VERSION=5
358 fi 362 fi
359 fi 363 fi
360 364
361 if [[ -z ${PHP_PACKAGE_FOUND} ]]; then 365 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
362 die "Unable to find an installed dev-lang/php package" 366 die "Unable to find an installed dev-lang/php package"
363 fi 367 fi
364 368
365 if [[ -z ${PHP_VERSION} ]]; then 369 if [[ -z ${PHP_VERSION} ]] ; then
366 die "No PHP CLI installed" 370 die "No PHP CLI installed"
367 fi 371 fi
368 372
369 # if we get here, then PHP_VERSION tells us which version of PHP we 373 # if we get here, then PHP_VERSION tells us which version of PHP we
370 # want to use 374 # want to use
379require_php_cgi() 383require_php_cgi()
380{ 384{
381 # if PHP_PKG is set, then we have remembered our PHP settings 385 # if PHP_PKG is set, then we have remembered our PHP settings
382 # from last time 386 # from last time
383 387
384 if [[ -n ${PHP_PKG} ]]; then 388 if [[ -n ${PHP_PKG} ]] ; then
385 return 389 return
386 fi 390 fi
387 391
388 # detect which PHP version installed 392 # detect which PHP version installed
389 if has_version '=dev-lang/php-4*' ; then 393 if has_version '=dev-lang/php-4*' ; then
399 pkg="`best_version '=dev-lang/php-5*'`" 403 pkg="`best_version '=dev-lang/php-5*'`"
400 if built_with_use =${pkg} cgi ; then 404 if built_with_use =${pkg} cgi ; then
401 PHP_VERSION=5 405 PHP_VERSION=5
402 fi 406 fi
403 fi 407 fi
404 408
405 if [[ -z ${PHP_PACKAGE_FOUND} ]]; then 409 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
406 die "Unable to find an installed dev-lang/php package" 410 die "Unable to find an installed dev-lang/php package"
407 fi 411 fi
408 412
409 if [[ -z ${PHP_VERSION} ]]; then 413 if [[ -z ${PHP_VERSION} ]] ; then
410 die "No PHP CGI installed" 414 die "No PHP CGI installed"
411 fi 415 fi
412 416
413 # if we get here, then PHP_VERSION tells us which version of PHP we 417 # if we get here, then PHP_VERSION tells us which version of PHP we
414 # want to use 418 # want to use

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20