1 |
Hi everyone, |
2 |
|
3 |
Introducing the new way of managing several QTs. This can also apply to any |
4 |
other libraries. General idea by drobbins, but I've made a small change. |
5 |
This is still a suggestion, and should be well discussed before implementing. |
6 |
|
7 |
Current scheme: each qt lives in /usr/lib/qt-x11-$ver. It is added to various |
8 |
paths (path, rootpath, ldpath, manpath...) from /etc/env.d so that a newer qt |
9 |
comes first in the paths. An ebuild using qt has to inherit from kde.eclass |
10 |
which contains several pages of ugly convoluted code which selects the |
11 |
version of qt to use and sets QTDIR to it so that a configure script can find |
12 |
it. |
13 |
|
14 |
Compile time: mass of ugly code in kde.eclass, which is essentially an |
15 |
implementation of a version comparison algorithm with support for _beta etc. |
16 |
suffixes in bash, selects version number to use from list of those installed. |
17 |
QTDIR is then ste to the dir of the selected QT and --with-qt=$QTDIR is |
18 |
passed to configure although that's not strictly necessary. |
19 |
|
20 |
Runtime: we add the /lib dir of every QT installed to LDPATH and then have to |
21 |
juggle them. We also add /bni to PATH and anyone who's developing with qt |
22 |
probably doesn't like us for that too much. |
23 |
|
24 |
The biggest problem is that the eclass code is ugly and is becoming more |
25 |
difficult to manage. Also the scheme is inflexible. |
26 |
|
27 |
New proposed scheme: |
28 |
|
29 |
Each QT lives in /usr/lib/qt-x11/$ver. |
30 |
It installs all its files ther, except the libraries, which it installs in |
31 |
/usr/lib/qt-x11/lib. |
32 |
The library symlinks aren't installed. |
33 |
In /usr/lib/qt-x11/$ver/lib, symlinks are installed for all files that point |
34 |
to /usr/lib/qt-x11-lib. |
35 |
|
36 |
For example, with qt 2.3.1 and 3.0.1 installed, things will look like this: |
37 |
|
38 |
/usr/lib/qt-x11/ |
39 |
2.3.1/ |
40 |
share/... |
41 |
bin/... |
42 |
include/... |
43 |
lib/ |
44 |
libqt.so -> ../../lib/libqt.so |
45 |
libqt.so.2 -> ../../lib/libqt.so.2 |
46 |
libqt.so.2.3 -> ../../lib/libqt.so.2.3 |
47 |
libqt.so.2.3.1 -> ../../lib/libqt.so.2.3.1 |
48 |
3.0.1/ |
49 |
share/... |
50 |
bin/... |
51 |
include/... |
52 |
lib/ |
53 |
libqt.so -> ../../lib/libqt.so |
54 |
libqt.so.3 -> ../../lib/libqt.so.3 |
55 |
libqt.so.3.0 -> ../../lib/libqt.so.3.0 |
56 |
libqt.so.3.0.1 -> ../../lib/libqt.so.3.0.1 |
57 |
lib/ |
58 |
libqt.so.2.3.1 # real lib installed by 2.3.1 ebuild |
59 |
libqt.so.3.0.1 # real lib installed by 3.0.1 ebuild |
60 |
|
61 |
A tool I call 'multilib' (for lack of a better name) will be part of portage, |
62 |
to be executed e.g. part of env-update. I remember there's an ebuild function |
63 |
that does somthing like this, but don't remember what it's called. It will |
64 |
for every parameter (e.g. "qt-x11") go to /usr/lib/$1/lib and create the |
65 |
necessary symlinks, overwriting any existing ones. Like this: |
66 |
|
67 |
lib/ |
68 |
libqt.so.2.3.1 # real lib installed by 2.3.1 ebuild |
69 |
libqt.so.3.0.1 # real lib installed by 3.0.1 ebuild |
70 |
# following are symlinks generated by multilib qt-x11, see below |
71 |
libqt.so.2 -> libqt.so.2.3 |
72 |
libqt.so.2.3 -> libqt.so.2.3.1 |
73 |
libqt.so -> libqt.so.3 |
74 |
libqt.so.3 -> libqt.so.3.0 |
75 |
libqt.so.3.0 -> libqt.so.3.0.1 |
76 |
|
77 |
Note that there is no libqt.so -> libqt.so.2.3.1 symlink! No app should link |
78 |
against a qt without at least a major version though. |
79 |
|
80 |
multilib will do more than that, it will also create /usr/lib/qt-x11/$ver |
81 |
dirs for all versions satisfied by those actually installed. In our example: |
82 |
|
83 |
2.2.0/ -> 2.3.1/ |
84 |
2.2.1/ -> 2.3.1/ |
85 |
2.2.2/ -> 2.3.1/ |
86 |
2.2.3/ -> 2.3.1/ |
87 |
2.3.0/ -> 2.3.1/ |
88 |
3.0.0/ -> 3.3.1/ |
89 |
|
90 |
And for some others as well (2.0.*, 2.1.*, prerelease 3.0). An ebuild will |
91 |
thus have to supply portage with information saying that multilib shuold be |
92 |
run on a certain dir, and that this version satisfies dependencies for a |
93 |
given list of other versions. By default, it'd satisfy any earlier version |
94 |
with the same major version number, but such things as 3.0_beta1 in the |
95 |
example above still have to be specified explicitly. But this is a minor |
96 |
concern. |
97 |
|
98 |
Now that we've got everything working, things are made extremely simple. |
99 |
|
100 |
Compile time: |
101 |
An application links against the version it needs. It simply looks in |
102 |
/usr/lib/qt-x11/$ver for its minimal requirement and presto! it's there. No |
103 |
extra code like that currently in kde.eclass is required. |
104 |
|
105 |
Runtime: |
106 |
/usr/lib/qt-x11/lib is added to LDPATH. All library versions are thus made |
107 |
available. |
108 |
|
109 |
Development time: |
110 |
Someone who's developing with a certain QT will have to add its $ver/bin path |
111 |
manually to his PATH. |
112 |
|
113 |
So what do you think? |
114 |
|
115 |
-- |
116 |
|
117 |
Dan Armak |
118 |
Gentoo Linux Developer, Desktop Team |
119 |
Matan, Israel |