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:43:17
Message-Id: 20070223093812.lhlu46vns400g8kw@horde.gg3.net
In Reply to: Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour by Georgi Georgiev
1 Quoting Georgi Georgiev <chutz@×××.net>:
2
3 > Quoting "Kevin F. Quinn" <kevquinn@g.o>:
4 >
5 >> On Thu, 22 Feb 2007 19:08:48 +0000
6 >> Ciaran McCreesh <ciaranm@×××××××.org> wrote:
7 >>
8 >>> The example given in ebuild(5) is:
9 >>>
10 >>> || (
11 >>> sdl? ( media-libs/libsdl )
12 >>> svga? ( media-libs/svgalib )
13 >>> opengl? ( virtual/opengl )
14 >>> ggi? ( media-libs/libggi )
15 >>> virtual/x
16 >>> )
17 >>
18 >> Took me a while to figure out why anyone would want to write that; the
19 >> key is that ebuild(5) says only one of the conditions is satisfied;
20 >> i.e. even if all the dependencies are present on the system, the
21 >> package will build only against the first matching dependency.
22 >>
23 >> The way I see it, the ebuild has to cater for the dynamic situation
24 >> anyway, for example doing something like:
25 >>
26 >> src_configure() {
27 >> use sdl &&
28 >> has_version media-libs/libsdl &&
29 >> vid_conf="--enable sdl" ||
30 >> use svga &&
31 >> has_version media-libs/svgalib &&
32 >> vid_conf="--enable svga" ||
33 >> use opengl &&
34 >> has_version virtual/opengl &&
35 >> vid_conf="--enable opengl" ||
36 >> use ggi &&
37 >> has_version media-libs/libggi &&
38 >> vid_conf="--enable ggi" ||
39 >> vid_conf="--enable x11"
40 >> ...
41 >> econf ${vid_conf} ...
42 >> }
43 >>
44 >> So the dependency could be re-written as:
45 >>
46 >> sdl? ( media-libs/libsdl )
47 >> !sdl? ( svga? ( media-libs/svgalib )
48 >> !svga? ( opengl? ( virtual/opengl )
49 >> !opengl? ( ggi? ( media-libs/libggi )
50 >> !ggi? ( virtual/x ) ) ) )
51 >
52 > What you wrote for the ebuild-side of the dephandling does not match
53 > the expanded DEPEND string.
54 >
55 > If you have all mentioned flags enabled, opengl already installed
56 > and libsdl not installed then the || () would be satisfied by
57 > "opengl? ( virtual/opengl )". Your src_configure() example above
58 > properly sets --enable-opengl. However, the DEPEND string that you
59 > quoted pulls libsdl instead.
60
61 Of course, since the DEPEND pulls libsdl, the src_configure() snippet
62 would set --enable-sdl instead. My bad, but if that really was your
63 intention there would have been no need for the has_version calls.
64
65 ----------------------------------------------------------------
66 This message was sent using IMP, the Internet Messaging Program.
67
68 --
69 gentoo-dev@g.o mailing list