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

Diff of /eclass/confutils.eclass

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

Revision 1.19 Revision 1.20
1# Copyright 1999-2005 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/confutils.eclass,v 1.19 2006/10/14 20:27:21 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.20 2007/11/22 21:51:16 drac 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
9# 9#
10# Author(s) Stuart Herbert 10# Author(s) Stuart Herbert
11# <stuart@gentoo.org> 11# <stuart@gentoo.org>
12# 12#
13# ======================================================================== 13# ========================================================================
14
15inherit eutils
14 16
15if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then 17if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then
16 IUSE="sharedext" 18 IUSE="sharedext"
17fi 19fi
18 20
28# 30#
29# Call this function from your src_compile() function to initialise 31# Call this function from your src_compile() function to initialise
30# this eclass first 32# this eclass first
31 33
32confutils_init () { 34confutils_init () {
33 if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && useq sharedext ; then 35 if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext ; then
34 shared="=shared" 36 shared="=shared"
35 else 37 else
36 shared= 38 shared=
37 fi 39 fi
38} 40}
56 58
57 required_flags="$@" 59 required_flags="$@"
58 success=0 60 success=0
59 61
60 while [[ -n $1 ]]; do 62 while [[ -n $1 ]]; do
61 if useq $1 ; then 63 if use $1 ; then
62 einfo "$success_msg $1" 64 einfo "$success_msg $1"
63 success=1 65 success=1
64 else 66 else
65 ewarn "$fail_msg $1" 67 ewarn "$fail_msg $1"
66 fi 68 fi
92# 94#
93# $1 - flag that depends on other flags 95# $1 - flag that depends on other flags
94# $2 .. - flags that conflict 96# $2 .. - flags that conflict
95 97
96confutils_use_conflict () { 98confutils_use_conflict () {
97 if ! useq $1 ; then 99 if ! use $1 ; then
98 return 100 return
99 fi 101 fi
100 102
101 local my_flag="$1" 103 local my_flag="$1"
102 shift 104 shift
103 105
104 local my_present= 106 local my_present=
105 local my_remove= 107 local my_remove=
106 108
107 while [ "$1+" != "+" ]; do 109 while [ "$1+" != "+" ]; do
108 if useq $1 ; then 110 if use $1 ; then
109 my_present="${my_present} $1" 111 my_present="${my_present} $1"
110 my_remove="${my_remove} -$1" 112 my_remove="${my_remove} -$1"
111 fi 113 fi
112 shift 114 shift
113 done 115 done
133# 135#
134# $1 - flag that depends on other flags 136# $1 - flag that depends on other flags
135# $2 .. - the flags that must be set for $1 to be valid 137# $2 .. - the flags that must be set for $1 to be valid
136 138
137confutils_use_depend_all () { 139confutils_use_depend_all () {
138 if ! useq $1 ; then 140 if ! use $1 ; then
139 return 141 return
140 fi 142 fi
141 143
142 local my_flag="$1" 144 local my_flag="$1"
143 shift 145 shift
144 146
145 local my_missing= 147 local my_missing=
146 148
147 while [ "$1+" != "+" ]; do 149 while [ "$1+" != "+" ]; do
148 if ! useq $1 ; then 150 if ! use $1 ; then
149 my_missing="${my_missing} $1" 151 my_missing="${my_missing} $1"
150 fi 152 fi
151 shift 153 shift
152 done 154 done
153 155
175# 177#
176# $1 - flag that depends on other flags 178# $1 - flag that depends on other flags
177# $2 .. - flags that must be set for $1 to be valid 179# $2 .. - flags that must be set for $1 to be valid
178 180
179confutils_use_depend_any () { 181confutils_use_depend_any () {
180 if ! useq $1 ; then 182 if ! use $1 ; then
181 return 183 return
182 fi 184 fi
183 185
184 local my_flag="$1" 186 local my_flag="$1"
185 shift 187 shift
186 188
187 local my_found= 189 local my_found=
188 local my_missing= 190 local my_missing=
189 191
190 while [ "$1+" != "+" ]; do 192 while [ "$1+" != "+" ]; do
191 if useq $1 ; then 193 if use $1 ; then
192 my_found="${my_found} $1" 194 my_found="${my_found} $1"
193 else 195 else
194 my_missing="${my_missing} $1" 196 my_missing="${my_missing} $1"
195 fi 197 fi
196 shift 198 shift
217# $1 - extension name 219# $1 - extension name
218# $2 - USE flag 220# $2 - USE flag
219# $3 - optional message to einfo() to the user 221# $3 - optional message to einfo() to the user
220 222
221enable_extension_disable () { 223enable_extension_disable () {
222 if ! useq "$2" ; then 224 if ! use "$2" ; then
223 my_conf="${my_conf} --disable-$1" 225 my_conf="${my_conf} --disable-$1"
224 [ -n "$3" ] && einfo " Disabling $1" 226 [ -n "$3" ] && einfo " Disabling $1"
225 else 227 else
226 [ -n "$3" ] && einfo " Enabling $1" 228 [ -n "$3" ] && einfo " Enabling $1"
227 fi 229 fi
256 if [ "$4+" != "+" ]; then 258 if [ "$4+" != "+" ]; then
257 my_shared="=$4" 259 my_shared="=$4"
258 fi 260 fi
259 fi 261 fi
260 262
261 if useq $2 ; then 263 if use $2 ; then
262 my_conf="${my_conf} --enable-$1$my_shared" 264 my_conf="${my_conf} --enable-$1$my_shared"
263 einfo " Enabling $1" 265 einfo " Enabling $1"
264 else 266 else
265 my_conf="${my_conf} --disable-$1" 267 my_conf="${my_conf} --disable-$1"
266 einfo " Disabling $1" 268 einfo " Disabling $1"
296 if [ "$4+" != "+" ]; then 298 if [ "$4+" != "+" ]; then
297 my_shared="=$4" 299 my_shared="=$4"
298 fi 300 fi
299 fi 301 fi
300 302
301 if useq $2 ; then 303 if use $2 ; then
302 my_conf="${my_conf} --enable-$1$my_shared" 304 my_conf="${my_conf} --enable-$1$my_shared"
303 einfo " Enabling $1" 305 einfo " Enabling $1"
304 else 306 else
305 # note: we deliberately do *not* use a --disable switch here 307 # note: we deliberately do *not* use a --disable switch here
306 einfo " Disabling $1" 308 einfo " Disabling $1"
316# $1 - extension name 318# $1 - extension name
317# $2 - USE flag 319# $2 - USE flag
318# $3 - optional message to einfo() to the user 320# $3 - optional message to einfo() to the user
319 321
320enable_extension_without () { 322enable_extension_without () {
321 if ! useq "$2" ; then 323 if ! use "$2" ; then
322 my_conf="${my_conf} --without-$1" 324 my_conf="${my_conf} --without-$1"
323 einfo " Disabling $1" 325 einfo " Disabling $1"
324 else 326 else
325 einfo " Enabling $1" 327 einfo " Enabling $1"
326 fi 328 fi
354 if [ "$4+" != "+" ]; then 356 if [ "$4+" != "+" ]; then
355 my_shared="=$4" 357 my_shared="=$4"
356 fi 358 fi
357 fi 359 fi
358 360
359 if useq $2 ; then 361 if use $2 ; then
360 my_conf="${my_conf} --with-$1$my_shared" 362 my_conf="${my_conf} --with-$1$my_shared"
361 einfo " Enabling $1" 363 einfo " Enabling $1"
362 else 364 else
363 my_conf="${my_conf} --without-$1" 365 my_conf="${my_conf} --without-$1"
364 einfo " Disabling $1" 366 einfo " Disabling $1"
393 if [ "$4+" != "+" ]; then 395 if [ "$4+" != "+" ]; then
394 my_shared="=$4" 396 my_shared="=$4"
395 fi 397 fi
396 fi 398 fi
397 399
398 if useq $2 ; then 400 if use $2 ; then
399 my_conf="${my_conf} --with-$1$my_shared" 401 my_conf="${my_conf} --with-$1$my_shared"
400 einfo " Enabling $1" 402 einfo " Enabling $1"
401 else 403 else
402 # note - we deliberately do *not* use --without here 404 # note - we deliberately do *not* use --without here
403 einfo " Disabling $1" 405 einfo " Disabling $1"
411{ 413{
412 local x 414 local x
413 local my_found=0 415 local my_found=0
414 416
415 for x in $CONFUTILS_MISSING_DEPS ; do 417 for x in $CONFUTILS_MISSING_DEPS ; do
416 if useq $x ; then 418 if use $x ; then
417 ewarn "USE flag $x enables support for software not in Portage" 419 ewarn "USE flag $x enables support for software not in Portage"
418 my_found=1 420 my_found=1
419 fi 421 fi
420 done 422 done
421 423

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

  ViewVC Help
Powered by ViewVC 1.1.20