Lines 1-36
Link Here
|
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: $ |
4 |
# |
4 |
|
5 |
# eclass/confutils.eclass |
5 |
# @ECLASS: confutils.eclass |
6 |
# Utility functions to help with configuring a package |
6 |
# @MAINTAINER: |
7 |
# |
7 |
# ??? |
8 |
# Based on Stuart's work for the PHP 5 eclass |
8 |
# Author: |
9 |
# |
9 |
# Stuart Herbert <stuart@gentoo.org> |
10 |
# Author(s) Stuart Herbert |
10 |
# @BLURB: Utility functions to help with configuring a package |
11 |
# <stuart@gentoo.org> |
11 |
# @DESCRIPTION: |
12 |
# |
12 |
# Utility functions to help with configuring a package |
13 |
# ======================================================================== |
13 |
# Based on Stuart's work for the PHP 5 eclass |
14 |
|
14 |
|
15 |
inherit eutils |
15 |
inherit eutils |
16 |
|
16 |
|
|
|
17 |
# @ECLASS-VARIABLE: EBUILD_SUPPORTS_SHAREDEXT |
18 |
# @DESCRIPTION: |
19 |
# If your ebuild supports sharedext set this var to 1 |
17 |
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then |
20 |
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then |
18 |
IUSE="sharedext" |
21 |
IUSE="sharedext" |
19 |
fi |
22 |
fi |
20 |
|
23 |
|
21 |
# ======================================================================== |
24 |
# @ECLASS-VARIABLE: CONFUTILS_MISSING_DEPS |
22 |
|
25 |
# @DESCRIPTION: |
23 |
# list of USE flags that need deps that aren't yet in Portage |
26 |
# list of USE flags that need deps that aren't yet in Portage |
24 |
# this list was originally added for PHP |
27 |
# this list was originally added for PHP |
25 |
# |
28 |
# |
26 |
# your eclass must define CONFUTILS_MISSING_DEPS if you need this |
29 |
# your eclass must define CONFUTILS_MISSING_DEPS if you need this |
27 |
|
30 |
|
28 |
# ======================================================================== |
31 |
# @FUNCTION: confutils_init |
29 |
# confutils_init () |
32 |
# @DESCRIPTION: |
30 |
# |
|
|
31 |
# Call this function from your src_compile() function to initialise |
33 |
# Call this function from your src_compile() function to initialise |
32 |
# this eclass first |
34 |
# this eclass first |
33 |
|
|
|
34 |
confutils_init () { |
35 |
confutils_init () { |
35 |
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext ; then |
36 |
if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext ; then |
36 |
shared="=shared" |
37 |
shared="=shared" |
Lines 39-55
Link Here
|
39 |
fi |
40 |
fi |
40 |
} |
41 |
} |
41 |
|
42 |
|
42 |
# ======================================================================== |
43 |
|
43 |
# confutils_require_any () |
44 |
# @FUNCTION: confutils_require_any |
44 |
# |
45 |
# @USAGE: < $1 > < $2 > < $3 > |
|
|
46 |
# @DESCRIPTION: |
45 |
# Use this function to ensure one or more of the specified USE flags have |
47 |
# Use this function to ensure one or more of the specified USE flags have |
46 |
# been enabled |
48 |
# been enabled |
47 |
# |
49 |
# |
|
|
50 |
# @CODE |
48 |
# $1 - message to output everytime a flag is found |
51 |
# $1 - message to output everytime a flag is found |
49 |
# $2 - message to output everytime a flag is not found |
52 |
# $2 - message to output everytime a flag is not found |
50 |
# $3 .. - flags to check |
53 |
# $3 .. - flags to check |
51 |
# |
54 |
# @CODE |
52 |
|
|
|
53 |
confutils_require_any() { |
55 |
confutils_require_any() { |
54 |
success_msg="$1" |
56 |
success_msg="$1" |
55 |
shift |
57 |
shift |
Lines 86-100
Link Here
|
86 |
die "Missing USE flags" |
88 |
die "Missing USE flags" |
87 |
} |
89 |
} |
88 |
|
90 |
|
89 |
# ======================================================================== |
91 |
|
90 |
# confutils_use_conflict () |
92 |
# @FUNCTION: confutils_use_conflict |
91 |
# |
93 |
# @USAGE: < $1 > < $2 > |
|
|
94 |
# @DESCRIPTION: |
92 |
# Use this function to automatically complain to the user if conflicting |
95 |
# Use this function to automatically complain to the user if conflicting |
93 |
# USE flags have been enabled |
96 |
# USE flags have been enabled |
94 |
# |
97 |
# |
95 |
# $1 - flag that depends on other flags |
98 |
# @CODE |
|
|
99 |
# $1 - flag that depends on other flags |
96 |
# $2 .. - flags that conflict |
100 |
# $2 .. - flags that conflict |
97 |
|
101 |
# @CODE |
98 |
confutils_use_conflict () { |
102 |
confutils_use_conflict () { |
99 |
if ! use $1 ; then |
103 |
if ! use $1 ; then |
100 |
return |
104 |
return |
Lines 127-141
Link Here
|
127 |
fi |
131 |
fi |
128 |
} |
132 |
} |
129 |
|
133 |
|
130 |
# ======================================================================== |
134 |
# @FUNCTION: confutils_use_depend_all |
131 |
# confutils_use_depend_all () |
135 |
# @USAGE: < $1 > < $2 > |
132 |
# |
136 |
# @DESCRIPTION: |
133 |
# Use this function to automatically complain to the user if a USE flag |
137 |
# Use this function to automatically complain to the user if a USE flag |
134 |
# depends on another USE flag that hasn't been enabled |
138 |
# depends on another USE flag that hasn't been enabled |
135 |
# |
139 |
# |
136 |
# $1 - flag that depends on other flags |
140 |
# @CODE |
|
|
141 |
# $1 - flag that depends on other flags |
137 |
# $2 .. - the flags that must be set for $1 to be valid |
142 |
# $2 .. - the flags that must be set for $1 to be valid |
138 |
|
143 |
# @CODE |
139 |
confutils_use_depend_all () { |
144 |
confutils_use_depend_all () { |
140 |
if ! use $1 ; then |
145 |
if ! use $1 ; then |
141 |
return |
146 |
return |
Lines 169-183
Link Here
|
169 |
fi |
174 |
fi |
170 |
} |
175 |
} |
171 |
|
176 |
|
172 |
# ======================================================================== |
177 |
# @FUNCTION: confutils_use_depend_any |
173 |
# confutils_use_depend_any () |
178 |
# @USAGE: < $1 > < $2 > |
174 |
# |
179 |
# @DESCRIPTION: |
175 |
# Use this function to automatically complain to the user if a USE flag |
180 |
# Use this function to automatically complain to the user if a USE flag |
176 |
# depends on another USE flag that hasn't been enabled |
181 |
# depends on another USE flag that hasn't been enabled |
177 |
# |
182 |
# |
178 |
# $1 - flag that depends on other flags |
183 |
# @CODE |
|
|
184 |
# $1 - flag that depends on other flags |
179 |
# $2 .. - flags that must be set for $1 to be valid |
185 |
# $2 .. - flags that must be set for $1 to be valid |
180 |
|
186 |
# @CODE |
181 |
confutils_use_depend_any () { |
187 |
confutils_use_depend_any () { |
182 |
if ! use $1 ; then |
188 |
if ! use $1 ; then |
183 |
return |
189 |
return |
Lines 209-225
Link Here
|
209 |
fi |
215 |
fi |
210 |
} |
216 |
} |
211 |
|
217 |
|
212 |
# ======================================================================== |
218 |
# @FUNCTION: enable_extension_disable |
213 |
# enable_extension_disable () |
219 |
# @USAGE: < $1 > < $2 > [ $3 ] |
214 |
# |
220 |
# @DESCRIPTION: |
215 |
# Use this function to disable an extension that is enabled by default. |
221 |
# Use this function to disable an extension that is enabled by default. |
216 |
# This is provided for those rare configure scripts that don't support |
222 |
# This is provided for those rare configure scripts that don't support |
217 |
# a --enable for the corresponding --disable |
223 |
# a --enable for the corresponding --disable |
218 |
# |
224 |
# |
|
|
225 |
# @CODE |
219 |
# $1 - extension name |
226 |
# $1 - extension name |
220 |
# $2 - USE flag |
227 |
# $2 - USE flag |
221 |
# $3 - optional message to einfo() to the user |
228 |
# $3 - optional message to einfo() to the user |
222 |
|
229 |
# @CODE |
223 |
enable_extension_disable () { |
230 |
enable_extension_disable () { |
224 |
if ! use "$2" ; then |
231 |
if ! use "$2" ; then |
225 |
my_conf="${my_conf} --disable-$1" |
232 |
my_conf="${my_conf} --disable-$1" |
Lines 229-247
Link Here
|
229 |
fi |
236 |
fi |
230 |
} |
237 |
} |
231 |
|
238 |
|
232 |
# ======================================================================== |
239 |
# @FUNCTION: enable_extension_enable |
233 |
# enable_extension_enable () |
240 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > < $5 > |
234 |
# |
241 |
# @DESCRIPTION: |
235 |
# This function is like use_enable(), except that it knows about |
242 |
# This function is like use_enable(), except that it knows about |
236 |
# enabling modules as shared libraries, and it supports passing |
243 |
# enabling modules as shared libraries, and it supports passing |
237 |
# additional data with the switch |
244 |
# additional data with the switch |
238 |
# |
245 |
# |
|
|
246 |
# @CODE |
239 |
# $1 - extension name |
247 |
# $1 - extension name |
240 |
# $2 - USE flag |
248 |
# $2 - USE flag |
241 |
# $3 - 1 = support shared, 0 = never support shared |
249 |
# $3 - 1 = support shared, 0 = never support shared |
242 |
# $4 - additional setting for configure |
250 |
# $4 - additional setting for configure |
243 |
# $5 - additional message to einfo out to the user |
251 |
# $5 - additional message to einfo out to the user |
244 |
|
252 |
# @CODE |
245 |
enable_extension_enable () { |
253 |
enable_extension_enable () { |
246 |
local my_shared |
254 |
local my_shared |
247 |
|
255 |
|
Lines 269-287
Link Here
|
269 |
fi |
277 |
fi |
270 |
} |
278 |
} |
271 |
|
279 |
|
272 |
# ======================================================================== |
280 |
# @FUNCTION: enable_extension_enableonly |
273 |
# enable_extension_enableonly () |
281 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > < $5 > |
274 |
# |
282 |
# @DESCRIPTION: |
275 |
# This function is like use_enable(), except that it knows about |
283 |
# This function is like use_enable(), except that it knows about |
276 |
# enabling modules as shared libraries, and it supports passing |
284 |
# enabling modules as shared libraries, and it supports passing |
277 |
# additional data with the switch |
285 |
# additional data with the switch |
278 |
# |
286 |
# |
|
|
287 |
# @CODEE |
279 |
# $1 - extension name |
288 |
# $1 - extension name |
280 |
# $2 - USE flag |
289 |
# $2 - USE flag |
281 |
# $3 - 1 = support shared, 0 = never support shared |
290 |
# $3 - 1 = support shared, 0 = never support shared |
282 |
# $4 - additional setting for configure |
291 |
# $4 - additional setting for configure |
283 |
# $5 - additional message to einfo out to the user |
292 |
# $5 - additional message to einfo out to the user |
284 |
|
293 |
# @CODE |
285 |
enable_extension_enableonly () { |
294 |
enable_extension_enableonly () { |
286 |
local my_shared |
295 |
local my_shared |
287 |
|
296 |
|
Lines 308-324
Link Here
|
308 |
einfo " Disabling $1" |
317 |
einfo " Disabling $1" |
309 |
fi |
318 |
fi |
310 |
} |
319 |
} |
311 |
# ======================================================================== |
320 |
# @FUNCTION: enable_extension_without |
312 |
# enable_extension_without () |
321 |
# @USAGE: < $1 > < $2 > [ $3 ] |
313 |
# |
322 |
# @DESCRIPTION: |
314 |
# Use this function to disable an extension that is enabled by default |
323 |
# Use this function to disable an extension that is enabled by default |
315 |
# This function is provided for those rare configure scripts that support |
324 |
# This function is provided for those rare configure scripts that support |
316 |
# --without but not the corresponding --with |
325 |
# --without but not the corresponding --with |
317 |
# |
326 |
# |
|
|
327 |
# @CODE |
318 |
# $1 - extension name |
328 |
# $1 - extension name |
319 |
# $2 - USE flag |
329 |
# $2 - USE flag |
320 |
# $3 - optional message to einfo() to the user |
330 |
# $3 - optional message to einfo() to the user |
321 |
|
331 |
# @CODE |
322 |
enable_extension_without () { |
332 |
enable_extension_without () { |
323 |
if ! use "$2" ; then |
333 |
if ! use "$2" ; then |
324 |
my_conf="${my_conf} --without-$1" |
334 |
my_conf="${my_conf} --without-$1" |
Lines 328-345
Link Here
|
328 |
fi |
338 |
fi |
329 |
} |
339 |
} |
330 |
|
340 |
|
331 |
# ======================================================================== |
341 |
# @FUNCTION: enable_extension_with |
332 |
# enable_extension_with () |
342 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > [ $5 ] |
333 |
# |
343 |
# @DESCRIPTION: |
334 |
# This function is a replacement for use_with. It supports building |
344 |
# This function is a replacement for use_with. It supports building |
335 |
# extensions as shared libraries, |
345 |
# extensions as shared libraries, |
336 |
|
346 |
# |
|
|
347 |
# @CODE |
337 |
# $1 - extension name |
348 |
# $1 - extension name |
338 |
# $2 - USE flag |
349 |
# $2 - USE flag |
339 |
# $3 - 1 = support shared, 0 = never support shared |
350 |
# $3 - 1 = support shared, 0 = never support shared |
340 |
# $4 - additional setting for configure |
351 |
# $4 - additional setting for configure |
341 |
# $5 - optional message to einfo() out to the user |
352 |
# $5 - optional message to einfo() out to the user |
342 |
|
353 |
# @CODE |
343 |
enable_extension_with () { |
354 |
enable_extension_with () { |
344 |
local my_shared |
355 |
local my_shared |
345 |
|
356 |
|
Lines 367-384
Link Here
|
367 |
fi |
378 |
fi |
368 |
} |
379 |
} |
369 |
|
380 |
|
370 |
# ======================================================================== |
381 |
# @FUNCTION: enable_extension_withonly |
371 |
# enable_extension_withonly () |
382 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > [ $5 ] |
372 |
# |
383 |
# @DESCRIPTION: |
373 |
# This function is a replacement for use_with. It supports building |
384 |
# This function is a replacement for use_with. It supports building |
374 |
# extensions as shared libraries, |
385 |
# extensions as shared libraries, |
375 |
|
386 |
# |
|
|
387 |
# @CODE |
376 |
# $1 - extension name |
388 |
# $1 - extension name |
377 |
# $2 - USE flag |
389 |
# $2 - USE flag |
378 |
# $3 - 1 = support shared, 0 = never support shared |
390 |
# $3 - 1 = support shared, 0 = never support shared |
379 |
# $4 - additional setting for configure |
391 |
# $4 - additional setting for configure |
380 |
# $5 - optional message to einfo() out to the user |
392 |
# $5 - optional message to einfo() out to the user |
381 |
|
393 |
# @CODE |
382 |
enable_extension_withonly () { |
394 |
enable_extension_withonly () { |
383 |
local my_shared |
395 |
local my_shared |
384 |
|
396 |
|
Lines 406-413
Link Here
|
406 |
fi |
418 |
fi |
407 |
} |
419 |
} |
408 |
|
420 |
|
409 |
# ======================================================================== |
|
|
410 |
# confutils_warn_about_external_deps |
411 |
|
421 |
|
412 |
confutils_warn_about_missing_deps () |
422 |
confutils_warn_about_missing_deps () |
413 |
{ |
423 |
{ |
Lines 431-449
Link Here
|
431 |
fi |
441 |
fi |
432 |
} |
442 |
} |
433 |
|
443 |
|
434 |
# ======================================================================== |
444 |
# @FUNCTION: enable_extension_enable_built_with |
435 |
# enable_extension_enable_built_with () |
445 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > < $5 > |
436 |
# |
446 |
# @DESCRIPTION: |
437 |
# This function is like use_enable(), except that it knows about |
447 |
# This function is like use_enable(), except that it knows about |
438 |
# enabling modules as shared libraries, and it supports passing |
448 |
# enabling modules as shared libraries, and it supports passing |
439 |
# additional data with the switch |
449 |
# additional data with the switch |
440 |
# |
450 |
# |
441 |
# $1 - pkg name |
451 |
# @CODE |
|
|
452 |
# $1 - pkg name |
442 |
# $2 - USE flag |
453 |
# $2 - USE flag |
443 |
# $3 - extension name |
454 |
# $3 - extension name |
444 |
# $4 - additional setting for configure |
455 |
# $4 - additional setting for configure |
445 |
# $5 - alternative message |
456 |
# $5 - alternative message |
446 |
|
457 |
# @CODE |
447 |
enable_extension_enable_built_with () { |
458 |
enable_extension_enable_built_with () { |
448 |
local msg=$3 |
459 |
local msg=$3 |
449 |
[[ -n $5 ]] && msg="$5" |
460 |
[[ -n $5 ]] && msg="$5" |
Lines 460-478
Link Here
|
460 |
fi |
471 |
fi |
461 |
} |
472 |
} |
462 |
|
473 |
|
463 |
# ======================================================================== |
474 |
# @FUNCTION: enable_extension_with_built_with |
464 |
# enable_extension_with_built_with () |
475 |
# @USAGE: < $1 > < $2 > < $3 > < $4 > < $5 > |
465 |
# |
476 |
# @DESCRIPTION: |
466 |
# This function is like use_enable(), except that it knows about |
477 |
# This function is like use_enable(), except that it knows about |
467 |
# enabling modules as shared libraries, and it supports passing |
478 |
# enabling modules as shared libraries, and it supports passing |
468 |
# additional data with the switch |
479 |
# additional data with the switch |
469 |
# |
480 |
# |
470 |
# $1 - pkg name |
481 |
# @CODE |
|
|
482 |
# $1 - pkg name |
471 |
# $2 - USE flag |
483 |
# $2 - USE flag |
472 |
# $3 - extension name |
484 |
# $3 - extension name |
473 |
# $4 - additional setting for configure |
485 |
# $4 - additional setting for configure |
474 |
# $5 - alternative message |
486 |
# $5 - alternative message |
475 |
|
487 |
# @CODE |
476 |
enable_extension_with_built_with () { |
488 |
enable_extension_with_built_with () { |
477 |
local msg=$3 |
489 |
local msg=$3 |
478 |
[[ -n $5 ]] && msg="$5" |
490 |
[[ -n $5 ]] && msg="$5" |