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

Contents of /eclass/confutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Sat Mar 19 08:05:56 2005 UTC (9 years, 5 months ago) by sebastian
Branch: MAIN
Changes since 1.14: +2 -2 lines
Remove interbase.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.14 2005/03/01 15:54:31 stuart Exp $
4 #
5 # eclass/confutils.eclass
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
15 IUSE="$IUSE sharedext"
16
17 # ========================================================================
18
19 # list of USE flags that need deps that aren't yet in Portage
20 # this list was originally added for PHP
21
22 CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix ingres mnogosearch msession msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct"
23
24 # ========================================================================
25 # confutils_init ()
26 #
27 # Call this function from your src_compile() function to initialise
28 # this eclass first
29
30 confutils_init () {
31 if useq sharedext ; then
32 shared="=shared"
33 else
34 shared=
35 fi
36 }
37
38 # ========================================================================
39 # confutils_use_conflict ()
40 #
41 # Use this function to automatically complain to the user if conflicting
42 # USE flags have been enabled
43 #
44 # $1 - flag that depends on other flags
45 # $2 .. - flags that conflict
46
47 confutils_use_conflict () {
48 if ! useq $1 ; then
49 return
50 fi
51
52 local my_flag="$1"
53 shift
54
55 local my_present=
56 local my_remove=
57
58 while [ "$1+" != "+" ]; do
59 if useq $1 ; then
60 my_present="${my_present} $1"
61 my_remove="${my_remove} -$1"
62 fi
63 shift
64 done
65
66 if [ -n "$my_present" ]; then
67 echo
68 eerror "USE flag '$my_flag' conflicts with these USE flag(s):"
69 eerror " $my_present"
70 eerror
71 eerror "You must disable these conflicting flags before you can emerge this package."
72 eerror "You can do this by disabling these flags in /etc/portage/package.use:"
73 eerror " =$CATEGORY/$PN-$PVR $my_remove"
74 eerror
75 die "Conflicting USE flags"
76 fi
77 }
78
79 # ========================================================================
80 # confutils_use_depend_all ()
81 #
82 # Use this function to automatically complain to the user if a USE flag
83 # depends on another USE flag that hasn't been enabled
84 #
85 # $1 - flag that depends on other flags
86 # $2 .. - the flags that must be set for $1 to be valid
87
88 confutils_use_depend_all () {
89 if ! useq $1 ; then
90 return
91 fi
92
93 local my_flag="$1"
94 shift
95
96 local my_missing=
97
98 while [ "$1+" != "+" ]; do
99 if ! useq $1 ; then
100 my_missing="${my_missing} $1"
101 fi
102 shift
103 done
104
105 if [ -n "$my_missing" ]; then
106 echo
107 eerror "USE flag '$my_flag' needs these additional flag(s) set:"
108 eerror " $my_missing"
109 eerror
110 eerror "You can do this by enabling these flags in /etc/portage/package.use:"
111 eerror " =$CATEGORY/$PN-$PVR $my_missing"
112 eerror
113 eerror "You could disable this flag instead in /etc/portage/package.use:"
114 eerror " =$CATEGORY/$PN-$PVR -$my_flag"
115 echo
116
117 die "Need missing USE flags"
118 fi
119 }
120
121 # ========================================================================
122 # confutils_use_depend_any ()
123 #
124 # Use this function to automatically complain to the user if a USE flag
125 # depends on another USE flag that hasn't been enabled
126 #
127 # $1 - flag that depends on other flags
128 # $2 .. - flags that must be set for $1 to be valid
129
130 confutils_use_depend_any () {
131 if ! useq $1 ; then
132 return
133 fi
134
135 local my_flag="$1"
136 shift
137
138 local my_found=
139 local my_missing=
140
141 while [ "$1+" != "+" ]; do
142 if useq $1 ; then
143 my_found="${my_found} $1"
144 else
145 my_missing="${my_missing} $1"
146 fi
147 shift
148 done
149
150 if [ -z "$my_found" ]; then
151 echo
152 eerror "USE flag '$my_flag' needs one of these additional flag(s) set:"
153 eerror " $my_missing"
154 eerror
155 eerror "You can do this by enabling one of these flags in /etc/portage/package.use"
156 eerror
157 die "Need missing USE flag"
158 fi
159 }
160
161 # ========================================================================
162 # enable_extension_disable ()
163 #
164 # Use this function to disable an extension that is enabled by default.
165 # This is provided for those rare configure scripts that don't support
166 # a --enable for the corresponding --disable
167 #
168 # $1 - extension name
169 # $2 - USE flag
170 # $3 - optional message to einfo() to the user
171
172 enable_extension_disable () {
173 if ! useq "$2" ; then
174 my_conf="${my_conf} --disable-$1"
175 [ -n "$3" ] && einfo " Disabling $1"
176 else
177 [ -n "$3" ] && einfo " Enabling $1"
178 fi
179 }
180
181 # ========================================================================
182 # enable_extension_enable ()
183 #
184 # This function is like use_enable(), except that it knows about
185 # enabling modules as shared libraries, and it supports passing
186 # additional data with the switch
187 #
188 # $1 - extension name
189 # $2 - USE flag
190 # $3 - 1 = support shared, 0 = never support shared
191 # $4 - additional setting for configure
192 # $5 - additional message to einfo out to the user
193
194 enable_extension_enable () {
195 local my_shared
196
197 if [ "$3" == "1" ]; then
198 if [ "$shared+" != "+" ]; then
199 my_shared="${shared}"
200 if [ "$4+" != "+" ]; then
201 my_shared="${my_shared},$4"
202 fi
203 elif [ "$4+" != "+" ]; then
204 my_shared="=$4"
205 fi
206 else
207 if [ "$4+" != "+" ]; then
208 my_shared="=$4"
209 fi
210 fi
211
212 if useq $2 ; then
213 my_conf="${my_conf} --enable-$1$my_shared"
214 einfo " Enabling $1"
215 else
216 my_conf="${my_conf} --disable-$1"
217 einfo " Disabling $1"
218 fi
219 }
220
221 # ========================================================================
222 # enable_extension_enableonly ()
223 #
224 # This function is like use_enable(), except that it knows about
225 # enabling modules as shared libraries, and it supports passing
226 # additional data with the switch
227 #
228 # $1 - extension name
229 # $2 - USE flag
230 # $3 - 1 = support shared, 0 = never support shared
231 # $4 - additional setting for configure
232 # $5 - additional message to einfo out to the user
233
234 enable_extension_enableonly () {
235 local my_shared
236
237 if [ "$3" == "1" ]; then
238 if [ "$shared+" != "+" ]; then
239 my_shared="${shared}"
240 if [ "$4+" != "+" ]; then
241 my_shared="${my_shared},$4"
242 fi
243 elif [ "$4+" != "+" ]; then
244 my_shared="=$4"
245 fi
246 else
247 if [ "$4+" != "+" ]; then
248 my_shared="=$4"
249 fi
250 fi
251
252 if useq $2 ; then
253 my_conf="${my_conf} --enable-$1$my_shared"
254 einfo " Enabling $1"
255 else
256 # note: we deliberately do *not* use a --disable switch here
257 einfo " Disabling $1"
258 fi
259 }
260 # ========================================================================
261 # enable_extension_without ()
262 #
263 # Use this function to disable an extension that is enabled by default
264 # This function is provided for those rare configure scripts that support
265 # --without but not the corresponding --with
266 #
267 # $1 - extension name
268 # $2 - USE flag
269 # $3 - optional message to einfo() to the user
270
271 enable_extension_without () {
272 if ! useq "$2" ; then
273 my_conf="${my_conf} --without-$1"
274 einfo " Disabling $1"
275 else
276 einfo " Enabling $1"
277 fi
278 }
279
280 # ========================================================================
281 # enable_extension_with ()
282 #
283 # This function is a replacement for use_with. It supports building
284 # extensions as shared libraries,
285
286 # $1 - extension name
287 # $2 - USE flag
288 # $3 - 1 = support shared, 0 = never support shared
289 # $4 - additional setting for configure
290 # $5 - optional message to einfo() out to the user
291
292 enable_extension_with () {
293 local my_shared
294
295 if [ "$3" == "1" ]; then
296 if [ "$shared+" != "+" ]; then
297 my_shared="${shared}"
298 if [ "$4+" != "+" ]; then
299 my_shared="${my_shared},$4"
300 fi
301 elif [ "$4+" != "+" ]; then
302 my_shared="=$4"
303 fi
304 else
305 if [ "$4+" != "+" ]; then
306 my_shared="=$4"
307 fi
308 fi
309
310 if useq $2 ; then
311 my_conf="${my_conf} --with-$1$my_shared"
312 einfo " Enabling $1"
313 else
314 my_conf="${my_conf} --without-$1"
315 einfo " Disabling $1"
316 fi
317 }
318
319 # ========================================================================
320 # enable_extension_withonly ()
321 #
322 # This function is a replacement for use_with. It supports building
323 # extensions as shared libraries,
324
325 # $1 - extension name
326 # $2 - USE flag
327 # $3 - 1 = support shared, 0 = never support shared
328 # $4 - additional setting for configure
329 # $5 - optional message to einfo() out to the user
330
331 enable_extension_withonly () {
332 local my_shared
333
334 if [ "$3" == "1" ]; then
335 if [ "$shared+" != "+" ]; then
336 my_shared="${shared}"
337 if [ "$4+" != "+" ]; then
338 my_shared="${my_shared},$4"
339 fi
340 elif [ "$4+" != "+" ]; then
341 my_shared="=$4"
342 fi
343 else
344 if [ "$4+" != "+" ]; then
345 my_shared="=$4"
346 fi
347 fi
348
349 if useq $2 ; then
350 my_conf="${my_conf} --with-$1$my_shared"
351 einfo " Enabling $1"
352 else
353 # note - we deliberately do *not* use --without here
354 einfo " Disabling $1"
355 fi
356 }
357
358 # ========================================================================
359 # confutils_warn_about_external_deps
360
361 confutils_warn_about_missing_deps ()
362 {
363 local x
364 local my_found=0
365
366 for x in $CONFUTILS_MISSING_DEPS ; do
367 if useq $x ; then
368 ewarn "USE flag $x enables support for software not in Portage"
369 my_found=1
370 fi
371 done
372
373 if [ "$my_found" = "1" ]; then
374 ewarn
375 ewarn "This ebuild will continue, but if you haven't already installed the"
376 ewarn "software required to satisfy the list above, this package will probably"
377 ewarn "fail to compile."
378 ewarn
379 sleep 5
380 fi
381 }

  ViewVC Help
Powered by ViewVC 1.1.20