|Note: This page is about KDE 4. It isn't applicable for KDE 3 development.|
|This section needs improvements: Please help us to
cleanup confusing sections and fix sections which contain a todo
This step-by-step tutorial shows how to get the current kdelibs from the upcoming KDE4 based on Qt4 compiled under Microsoft Windows.
This is an installer that lets you easily install all the requirements for building kdelibs. It also has a list of tools in its list that are helpful and needed, like the mingw compiler suite, subversion clients, debugging tools and so on.
The kdewin-installer is available in a GUI and console-only form from: the kdewin-installer download page.
For the GUI version: After the application started you'll see a tree of all available packages on the right side. In that tree select kdesupport-mingw and win32libs in the All category under the dependecies subtree. This should select all packages that are needed to build kdelibs.
You can select another installation directory if you want. I suggest to choose one that has no spaces in it for now, as it seems some parts of the kde4 buildsystem have problems with that
Additionally you might want to select the MinGW, cmake, TortoiseSVN, mingw-utils and zip package from the tools tree if you haven't already installed those. TortoiseSVN lets you checkout kde4 from subversion, cmake is a required buildtool and mingw contains the compiler.
After clicking on Finish the installer will install the packages. For mingw, cmake and tortoise it only downloads and starts an installer executable so expect more installation dialogs from those.
The next step is setting up a proper environment to build KDE4 applications. This includes setting the PATH variable and some additional variables needed for CMake and running KDE applications.
Open up the control panel and select the System Entry. The go to the Extended tab and select Environment Variables.
In the section titled user variables add the following entries. I'm using D:\andreas\win32libs as the installation directory from the kdewin-installer and for CMake, D:\andreas\mingw as the path to the MinGW compiler and D:\andreas\kde4\install as the path where all kde4 modules will be installed to. Obviously you have to change the actual values to suite your system.
DBUSDIR=D:\andreas\win32libs KDEDIRS=D:\andreas\kde4\install;D:\andreas\win32libs KDEWIN_DIR=D:\andreas\win32libs PATH=D:\andreas\win32libs\bin;D:\andreas\kde4\install\bin; D:\andreas\kde4\install\lib;D:\andreas\mingw\bin QT_PLUGIN_PATH=D:\andreas\kde4\install\lib\kde4\plugins; D:\andreas\win32libs\plugins STRIGI_HOME=D:\andreas\win32libs XDG_DATA_DIRS=D:\andreas\win32libs\share;D:\andreas\kde4\install\share
Then click Ok on all open dialogs.
Now that all requirements are installed and the environment variables are set you can checkout the kdelibs module from
svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibsinto a directory.
Afterwards create a new subdirectory inside the kdelibs source directory named build. Then open a command console, select Start->Run Command and type cmd into the field. Then navigate to the just created build directory.
The next step is running CMake. For an easy start just run (I'm using the installation directory that I set in the environment variables section):
cmake -G "MinGW Makefiles" \ -DCMAKE_INSTALL_PREFIX=D:\andreas\kde4\install
If this complains about missing packages that you know you installed via the installer add the following to the command (I'm using the same directories as above for the environment variables):
You can set other CMake variables in the same way, also interesting might be to create a debug build. This can be achieved by using CMAKE_BUILD_TYPE=Debug.
Now you can let MinGW build and install the module by issuing
mingw32-make mingw32-make install
This will take some time.
The process for building other modules that contain applications that are of interest for you is the same as the process you've just done for kdelibs. There might be additional requirements for some KDE4 modules that you have to build first, in particular kdebase might be required (which in turn requires kdepimlibs).
This can be done from the same command window where you've built KDE4. Just type the application name and hit enter. This should automatically start all kde4 daemons and dbus which are required to run for kde4 applications.
For example after building and installing both kdevplatform and kdevelop module the KDevelop4 IDE can be started by executing kdevelop.