1
2Building, running and Valgrinding KDE 4.2 svn from source
3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5It is recommended to make a new user ("kde4", maybe) to do the
6building, and do all the following as that user.  This means it can't
7mess up any existing KDE sessions/settings.
8
9Prelims (note, needed for both building and running KDE4):
10
11# Change these as you like; but "-g -O" is known to be a good
12# speed vs debuginfo-accuracy tradeoff for Valgrind
13
14export CFLAGS="-g -O"
15export CXXFLAGS="-g -O"
16
17export KDEINST=$HOME/InstKdeSvn  ## change as you like
18export PATH=$KDEINST/bin:$PATH
19export LD_LIBRARY_PATH=$KDEINST/lib:$KDEINST/lib64:$LD_LIBRARY_PATH
20
21unset XDG_DATA_DIRS # to avoid seeing kde3 files from /usr
22unset XDG_CONFIG_DIRS
23
24export PKG_CONFIG_PATH=$KDEINST/lib/pkgconfig:$KDEINST/lib64/pkgconfig:$PKG_CONFIG_PATH
25# else kdelibs' config detection of strigi screws up
26
27Check these carefully before proceeding.
28
29env | grep FLAGS
30env | grep PATH
31env | grep XDG
32env | grep KDEINST
33
34The final installation will be placed in the directory $KDEINST.
35
36As a general comment, it is particularly important to read the output
37of the cmake runs (below), as these tell you of missing libraries that
38may screw up the build.  After a cmake run, you may want to install
39some supporting libs (through yast, etc) before re-running cmake.  The
40"rm -f CMakeCache.txt" ensures cmakes starts afresh.
41
42
43Getting the sources
44~~~~~~~~~~~~~~~~~~~
45
46  # note also that this assumes that the KDE 4.2 sources are
47  # acquired from the KDE trunk; that is, this is happening
48  # prior to the 4.2 release.
49
50  # note this takes ages, unless you are fortunate enough to have
51  # a gazigabit-per-second network connection
52  # checking out merely "trunk" is a really bad idea
53  # due to the enormous amount of unnecessary stuff fetched.
54  #
55  svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport trunk_kdesupport
56  svn co svn://anonsvn.kde.org/home/kde/trunk/KDE trunk_KDE
57
58  # This alone soaks up about 2.5GB of disk space.
59  # You'll also need to snarf a copy of qt-x11-opensource-src-4.4.3.tar.bz2
60  # (md5 = 00e00c6324d342a7b0d8653112b4f08c)
61
62
63Building Qt
64~~~~~~~~~~~
65
66First build qt-4.4.3 with QtDBus support and some other kind of
67support (can't remember what.  jpeg?).  These are both added by
68default provided the relevant packages are installed.  Check the Qt
69configure output to be sure.
70
71  bzip2 -dc qt-x11-opensource-src-4.4.3.tar.bz2 | tar xvf -
72  cd qt-x11-opensource-src-4.4.3
73
74  emacs mkspecs/common/g++.conf
75  # change QMAKE_CFLAGS_RELEASE and QMAKE_CFLAGS_DEBUG both to be -g -O
76
77  # optionally, in src/corelib/tools/qvector.h, for the defns of
78  # QVectorData and QVectorTypedData, change
79  #if defined(QT_ARCH_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) \
80      && defined(QT_BOOTSTRAPPED)
81  # to "if 1 || defined ..."
82  # twice (else get strange memcheck errors with QVector on ppc.  Not
83  # sure if this is a qt bug (possibly), a gcc bug (unlikely) or a
84  # valgrind bug (unlikely)).  I don't think this is necessary on x86
85  # or x86_64.
86
87  echo yes | ./configure -platform linux-g++-64 -prefix $KDEINST
88  # NB: change that to linux-g++-32 for a 32 bit build
89
90  # check configure output before proceeding, to ensure that
91  # qt will built with support for the following:
92  #
93  # QtDBus module ....... yes (run-time)
94  # GIF support ......... plugin
95  # TIFF support ........ plugin (system)
96  # JPEG support ........ plugin (system)
97  # PNG support ......... yes (system)
98  # MNG support ......... plugin (system)
99  # zlib support ........ system
100  # OpenSSL support ..... yes (run-time)
101  #
102  # If some of these are missing ("... no"), then it means you need
103  # to install the relevant supporting libs and redo the qt configure
104  # (make confclean, then redo configure)
105
106  make -j 2
107  make install
108  # this takes approx 1 hour on a dual processor 2.5GHz PPC970
109
110  # check that this installed correctly
111  # - qmake is in $KDEINST/bin and is linked against stuff in
112  #   $KDEINST/lib
113  # - ditto designer and linguist
114  # - check qmake, designer, linguist actually start up/run
115
116
117Building KDE
118~~~~~~~~~~~~
119
120The basic deal is
121
122for each package, use a separate source and build dir cd to the build
123dir (can be anything)
124
125then
126
127 # note that LIB_SUFFIX must be "" for 32 bit builds and "64" for 64 bit builds
128 rm -f CMakeCache.txt && cmake /path/to/source/tree/for/this/package -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
129
130 # check output, particularly that it has the right Qt
131 make
132 # make -j 2 quite often screws up
133 make install
134
135Packages should be built in the order:
136   kdesupport
137   kdelibs
138   kdepimlibs
139   kdebase-runtime
140   kdebase-workspace
141   kdebase
142
143This gives a working basic KDE.  Then build the rest in any order, perhaps:
144
145   kdegraphics
146   kdeadmin
147   kdeutils
148   kdenetwork
149   kdepim
150
151So the actual stuff to do is:
152
153   cd ~
154   mkdir build
155
156   cd build
157   mkdir kdesupport
158   cd kdesupport
159   rm -f CMakeCache.txt && cmake ~/trunk_kdesupport \
160      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
161      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
162   make -j 2
163   make install
164
165   cd ~/build
166   mkdir kdelibs
167   cd kdelibs
168   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdelibs \
169      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
170      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
171   make -j 2
172   make install
173
174   cd ~/build
175   mkdir kdepimlibs
176   cd kdepimlibs
177   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdepimlibs \
178      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
179      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
180   make -j 2
181   make install
182
183   cd ~/build
184   mkdir kdebase-runtime
185   cd kdebase-runtime
186   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdebase/runtime \
187      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
188      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
189   make -j 2
190   make install
191
192   cd ~/build
193   mkdir kdebase-workspace
194   cd kdebase-workspace
195   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdebase/workspace \
196         -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
197         -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
198   make -j 2
199   make install
200
201   cd ~/build
202   mkdir kdebase-apps
203   cd kdebase-apps
204   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdebase/apps \
205      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
206      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
207   make -j 2
208   make install
209
210   cd ~/build
211   mkdir kdegraphics
212   cd kdegraphics
213   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdegraphics \
214      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
215      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
216   make -j 2
217   make install
218
219   cd ~/build
220   mkdir kdeadmin
221   cd kdeadmin
222   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdeadmin \
223      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
224      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
225   make -j 2
226   make install
227
228   cd ~/build
229   mkdir kdeutils
230   cd kdeutils
231   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdeutils \
232      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
233      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
234   make -j 2
235   make install
236
237   cd ~/build
238   mkdir kdenetwork
239   cd kdenetwork
240   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdenetwork \
241      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
242      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
243   make -j 2
244   make install
245
246   cd ~/build
247   mkdir kdepim
248   cd kdepim
249   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdepim \
250      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
251      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
252   make -j 2
253   make install
254
255   cd ~/build
256   mkdir kdeartwork
257   cd kdeartwork
258   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdeartwork \
259      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
260      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
261   make -j 2
262   make install
263
264   cd ~/build
265   mkdir kdemultimedia
266   cd kdemultimedia
267   rm -f CMakeCache.txt && cmake ~/trunk_KDE/kdemultimedia \
268      -DCMAKE_INSTALL_PREFIX=$KDEINST -DCMAKE_BUILD_TYPE=debugfull \
269      -DLIB_SUFFIX=64 -DQT_QMAKE_EXECUTABLE=$KDEINST/bin/qmake
270   make -j 2
271   make install
272
273
274   # still todo: koffice, amarok ?
275
276
277Running KDE
278~~~~~~~~~~~
279
280Make sure dbus is running (pstree -p <myusername> | grep dbus)
281
282If not running:
283
284   eval `dbus-launch --auto-syntax`
285
286probably best to ensure there's only one instance, to avoid confusion
287
288You need PATH, LD_LIBRARY_PATH, XDG_DATA_DIRS and XDG_CONFIG_DIRS set as above
289
290Then run  startkde  in an xterm on the new X server
291
292