Gentoo Archives: gentoo-dev

From: Georgi Georgiev <chutz@×××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour
Date: Fri, 23 Feb 2007 00:27:05
Message-Id: 20070223092414.9tnb6izci04kcok0@horde.gg3.net
In Reply to: Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour by "Kevin F. Quinn"
1 Quoting "Kevin F. Quinn" <kevquinn@g.o>:
2
3 > On Thu, 22 Feb 2007 19:08:48 +0000
4 > Ciaran McCreesh <ciaranm@×××××××.org> wrote:
5 >
6 >> The example given in ebuild(5) is:
7 >>
8 >> || (
9 >> sdl? ( media-libs/libsdl )
10 >> svga? ( media-libs/svgalib )
11 >> opengl? ( virtual/opengl )
12 >> ggi? ( media-libs/libggi )
13 >> virtual/x
14 >> )
15 >
16 > Took me a while to figure out why anyone would want to write that; the
17 > key is that ebuild(5) says only one of the conditions is satisfied;
18 > i.e. even if all the dependencies are present on the system, the
19 > package will build only against the first matching dependency.
20 >
21 > The way I see it, the ebuild has to cater for the dynamic situation
22 > anyway, for example doing something like:
23 >
24 > src_configure() {
25 > use sdl &&
26 > has_version media-libs/libsdl &&
27 > vid_conf="--enable sdl" ||
28 > use svga &&
29 > has_version media-libs/svgalib &&
30 > vid_conf="--enable svga" ||
31 > use opengl &&
32 > has_version virtual/opengl &&
33 > vid_conf="--enable opengl" ||
34 > use ggi &&
35 > has_version media-libs/libggi &&
36 > vid_conf="--enable ggi" ||
37 > vid_conf="--enable x11"
38 > ...
39 > econf ${vid_conf} ...
40 > }
41 >
42 > So the dependency could be re-written as:
43 >
44 > sdl? ( media-libs/libsdl )
45 > !sdl? ( svga? ( media-libs/svgalib )
46 > !svga? ( opengl? ( virtual/opengl )
47 > !opengl? ( ggi? ( media-libs/libggi )
48 > !ggi? ( virtual/x ) ) ) )
49
50 What you wrote for the ebuild-side of the dephandling does not match
51 the expanded DEPEND string.
52
53 If you have all mentioned flags enabled, opengl already installed and
54 libsdl not installed then the || () would be satisfied by "opengl? (
55 virtual/opengl )". Your src_configure() example above properly sets
56 --enable-opengl. However, the DEPEND string that you quoted pulls
57 libsdl instead.
58
59 > and you have the same result, which means the originally quoted syntax
60 > is redundant. The only advantage it has is that it looks a little bit
61 > prettier - but I'd argue the logic is clearer in the re-written version.
62 >
63 > I guess the question remains, though - should that syntax be in EAPI=0
64 > or not...
65 >
66 > --
67 > Kevin F. Quinn
68 >
69
70
71
72 ----------------------------------------------------------------
73 This message was sent using IMP, the Internet Messaging Program.
74
75 --
76 gentoo-dev@g.o mailing list

Replies

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