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