THIS DOCUMENT DESCRIBES HOW YOU CAN COMPILE KDE WHEN USING SVN

(A HOWTO for setting up a KDE4 development environment can be found here:
http://edu.kde.org/development/port2kde4.php )

What you need
==================

Make sure you get the following stuff from SVN:

  * qt-copy (currently a snapshot of qt-4.x)
  * kdelibs
  * kdebase (strongly recommended but not strictly necessary)
  * any other package you are interested in

It is important that you compile AND INSTALL the above packages in the above
order.

Further you will need GNU make, a working C++ compiler (e.g. gcc 3.3.x or later) and CMake 2.4.1 or later 

Preparations
==================

Before you start you must decide two things:

1) Where do you want to have Qt installed? Qt is a bit lame in that it
basically installs itself in its own source-tree, but symlinks are your friend.
E.g you could link /usr/local/lib/qt4 to where you keep your Qt source. Qt libs
then end up in /usr/local/lib/qt4/lib.

2) Where do you want to have KDE installed. A good candidate is /usr/local/kde4

Make sure you do (if using sh, ksh, or bash):

export KDEDIR=/usr/local/kde4

With csh or tcsh the following is more appropriate:

setenv KDEDIR /usr/local/kde4

Now you want to make sure that Qt and KDE libraries are picked up correctly.

On systems that respond to environment variables something similar to the
following is appropriate:

export LD_LIBRARY_PATH=$KDEDIR/lib:$QTDIR/lib

On systems whose diety of choice is ldconfig, try:

ldconfig -m $KDEDIR/lib
ldconfig -m $QTDIR/lib

You probably also want to add $KDEDIR/bin and $QTDIR/bin to your path.

For configuring Qt, the magic sequence is:

./configure -system-zlib -qt-gif -system-libjpeg -system-libpng -no-exceptions -debug -fast
make

Installing CMake:

Get the latest version of CMake from http://www.cmake.org/
unpack, run "./configure && make && make install" will install into /usr/local.

Ensure cmake is in your $PATH.

Compiling KDE
==================

Use a separate builddir to build KDE modules, not the sourcedir (example below).

To get regular debugging, pass -DCMAKE_BUILD_TYPE=debug
To get full debugging, pass -DCMAKE_BUILD_TYPE=debugfull

If something hasn't been found, use "cd builddir; ccmake sourcedir" to set the
missing (or wrong) things manually.

Short example:
mkdir build-kdelibs
cd build-kdelibs
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/kde4 -DCMAKE_BUILD_TYPE=debugfull /path/to/kdelibs/sources
make
make install

CMake documentation:
-read the cmake manpage
-visit http://www.cmake.org/HTML/Documentation.html and go through the
 contents you find there, start with "Writing CMakeLists.txt".
-visit the cmake wiki at http://www.cmake.org/Wiki/CMake, it contains
 a lot of useful information.

Common problems
==================

One of the biggest problems is picking up the correct version of Qt, especially
if your system has more version of Qt installed. Be aware that information
about library paths gets saved in the "CMakeCache.txt" file.
So it can be that after some struggle to get QTDIR/KDEDIR setup correctly your
setup is actually correct, but old -incorrect- settings are still lying around.

First, double check LD_LIBRARY_PATH points first to $QTDIR/lib

If its correct, the best thing to do in such a case is to use the svn-clean 
script available in kdesdk/scripts . This removes all files which aren't stored
in SVN. You can then start all over again. WARNING: Make sure you don't have any
important files lying around in your source tree any more, they will be deleted!

Problems?

See http://www.kde.org/compilationfaq.html for common build problems and their
solution.

If you encounter _LINK_ problems you are probably doing something wrong. Do a
"svn-clean" and start from scratch, usually this solves the problem.

If you encounter missing include files, especially if the files start with a
'q', you probably have not setup your QTDIR correct or have the wrong version
of Qt.

If you encounter compile errors after updating from SVN, check whether you need
to update kdelibs as well. If the problems persists, wait a few hours, usually
compile errors are fixed shortly after they have been introduced.

If you still have problems read the kde-devel@kde.org mailinglist and/or post
your problem there. You can subscribe by sending mail to
kde-devel-request@kde.org with "subscribe" in the subject.

Have fun!

Cheers,
Waldo Bastian and other KDE developers
