Guidelines and HOWTOs/Build from source: Difference between revisions

From KDE Community Wiki
m (fix formatting)
(remove workaround, not needed anymore)
Line 79: Line 79:


This is experimental and not the recommended way to contribute to KDE Frameworks at this point.
This is experimental and not the recommended way to contribute to KDE Frameworks at this point.
Currently, Q_EXPORT_PLUGIN2 breaks compilation, so a workaround is to use a Qt 5 version from before these changes (git checkout 9ca509676f3e7a4c19a) or remove the Q_STATIC_ASSERT_X from src/corelib/plugin/qplugin.h


Make sure to pass -DQT5_BUILD=TRUE to cmake.
Make sure to pass -DQT5_BUILD=TRUE to cmake.

Revision as of 21:16, 28 June 2012

Build requirements

This section provides information about hard (required) and optional software packages needed to build the KDE Framework.

Kdelibs packages

  • deb-based distributions (Debian, Ubuntu...): All the dependencies used for the packages can be installed by running
$ apt-get build-dep {packagename}
  • for instance on Ubuntu:
$ sudo apt-get build-dep kdelibs5
  • OpenSuSE: All the dependencies used for building kdelibs can be installed by running:
$ zypper si -d kdelibs5
  • Fedora: All the dependencies used for building kdelibs can be installed by running:
$ yum-builddep kdelibs5

CMake 2.8.8

You need CMake 2.8.8 for KDE Frameworks 5. If you are already using 2.8.8 you can move on to next step else download it from http://www.cmake.org/cmake/resources/software.html.

Alternative for CMake 2.8.8 using Git.

  • Choose an install prefix, for instance
 $ export KF5=$HOME/kf5

To avoid repetition of command you can append ~/.bashrc file with above line and execute,

 $ source ~/.bashrc  
  • Checkout and install Latest version of CMake using Git.
 $ git clone git://cmake.org/cmake.git
 $ cd cmake
 $ ./configure --prefix $KF5
 $ make
 $ make install

Extra CMake Modules

  • Checkout and build extra-cmake-modules
 $ git clone git://anongit.kde.org/extra-cmake-modules
 $ cd extra-cmake-modules
 $ cmake -DCMAKE_INSTALL_PREFIX=$KF5 . 
 $ make 
 $ make install

Build KDE frameworks

Current state of KDE framework exist in frameworks branch of kdelibs.

To retrieve the source code from Git you have to use the following setup.Add the following text to your ~/.gitconfig:

 [url "git://anongit.kde.org/"]
    insteadOf = kde:
 [url "ssh://[email protected]/"]
    pushInsteadOf = kde:

Then execute

 $ git clone kde:kdelibs
 $ cd kdelibs
 $ git checkout frameworks
 $ mkdir build 
 $ cd build
 $ cmake -DCMAKE_INSTALL_PREFIX=$KF5 -DKDE4_BUILD_TESTS=TRUE ..
 $ make
 $ make install

Updating the already built framework. If the source code has been checked from a branch, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.

Go to your source directory and execute following commands.

 $ git pull --rebase
 $ cd build
 $ make
 $ make install

Running unit tests

eval `dbus-launch`
kdeinit5
make test

Building KDE frameworks with Qt 5

This is experimental and not the recommended way to contribute to KDE Frameworks at this point.

Make sure to pass -DQT5_BUILD=TRUE to cmake.