/[gentoo-x86]/eclass/confutils.eclass
Gentoo

Diff of /eclass/confutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.17 Revision 1.18
1# Copyright 1999-2004 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/confutils.eclass,v 1.17 2005/07/11 15:08:06 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.18 2005/09/04 10:54:53 stuart Exp $
4# 4#
5# eclass/confutils.eclass 5# eclass/confutils.eclass
6# Utility functions to help with configuring a package 6# Utility functions to help with configuring a package
7# 7#
8# Based on Stuart's work for the PHP 5 eclass 8# Based on Stuart's work for the PHP 5 eclass
10# Author(s) Stuart Herbert 10# Author(s) Stuart Herbert
11# <stuart@gentoo.org> 11# <stuart@gentoo.org>
12# 12#
13# ======================================================================== 13# ========================================================================
14 14
15if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then
15IUSE="sharedext" 16 IUSE="sharedext"
17fi
16 18
17# ======================================================================== 19# ========================================================================
18 20
19# list of USE flags that need deps that aren't yet in Portage 21# list of USE flags that need deps that aren't yet in Portage
20# this list was originally added for PHP 22# this list was originally added for PHP
26# 28#
27# Call this function from your src_compile() function to initialise 29# Call this function from your src_compile() function to initialise
28# this eclass first 30# this eclass first
29 31
30confutils_init () { 32confutils_init () {
31 if useq sharedext ; then 33 if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && useq sharedext ; then
32 shared="=shared" 34 shared="=shared"
33 else 35 else
34 shared= 36 shared=
35 fi 37 fi
38}
39
40# ========================================================================
41# confutils_require_any ()
42#
43# Use this function to ensure one or more of the specified USE flags have
44# been enabled
45#
46# $1 - message to output everytime a flag is found
47# $2 - message to output everytime a flag is not found
48# $3 .. - flags to check
49#
50
51confutils_require_any() {
52 success_msg="$1"
53 shift
54 fail_msg="$1"
55 shift
56
57 required_flags="$@"
58 success=0
59
60 while [[ -n $1 ]]; do
61 if useq $1 ; then
62 einfo "$success_msg $1"
63 success=1
64 else
65 ewarn "$fail_msg $1"
66 fi
67 shift
68 done
69
70 # did we find what we are looking for?
71 if [[ $success == 1 ]]; then
72 return
73 fi
74
75 # if we get here, then none of the required USE flags are switched on
76
77 echo
78 eerror "You *must* enable one or more of the following USE flags:"
79 eerror " $required_flags"
80 eerror
81 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
82 eerror " =$CATEGORY/$PN-$PVR $required_flags"
83 eerror
84 die "Missing USE flags"
36} 85}
37 86
38# ======================================================================== 87# ========================================================================
39# confutils_use_conflict () 88# confutils_use_conflict ()
40# 89#
377 ewarn "fail to compile." 426 ewarn "fail to compile."
378 ewarn 427 ewarn
379 sleep 5 428 sleep 5
380 fi 429 fi
381} 430}
431
432# ========================================================================
433# enable_extension_enable_built_with ()
434#
435# This function is like use_enable(), except that it knows about
436# enabling modules as shared libraries, and it supports passing
437# additional data with the switch
438#
439# $1 - pkg name
440# $2 - USE flag
441# $3 - extension name
442# $4 - additional setting for configure
443# $5 - alternative message
444
445enable_extension_enable_built_with () {
446 local msg=$3
447 [[ -n $5 ]] && msg="$5"
448
449 local param
450 [[ -n $4 ]] && msg="=$4"
451
452 if built_with_use $1 $2 ; then
453 my_conf="${my_conf} --enable-$3${param}"
454 einfo " Enabling $msg"
455 else
456 my_conf="${my_conf} --disable-$3"
457 einfo " Disabling $msg"
458 fi
459}
460
461# ========================================================================
462# enable_extension_with_built_with ()
463#
464# This function is like use_enable(), except that it knows about
465# enabling modules as shared libraries, and it supports passing
466# additional data with the switch
467#
468# $1 - pkg name
469# $2 - USE flag
470# $3 - extension name
471# $4 - additional setting for configure
472# $5 - alternative message
473
474enable_extension_with_built_with () {
475 local msg=$3
476 [[ -n $5 ]] && msg="$5"
477
478 local param
479 [[ -n $4 ]] && param="=$4"
480
481 if built_with_use $1 $2 ; then
482 my_conf="${my_conf} --with-$3${param}"
483 einfo " Enabling $msg"
484 else
485 my_conf="${my_conf} --disable-$3"
486 einfo " Disabling $msg"
487 fi
488}

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20