Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Is Gentoo wiping out Gtk 2 support from packages that support it?
Date: Fri, 08 Jul 2011 16:11:41
Message-Id: 1562264.5oy8gnuzIK@nazgul
In Reply to: Re: [gentoo-user] Is Gentoo wiping out Gtk 2 support from packages that support it? by Albert Hopkins
1 On Friday 08 July 2011 09:14:36 Albert Hopkins did opine thusly:
2 > On Friday, July 8 at 13:11 (+0100), Stroller said:
3 > > Taking a look at this bug today, is there any reason why the
4 > > ebuild shouldn't simply RDEPEND="x11-libs/gtk+" (i.e. remove
5 > > the explicit dep on gtk3), detect what version you have
6 > > installed on your system and then either run --enable-gtk3 or
7 > > --enable-gtk2 during src_configure(), depending upon which
8 > > you're using?
9 >
10 > ebuilds generally don't do this, because it is bad. What you have
11 > and what you want aren't necessarily the same thing. Consider:
12 >
13 > * You don't yet have any gtk installed
14 > * You have gtk2 but actually *want* the gtk3 version, so you
15 > want the ebuild to pull in gtk3 (or vice versa)
16 > * You have both gtk2 and gtk3 installed.
17 > * You have gtk installed, but don't want gtk support for a
18 > particular package (if gtk support is optional for that
19 > package).
20
21 easy.
22
23 Two USE flags: gtk2 and gtk3
24
25 in ebuild:
26
27 DEPEND="
28 gtk2? (x11-libs/gtk+:2)
29 gtk3? (x11-libs/gtk+:3)
30 "
31
32 in src-configure() write the code such that it establishes a
33 precedence
34
35 If both flags are set, build against gtk+:3
36 If only one flag is set, build against that toolkit
37 If no flags are set, do something appropriate.
38
39 IIRC, it is frowned upon to have conditionals in DEPENDS based on USE
40 flags so the above is best - take the small hit on disk space if both
41 are set and gtk+:2 is used nowhere else (highly unlikely for quite a
42 while still)
43
44 --
45 alan dot mckinnon at gmail dot com

Replies