Gentoo Archives: gentoo-dev

From: "Kevin F. Quinn" <kevquinn@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour
Date: Thu, 22 Feb 2007 23:16:50
Message-Id: 20070223001638.4f031dac@c1358217.kevquinn.com
In Reply to: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour by Ciaran McCreesh
1 On Thu, 22 Feb 2007 19:08:48 +0000
2 Ciaran McCreesh <ciaranm@×××××××.org> wrote:
3
4 > The example given in ebuild(5) is:
5 >
6 > || (
7 > sdl? ( media-libs/libsdl )
8 > svga? ( media-libs/svgalib )
9 > opengl? ( virtual/opengl )
10 > ggi? ( media-libs/libggi )
11 > virtual/x
12 > )
13
14 Took me a while to figure out why anyone would want to write that; the
15 key is that ebuild(5) says only one of the conditions is satisfied;
16 i.e. even if all the dependencies are present on the system, the
17 package will build only against the first matching dependency.
18
19 The way I see it, the ebuild has to cater for the dynamic situation
20 anyway, for example doing something like:
21
22 src_configure() {
23 use sdl &&
24 has_version media-libs/libsdl &&
25 vid_conf="--enable sdl" ||
26 use svga &&
27 has_version media-libs/svgalib &&
28 vid_conf="--enable svga" ||
29 use opengl &&
30 has_version virtual/opengl &&
31 vid_conf="--enable opengl" ||
32 use ggi &&
33 has_version media-libs/libggi &&
34 vid_conf="--enable ggi" ||
35 vid_conf="--enable x11"
36 ...
37 econf ${vid_conf} ...
38 }
39
40 So the dependency could be re-written as:
41
42 sdl? ( media-libs/libsdl )
43 !sdl? ( svga? ( media-libs/svgalib )
44 !svga? ( opengl? ( virtual/opengl )
45 !opengl? ( ggi? ( media-libs/libggi )
46 !ggi? ( virtual/x ) ) ) )
47
48 and you have the same result, which means the originally quoted syntax
49 is redundant. The only advantage it has is that it looks a little bit
50 prettier - but I'd argue the logic is clearer in the re-written version.
51
52 I guess the question remains, though - should that syntax be in EAPI=0
53 or not...
54
55 --
56 Kevin F. Quinn

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour Georgi Georgiev <chutz@×××.net>
Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour Paul de Vrieze <pauldv@g.o>