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

Diff of /eclass/confutils.eclass

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

Revision 1.20 Revision 1.21
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2008 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.20 2007/11/22 21:51:16 drac Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.21 2008/02/20 13:07:50 hollow Exp $
4
5# @ECLASS: confutils.eclass
6# @MAINTAINER:
7# Benedikt Böhm <hollow@gentoo.org>
8# @BLURB: utility functions to help with configuring a package
9# @DESCRIPTION:
10# The confutils eclass contains functions to handle use flag dependencies and
11# extended --with-*/--enable-* magic.
4# 12#
5# eclass/confutils.eclass 13# Based on the PHP5 eclass by Stuart Herbert <stuart@stuartherbert.com>
6# Utility functions to help with configuring a package
7#
8# Based on Stuart's work for the PHP 5 eclass
9#
10# Author(s) Stuart Herbert
11# <stuart@gentoo.org>
12#
13# ========================================================================
14 14
15inherit eutils 15inherit eutils
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass"
18
19# @VARIABLE: EBUILD_SUPPORTS_SHAREDEXT
20# @DESCRIPTION:
21# Set this variable to 1 if your ebuild supports shared extensions. You need to
22# call confutils_init() in pkg_setup() if you use this variable.
17if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then 23if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then
18 IUSE="sharedext" 24 IUSE="sharedext"
19fi 25fi
20 26
21# ======================================================================== 27# @FUNCTION: confutils_init
22 28# @USAGE: [value]
23# list of USE flags that need deps that aren't yet in Portage 29# @DESCRIPTION:
24# this list was originally added for PHP
25#
26# your eclass must define CONFUTILS_MISSING_DEPS if you need this
27
28# ========================================================================
29# confutils_init ()
30#
31# Call this function from your src_compile() function to initialise 30# Call this function from your pkg_setup() function to initialize this eclass
32# this eclass first 31# if EBUILD_SUPPORTS_SHAREDEXT is enabled. If no value is given `shared' is used
33 32# by default.
34confutils_init () { 33confutils_init() {
35 if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext ; then 34 if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext; then
36 shared="=shared" 35 shared="=${1:-shared}"
37 else 36 else
38 shared= 37 shared=
39 fi 38 fi
40} 39}
41 40
42# ========================================================================
43# confutils_require_any () 41# @FUNCTION: confutils_require_any
44# 42# @USAGE: <flag> [more flags ...]
43# @DESCRIPTION:
45# Use this function to ensure one or more of the specified USE flags have 44# Use this function to ensure one or more of the specified USE flags have been
46# been enabled 45# enabled
47#
48# $1 - message to output everytime a flag is found
49# $2 - message to output everytime a flag is not found
50# $3 .. - flags to check
51#
52
53confutils_require_any() { 46confutils_require_any() {
54 success_msg="$1"
55 shift
56 fail_msg="$1"
57 shift
58
59 required_flags="$@" 47 local required_flags="$@"
60 success=0 48 local success=0
61 49
62 while [[ -n $1 ]]; do 50 for flag in ${required_flags}; do
63 if use $1 ; then 51 use ${flag} && success=1
64 einfo "$success_msg $1"
65 success=1
66 else
67 ewarn "$fail_msg $1"
68 fi
69 shift
70 done 52 done
71 53
72 # did we find what we are looking for? 54 [[ ${success} -eq 1 ]] && return
73 if [[ $success == 1 ]]; then
74 return
75 fi
76
77 # if we get here, then none of the required USE flags are switched on
78 55
79 echo 56 echo
80 eerror "You *must* enable one or more of the following USE flags:" 57 eerror "You *must* enable one or more of the following USE flags:"
81 eerror " $required_flags" 58 eerror " ${required_flags}"
82 eerror 59 eerror
83 eerror "You can do this by enabling these flags in /etc/portage/package.use:" 60 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
84 eerror " =$CATEGORY/$PN-$PVR $required_flags" 61 eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}"
85 eerror 62 echo
86 die "Missing USE flags" 63 die "Missing USE flags"
87} 64}
88 65
89# ======================================================================== 66# @FUNCTION: confutils_require_built_with_all
67# @USAGE: <foreign> <flag> [more flags ...]
68# @DESCRIPTION:
69# Use this function to ensure all of the specified USE flags have been enabled
70# in the specified foreign package
71confutils_require_built_with_all() {
72 local foreign=$1 && shift
73 local required_flags="$@"
74
75 built_with_use ${foreign} ${required_flags} && return
76
77 echo
78 eerror "You *must* enable all of the following USE flags in ${foreign}:"
79 eerror " ${required_flags}"
80 eerror
81 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
82 eerror " ${foreign} ${required_flags}"
83 echo
84 die "Missing USE flags in ${foreign}"
85}
86
87# @FUNCTION: confutils_require_built_with_any
88# @USAGE: <foreign> <flag> [more flags ...]
89# @DESCRIPTION:
90# Use this function to ensure one or more of the specified USE flags have been
91# enabled in the specified foreign package
92confutils_require_built_with_any() {
93 local foreign=$1 && shift
94 local required_flags="$@"
95 local success=0
96
97 for flag in ${required_flags}; do
98 built_with_use ${foreign} ${flag} && success=1
99 done
100
101 [[ ${success} -eq 1 ]] && return
102
103 echo
104 eerror "You *must* enable one or more of the following USE flags in ${foreign}:"
105 eerror " ${required_flags}"
106 eerror
107 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
108 eerror " ${foreign} ${required_flags}"
109 echo
110 die "Missing USE flags in ${foreign}"
111}
112
90# confutils_use_conflict () 113# @FUNCTION: confutils_use_conflict
91# 114# @USAGE: <enabled flag> <conflicting flag> [more conflicting flags ...]
115# @DESCRIPTION:
92# Use this function to automatically complain to the user if conflicting 116# Use this function to automatically complain to the user if conflicting USE
93# USE flags have been enabled 117# flags have been enabled
94#
95# $1 - flag that depends on other flags
96# $2 .. - flags that conflict
97
98confutils_use_conflict () { 118confutils_use_conflict() {
99 if ! use $1 ; then 119 use $1 || return
100 return
101 fi
102 120
103 local my_flag="$1" 121 local my_flag="$1" && shift
104 shift
105
106 local my_present= 122 local my_present=
107 local my_remove= 123 local my_remove=
108 124
109 while [ "$1+" != "+" ]; do 125 for flag in "$@"; do
110 if use $1 ; then 126 if use ${flag}; then
111 my_present="${my_present} $1" 127 my_present="${my_present} ${flag}"
112 my_remove="${my_remove} -$1" 128 my_remove="${my_remove} -${flag}"
113 fi 129 fi
114 shift
115 done 130 done
116 131
117 if [ -n "$my_present" ]; then 132 [[ -z "${my_present}" ]] && return
133
118 echo 134 echo
119 eerror "USE flag '$my_flag' conflicts with these USE flag(s):" 135 eerror "USE flag '${my_flag}' conflicts with these USE flag(s):"
120 eerror " $my_present" 136 eerror " ${my_present}"
121 eerror 137 eerror
122 eerror "You must disable these conflicting flags before you can emerge this package." 138 eerror "You must disable these conflicting flags before you can emerge this package."
123 eerror "You can do this by disabling these flags in /etc/portage/package.use:" 139 eerror "You can do this by disabling these flags in /etc/portage/package.use:"
124 eerror " =$CATEGORY/$PN-$PVR $my_remove" 140 eerror " =${CATEGORY}/${PN}-${PVR} ${my_remove}"
125 eerror 141 eerror
142 eerror "You could disable this flag instead in /etc/portage/package.use:"
143 eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
144 echo
126 die "Conflicting USE flags" 145 die "Conflicting USE flags"
127 fi
128} 146}
129 147
130# ========================================================================
131# confutils_use_depend_all () 148# @FUNCTION: confutils_use_depend_all
132# 149# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
150# @DESCRIPTION:
133# Use this function to automatically complain to the user if a USE flag 151# Use this function to automatically complain to the user if a USE flag depends
134# depends on another USE flag that hasn't been enabled 152# on another USE flag that hasn't been enabled
135#
136# $1 - flag that depends on other flags
137# $2 .. - the flags that must be set for $1 to be valid
138
139confutils_use_depend_all () { 153confutils_use_depend_all() {
140 if ! use $1 ; then 154 use $1 || return
141 return
142 fi
143 155
144 local my_flag="$1" 156 local my_flag="$1" && shift
145 shift
146
147 local my_missing= 157 local my_missing=
148 158
149 while [ "$1+" != "+" ]; do 159 for flag in "$@"; do
150 if ! use $1 ; then 160 use ${flag} || my_missing="${my_missing} ${flag}"
151 my_missing="${my_missing} $1"
152 fi
153 shift
154 done 161 done
155 162
156 if [ -n "$my_missing" ]; then 163 [[ -z "${my_missing}" ]] && return
164
157 echo 165 echo
158 eerror "USE flag '$my_flag' needs these additional flag(s) set:" 166 eerror "USE flag '${my_flag}' needs these additional flag(s) set:"
159 eerror " $my_missing" 167 eerror " ${my_missing}"
160 eerror 168 eerror
161 eerror "You can do this by enabling these flags in /etc/portage/package.use:" 169 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
162 eerror " =$CATEGORY/$PN-$PVR $my_missing" 170 eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
163 eerror 171 eerror
164 eerror "You could disable this flag instead in /etc/portage/package.use:" 172 eerror "You could disable this flag instead in /etc/portage/package.use:"
165 eerror " =$CATEGORY/$PN-$PVR -$my_flag" 173 eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
166 echo 174 echo
167
168 die "Need missing USE flags" 175 die "Need missing USE flags"
169 fi
170} 176}
171 177
172# ========================================================================
173# confutils_use_depend_any () 178# @FUNCTION: confutils_use_depend_any
174# 179# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
180# @DESCRIPTION:
175# Use this function to automatically complain to the user if a USE flag 181# Use this function to automatically complain to the user if a USE flag depends
176# depends on another USE flag that hasn't been enabled 182# on another USE flag that hasn't been enabled
177#
178# $1 - flag that depends on other flags
179# $2 .. - flags that must be set for $1 to be valid
180
181confutils_use_depend_any () { 183confutils_use_depend_any() {
182 if ! use $1 ; then 184 use $1 || return
183 return
184 fi
185 185
186 local my_flag="$1" 186 local my_flag="$1" && shift
187 shift
188
189 local my_found= 187 local my_found=
190 local my_missing= 188 local my_missing=
191 189
192 while [ "$1+" != "+" ]; do 190 for flag in "$@"; do
193 if use $1 ; then 191 if use ${flag}; then
194 my_found="${my_found} $1" 192 my_found="${my_found} ${flag}"
195 else 193 else
196 my_missing="${my_missing} $1" 194 my_missing="${my_missing} ${flag}"
197 fi 195 fi
198 shift
199 done 196 done
200 197
201 if [ -z "$my_found" ]; then 198 [[ -n "${my_found}" ]] && return
199
202 echo 200 echo
203 eerror "USE flag '$my_flag' needs one of these additional flag(s) set:" 201 eerror "USE flag '${my_flag}' needs one or more of these additional flag(s) set:"
204 eerror " $my_missing" 202 eerror " ${my_missing}"
205 eerror 203 eerror
206 eerror "You can do this by enabling one of these flags in /etc/portage/package.use" 204 eerror "You can do this by enabling one of these flags in /etc/portage/package.use:"
205 eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
207 eerror 206 eerror
207 eerror "You could disable this flag instead in /etc/portage/package.use:"
208 eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
209 echo
208 die "Need missing USE flag" 210 die "Need missing USE flag(s)"
211}
212
213# @FUNCTION: confutils_use_depend_built_with_all
214# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
215# @DESCRIPTION:
216# Use this function to automatically complain to the user if a USE flag depends
217# on a USE flag in another package that hasn't been enabled
218confutils_use_depend_built_with_all() {
219 use $1 || return
220
221 local my_flag="$1" && shift
222 local foreign=$1 && shift
223 local required_flags="$@"
224
225 built_with_use ${foreign} ${required_flags} && return
226
227 echo
228 eerror "USE flag '${my_flag}' needs the following USE flags in ${foreign}:"
229 eerror " ${required_flags}"
230 eerror
231 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
232 eerror " ${foreign} ${required_flags}"
233 eerror
234 eerror "You could disable this flag instead in /etc/portage/package.use:"
235 eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
236 echo
237 die "Missing USE flags in ${foreign}"
238}
239
240# @FUNCTION: confutils_use_depend_built_with_any
241# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
242# @DESCRIPTION:
243# Use this function to automatically complain to the user if a USE flag depends
244# on a USE flag in another package that hasn't been enabled
245confutils_use_depend_built_with_any() {
246 use $1 || return
247
248 local my_flag="$1" && shift
249 local foreign=$1 && shift
250 local required_flags="$@"
251 local success=0
252
253 for flag in ${required_flags}; do
254 built_with_use ${foreign} ${flag} && success=1
255 done
256
257 [[ ${success} -eq 1 ]] && return
258
259 echo
260 eerror "USE flag '${my_flag}' needs one or more of the following USE flags in ${foreign}:"
261 eerror " ${required_flags}"
262 eerror
263 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
264 eerror " ${foreign} ${required_flags}"
265 eerror
266 eerror "You could disable this flag instead in /etc/portage/package.use:"
267 eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
268 echo
269 die "Missing USE flags in ${foreign}"
270}
271
272
273# internal function constructs the configure values for optional shared module
274# support and extra arguments
275_confutils_shared_suffix() {
276 local my_shared=
277
278 if [[ "$1" == "1" ]]; then
279 if [[ -n "${shared}" ]]; then
280 my_shared="${shared}"
281 if [[ -n "$2" ]]; then
282 my_shared="${my_shared},$2"
283 fi
284 elif [[ -n "$2" ]]; then
285 my_shared="=$2"
209 fi 286 fi
210} 287 else
288 if [[ -n "$2" ]]; then
289 my_shared="=$2"
290 fi
291 fi
211 292
212# ======================================================================== 293 echo "${my_shared}"
294}
295
213# enable_extension_disable () 296# @FUNCTION: enable_extension_disable
214# 297# @USAGE: <extension> <flag> [msg]
298# @DESCRIPTION:
215# Use this function to disable an extension that is enabled by default. 299# Use this function to disable an extension that is enabled by default. This is
216# This is provided for those rare configure scripts that don't support 300# provided for those rare configure scripts that don't support a --enable for
217# a --enable for the corresponding --disable 301# the corresponding --disable.
218#
219# $1 - extension name
220# $2 - USE flag
221# $3 - optional message to einfo() to the user
222
223enable_extension_disable () { 302enable_extension_disable() {
303 local my_msg=${3:-$1}
304
224 if ! use "$2" ; then 305 if use "$2" ; then
306 einfo " Enabling ${my_msg}"
307 else
225 my_conf="${my_conf} --disable-$1" 308 my_conf="${my_conf} --disable-$1"
226 [ -n "$3" ] && einfo " Disabling $1" 309 einfo " Disabling ${my_msg}"
227 else
228 [ -n "$3" ] && einfo " Enabling $1"
229 fi 310 fi
230} 311}
231 312
232# ========================================================================
233# enable_extension_enable () 313# @FUNCTION: enable_extension_enable
234# 314# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
315# @DESCRIPTION:
235# This function is like use_enable(), except that it knows about 316# This function is like use_enable(), except that it knows about enabling
236# enabling modules as shared libraries, and it supports passing 317# modules as shared libraries, and it supports passing additional data with the
237# additional data with the switch 318# switch.
238#
239# $1 - extension name
240# $2 - USE flag
241# $3 - 1 = support shared, 0 = never support shared
242# $4 - additional setting for configure
243# $5 - additional message to einfo out to the user
244
245enable_extension_enable () { 319enable_extension_enable() {
246 local my_shared 320 local my_shared=$(_confutils_shared_suffix $3 $4)
321 local my_msg=${5:-$1}
247 322
248 if [ "$3" == "1" ]; then 323 if use $2; then
249 if [ "$shared+" != "+" ]; then 324 my_conf="${my_conf} --enable-${1}${my_shared}"
250 my_shared="${shared}" 325 einfo " Enabling ${my_msg}"
251 if [ "$4+" != "+" ]; then 326 else
252 my_shared="${my_shared},$4" 327 my_conf="${my_conf} --disable-$1"
253 fi 328 einfo " Disabling ${my_msg}"
254 elif [ "$4+" != "+" ]; then
255 my_shared="=$4"
256 fi 329 fi
257 else 330}
258 if [ "$4+" != "+" ]; then 331
259 my_shared="=$4" 332# @FUNCTION: enable_extension_enableonly
260 fi 333# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
261 fi 334# @DESCRIPTION:
335# This function is like use_enable(), except that it knows about enabling
336# modules as shared libraries, and it supports passing additional data with the
337# switch. This function is provided for those rare configure scripts that support
338# --enable but not the corresponding --disable.
339enable_extension_enableonly() {
340 local my_shared=$(_confutils_shared_suffix $3 $4)
341 local my_msg=${5:-$1}
262 342
263 if use $2 ; then 343 if use $2 ; then
264 my_conf="${my_conf} --enable-$1$my_shared" 344 my_conf="${my_conf} --enable-${1}${my_shared}"
265 einfo " Enabling $1" 345 einfo " Enabling ${my_msg}"
266 else
267 my_conf="${my_conf} --disable-$1"
268 einfo " Disabling $1"
269 fi
270}
271
272# ========================================================================
273# enable_extension_enableonly ()
274#
275# This function is like use_enable(), except that it knows about
276# enabling modules as shared libraries, and it supports passing
277# additional data with the switch
278#
279# $1 - extension name
280# $2 - USE flag
281# $3 - 1 = support shared, 0 = never support shared
282# $4 - additional setting for configure
283# $5 - additional message to einfo out to the user
284
285enable_extension_enableonly () {
286 local my_shared
287
288 if [ "$3" == "1" ]; then
289 if [ "$shared+" != "+" ]; then
290 my_shared="${shared}"
291 if [ "$4+" != "+" ]; then
292 my_shared="${my_shared},$4"
293 fi
294 elif [ "$4+" != "+" ]; then
295 my_shared="=$4"
296 fi
297 else
298 if [ "$4+" != "+" ]; then
299 my_shared="=$4"
300 fi
301 fi
302
303 if use $2 ; then
304 my_conf="${my_conf} --enable-$1$my_shared"
305 einfo " Enabling $1"
306 else 346 else
307 # note: we deliberately do *not* use a --disable switch here 347 # note: we deliberately do *not* use a --disable switch here
308 einfo " Disabling $1" 348 einfo " Disabling ${my_msg}"
309 fi 349 fi
310} 350}
311# ======================================================================== 351
312# enable_extension_without () 352# @FUNCTION: enable_extension_without
313# 353# @USAGE: <extension> <flag> [msg]
354# @DESCRIPTION:
314# Use this function to disable an extension that is enabled by default 355# Use this function to disable an extension that is enabled by default. This
315# This function is provided for those rare configure scripts that support 356# function is provided for those rare configure scripts that support --without
316# --without but not the corresponding --with 357# but not the corresponding --with
317#
318# $1 - extension name
319# $2 - USE flag
320# $3 - optional message to einfo() to the user
321
322enable_extension_without () { 358enable_extension_without() {
359 local my_msg=${3:-$1}
360
323 if ! use "$2" ; then 361 if use "$2"; then
362 einfo " Enabling ${my_msg}"
363 else
324 my_conf="${my_conf} --without-$1" 364 my_conf="${my_conf} --without-$1"
325 einfo " Disabling $1" 365 einfo " Disabling ${my_msg}"
326 else
327 einfo " Enabling $1"
328 fi 366 fi
329} 367}
330 368
331# ========================================================================
332# enable_extension_with () 369# @FUNCTION: enable_extension_with
333# 370# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
334# This function is a replacement for use_with. It supports building 371# @DESCRIPTION:
335# extensions as shared libraries, 372# This function is like use_with(), except that it knows about enabling modules
336 373# as shared libraries, and it supports passing additional data with the switch.
337# $1 - extension name
338# $2 - USE flag
339# $3 - 1 = support shared, 0 = never support shared
340# $4 - additional setting for configure
341# $5 - optional message to einfo() out to the user
342
343enable_extension_with () { 374enable_extension_with() {
344 local my_shared 375 local my_shared=$(_confutils_shared_suffix $3 $4)
376 local my_msg=${5:-$1}
345 377
346 if [ "$3" == "1" ]; then
347 if [ "$shared+" != "+" ]; then
348 my_shared="${shared}"
349 if [ "$4+" != "+" ]; then
350 my_shared="${my_shared},$4"
351 fi
352 elif [ "$4+" != "+" ]; then
353 my_shared="=$4"
354 fi
355 else
356 if [ "$4+" != "+" ]; then
357 my_shared="=$4"
358 fi
359 fi
360
361 if use $2 ; then 378 if use $2; then
362 my_conf="${my_conf} --with-$1$my_shared" 379 my_conf="${my_conf} --with-${1}${my_shared}"
363 einfo " Enabling $1" 380 einfo " Enabling ${my_msg}"
364 else 381 else
365 my_conf="${my_conf} --without-$1" 382 my_conf="${my_conf} --without-$1"
366 einfo " Disabling $1" 383 einfo " Disabling ${my_msg}"
367 fi 384 fi
368} 385}
369 386
370# ========================================================================
371# enable_extension_withonly () 387# @FUNCTION: enable_extension_withonly
372# 388# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
373# This function is a replacement for use_with. It supports building 389# @DESCRIPTION:
374# extensions as shared libraries, 390# This function is like use_with(), except that it knows about enabling modules
375 391# as shared libraries, and it supports passing additional data with the switch.
376# $1 - extension name 392# This function is provided for those rare configure scripts that support --enable
377# $2 - USE flag 393# but not the corresponding --disable.
378# $3 - 1 = support shared, 0 = never support shared
379# $4 - additional setting for configure
380# $5 - optional message to einfo() out to the user
381
382enable_extension_withonly () { 394enable_extension_withonly() {
383 local my_shared 395 local my_shared=$(_confutils_shared_suffix $3 $4)
396 local my_msg=${5:-$1}
384 397
385 if [ "$3" == "1" ]; then
386 if [ "$shared+" != "+" ]; then
387 my_shared="${shared}"
388 if [ "$4+" != "+" ]; then
389 my_shared="${my_shared},$4"
390 fi
391 elif [ "$4+" != "+" ]; then
392 my_shared="=$4"
393 fi
394 else
395 if [ "$4+" != "+" ]; then
396 my_shared="=$4"
397 fi
398 fi
399
400 if use $2 ; then 398 if use $2; then
401 my_conf="${my_conf} --with-$1$my_shared" 399 my_conf="${my_conf} --with-${1}${my_shared}"
402 einfo " Enabling $1" 400 einfo " Enabling ${my_msg}"
403 else 401 else
404 # note - we deliberately do *not* use --without here 402 # note: we deliberately do *not* use a --without switch here
405 einfo " Disabling $1" 403 einfo " Disabling ${my_msg}"
406 fi
407}
408
409# ========================================================================
410# confutils_warn_about_external_deps
411
412confutils_warn_about_missing_deps ()
413{
414 local x
415 local my_found=0
416
417 for x in $CONFUTILS_MISSING_DEPS ; do
418 if use $x ; then
419 ewarn "USE flag $x enables support for software not in Portage"
420 my_found=1
421 fi 404 fi
422 done
423
424 if [ "$my_found" = "1" ]; then
425 ewarn
426 ewarn "This ebuild will continue, but if you haven't already installed the"
427 ewarn "software required to satisfy the list above, this package will probably"
428 ewarn "fail to compile."
429 ewarn
430 sleep 5
431 fi
432} 405}
433 406
434# ========================================================================
435# enable_extension_enable_built_with () 407# @FUNCTION: enable_extension_enable_built_with
436# 408# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
409# @DESCRIPTION:
437# This function is like use_enable(), except that it knows about 410# This function is like enable_extension_enable(), except that it
438# enabling modules as shared libraries, and it supports passing 411# enables/disables modules based on a USE flag in a foreign package.
439# additional data with the switch
440#
441# $1 - pkg name
442# $2 - USE flag
443# $3 - extension name
444# $4 - additional setting for configure
445# $5 - alternative message
446
447enable_extension_enable_built_with () { 412enable_extension_enable_built_with() {
448 local msg=$3 413 local my_shared=$(_confutils_shared_suffix $4 $5)
449 [[ -n $5 ]] && msg="$5" 414 local my_msg=${6:-$3}
450 415
451 local param
452 [[ -n $4 ]] && msg="=$4"
453
454 if built_with_use $1 $2 ; then 416 if built_with_use $1 $2; then
455 my_conf="${my_conf} --enable-$3${param}" 417 my_conf="${my_conf} --enable-${3}${my_shared}"
456 einfo " Enabling $msg" 418 einfo " Enabling ${my_msg}"
457 else 419 else
458 my_conf="${my_conf} --disable-$3" 420 my_conf="${my_conf} --disable-$3"
459 einfo " Disabling $msg" 421 einfo " Disabling ${my_msg}"
460 fi 422 fi
461} 423}
462 424
463# ========================================================================
464# enable_extension_with_built_with () 425# @FUNCTION: enable_extension_with_built_with ()
465# 426# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
427# @DESCRIPTION:
466# This function is like use_enable(), except that it knows about 428# This function is like enable_extension_with(), except that it
467# enabling modules as shared libraries, and it supports passing 429# enables/disables modules based on a USE flag in a foreign package.
468# additional data with the switch
469#
470# $1 - pkg name
471# $2 - USE flag
472# $3 - extension name
473# $4 - additional setting for configure
474# $5 - alternative message
475
476enable_extension_with_built_with () { 430enable_extension_with_built_with() {
477 local msg=$3 431 # legacy workaround
478 [[ -n $5 ]] && msg="$5" 432 if [[ "$4" != "0" && "$4" != "1" ]]; then
433 enable_extension_with_built_with "$1" "$2" "$3" 0 "$4" "$5"
434 return
435 fi
479 436
480 local param 437 local my_shared=$(_confutils_shared_suffix $4 $5)
481 [[ -n $4 ]] && param="=$4" 438 local my_msg=${6:-$3}
482 439
483 if built_with_use $1 $2 ; then 440 if built_with_use $1 $2; then
484 my_conf="${my_conf} --with-$3${param}" 441 my_conf="${my_conf} --with-${3}${my_shared}"
485 einfo " Enabling $msg" 442 einfo " Enabling ${my_msg}"
486 else 443 else
487 my_conf="${my_conf} --disable-$3" 444 my_conf="${my_conf} --disable-$3"
488 einfo " Disabling $msg" 445 einfo " Disabling ${my_msg}"
489 fi 446 fi
490} 447}

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

  ViewVC Help
Powered by ViewVC 1.1.20