by Ralinx
(Transferred from Wiki by Peter)

With this document, u will be able to build KDE 3.0 from source in a higly optimised way. Installing KDE from source is really easy, but it will take some time depending on ur hardware. I'm gonna be using objprelinking in this PET, and for some people this may lead to unstable results so u have to decide for urselft if u want the objprelinking or not. One more thing, i will _not_ discuss all the possible dependencies for KDE and how to build them. Most of the time, ur distro already has those libraries installed and if not, they're not hard to install by urself. The configure scripts for KDE will always show u a clear message if ur missing a library that might be usefull. However, since many of these dependencies aren't really necessary the configure script will only stop when ur really missing an important one (duh). But the extra dependencies can make KDE even better (like CUPS for instance.. it's not required, but when installed KDE will provide u with an excellent printing system that supports CUPS). And finally, i will be using gcc 2.95.3 to build this. I do not know how gcc 3.x will handle it but i've heard it doesnt compile everything from KDE without problems. My advice is to wait as long as possible to use gcc 3.x

Ok, here we go... we'll start with the objprelinking so those of u who won't be using it can skip this step (BTW, objprelinking only works on x86 so if ur using something else, do not use objprelinking)

gunzip objprelink.c.gz
  • to compile the file do this:

gcc -o objprelink -O2 objprelink.c /usr/lib/libbfd.a /usr/lib/libiberty.a
  • now u have the objprelink binary. put it in /usr/bin

  • let's download the source code for KDE 3.0 get it over here: (actually, check to see if u can find a mirror near ur location) the following files are required: arts-1.0.0.tar.bz2kdebase-3.0.tar.bz2 kdelibs-3.0.tar.bz2 qt-copy-3.0.3.tar.bz2

  • all the rest is optional so get them if u want, or only get the ones u want or... just do whatever the hell u wanna do

  • for those who don't know, u can untar these file by using the following commands:

tar jxvf arts-1.0.0.tar.bz2
  • or if the -j option doesn't work with your tar do this:

bzcat arts-1.0.0.tar.bz2 | tar xvf -
  • if u want some extra optimisation, set the CFLAGS and CXXFLAGS environment variables like this:

export CFLAGS="-O3 -march=i686"
u can replace i686 with ur architecture of course...
  • now, we will compile QT 3.0.3 To use objprelinking, it's best to use the qt that comes with the KDE 3.0 source because it's been changed a little bit to make it easier to use objprelinking. The QT that u can download from the original trolltech ftp does not have the ability to easily enable objprelinking.

  • unpack qt, rename the resulting dir to qt and put it in /usr/localnext, u'll have to set some environment variables. it might be best to just add the following lines to ur ~/.bash_profile or ~/.bashrc or whatever...

  • now, for those of u who want an objprelinked QT do this in the qt dir:

./configure -shared -sm -thread -qt-gif \
-system-libpng -system-libmng -system-zlib \
-system-libjpeg -xft -no-g++-exceptions  \
-platform linux-g++-objprelink
  • for those who don't want objprelinking do this in the qt dir:

./configure -shared -sm -thread -qt-gif \
-system-libpng -system-libmng -system-zlib \
-system-libjpeg -xft no-g++-exceptions
  • when that finishes (and it will take some time) execute this:

make symlinks sub-src sub-tools
  • after that, ur QT is installed. no need to run make install or anything like that

  • now, we'll start on KDE. The installation instructions for every package of KDE u downloaded can be exactly the same. So i'll only put the instruction in here once, but i'll tell u the order in which u have to compile them. The commands to install the packages are:

./configure --enable-final --disable-debug \
--enable-objprelink --prefix=/usr/local/kde3.0 \
--with-gnu-ld && make && make install
  • if u don't want objprelinking use the following commands:

./configure --enable-final --disable-debug \ 
--prefix=/usr/local/kde3.0 --with-gnu-ld && \
make && make install
  • the order in which u have to install the packages goes like this:

  • after these 3, u can install any kdepackage u want, in any order u want.

  • so to install these packages, just unpack them and execute the above commands inside the directory of each package

  • When ur done installing these packages, u can safely delete the directories containing the source. Also, be sure to add /usr/local/kde3.0/bin to ur PATH.

  • after all this u probably wanna actually run KDE huh? well this can be accomplished by putting the following in ur ~/.xinitrc:

exec startkde
  • and if u wanna be able to run KDM (the KDE graphical login manager) u'll have to create a ~/.xsession file. I just symlink that file to ~/.xinitrc though. Then u'll have to make sure KDM boots up automatically. This is very distro dependend so if u wanna do that, find out what distro ur using and do it urself. U just need to execute /usr/local/kde3.0/bin/kdm somewhere in ur bootscripts.

That's it. any comments/questions/suggestions can be mailed to