Gentoo Archives: gentoo-dev

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