Guidelines and HOWTOs/Build from source
Build requirements
This section provides information about hard (required) and optional software packages needed to build the KDE Framework.
kdelibs dependencies
- deb-based distributions (Debian, Ubuntu...):
$ sudo apt-get build-dep qt4-x11; sudo apt-get install libbz2-dev libxslt-dev libxml2-dev shared-mime-info oxygen-icon-theme libgif-dev libvlc-dev libvlccore-dev doxygen
- OpenSuSE: All the necessary dependencies:
$ sudo zypper si -d libqt4 ; sudo zypper in libbz2-devel libxslt-devel libxml2-devel shared-mime-info oxygen-icon-theme giflib-devel vlc-devel doxygen
- Fedora: All the dependencies used for building kdelibs can be installed by running:
$ yum-builddep qt phonon-backend-vlc phonon-backend-gstreamer; yum install libbz2-devel libxslt-devel libxml2-devel shared-mime-info oxygen-icon-theme giflib-devel doxygen
Qt 5
To build all of qt5 execute:
$ git clone git://gitorious.org/qt/qt5.git --branch dev $ cd qt5 $ ./init-repository $ ./configure -prefix $PWD/qtbase -opensource -confirm-license -developer-build -nomake tests -nomake demos -nomake examples -dbus -no-separate-debug-info -xcb -qpa xcb -no-gtkstyle $ make
To update qt5 later:
$ git pull $ git submodule update
If you saw changes (i.e. qt5.git got updated since last time),
$ ./configure [...same as above...] $ make $ echo $? # you should make extra sure that 'make' didn't abort with an error, especially when using -j
Experimental and not officially supported: if you don't have enough time and disk space for all of qt5, you could restrict yourself to separate checkouts of qtbase.git, qtsvg.git and qtx11extras.git, this is enough to build kdelibs frameworks (but not enough for plasma-framework).
NOTE for ArchLinux users: qtwebkit uses python to generate some files, but it uses python2 syntax. So you have to either patch the qtwebkit code or make /usr/bin/python point to /usr/bin/python2. See also https://wiki.archlinux.org/index.php/Python
Runtime setup
To use your new KF5 install prefix (let's call it $KF5) :
export KF5=<path to your intended frameworks install directory> export QTDIR=<path to your qt5 sources>/qtbase export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg export PATH=$KF5/bin:$QTDIR/bin:$PATH export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH (lib64 instead of lib, on OpenSUSE and similar) export QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml
Note that LD_LIBRARY_PATH isn't set. You shouldn't set it, the builtin rpath works magic instead, and if you set it you'll have issues when running tools that use uninstalled libs while building kdelibs (e.g. meinproc, kconfig_compiler...)
To use separate user settings for KF5:
export XDG_DATA_HOME=$HOME/.local5 export XDG_CONFIG_HOME=$HOME/.config5 export XDG_CACHE_HOME=$HOME/.cache5
To be able to compile other stuff on top of KF5:
export CMAKE_PREFIX_PATH=$KF5:$CMAKE_PREFIX_PATH
To get more information out of qDebug statements (i.e. make it more like kDebug) :
export QT_MESSAGE_PATTERN='%{appname}(%{pid})/%{category} %{function}: %{message}'
or even better, to get colors:
c=`echo -e "\033"` export QT_MESSAGE_PATTERN="%{appname}(%{pid})/(%{category}) $c\[31m%{if-debug}$c\[34m%{endif}%{function}$c\[0m: %{message}" unset c
Don't bother with KDEDIR and KDEHOME etc. this stuff isn't used anymore.
Git remote prefix
Let's setup a "kde:" prefix for git commands. Add the following text to your ~/.gitconfig:
[url "git://anongit.kde.org/"] insteadOf = kde: [url "ssh://[email protected]/"] pushInsteadOf = kde:
Build KDE Frameworks and its dependencies
First you need kdesrc-build, it can be done with the following commands:
mkdir -p extragear/utils git clone kde:kdesrc-build extragear/utils/kdesrc-build ln -s extragear/utils/kdesrc-build/kdesrc-build .
At this point, download http://www.davidfaure.fr/kde/kf5-qt5-kdesrc-buildrc into your source dir, rename it to kdesrc-buildrc, adjust the paths and run ./kdesrc-build. It is the preferred way of building KDE Frameworks. Note that this script uses GIT and Bazaar to download the sources, so ensure you have both installed.
If you want you can also do the work by hands following the detailed instructions: Frameworks/Building/Details.
Running unit tests
Unit tests are ran from the build dir of kdelibs-frameworks, you should first cd into it.
You need a separate DBus session because the dbus server needs to have the right value of XDG_DATA_DIRS, in order to find $KF5/share/dbus-1/services for starting services (e.g. kded5).
eval `dbus-launch` kdeinit5 make test
Warning: never start a KDE4 application in this separate DBus session, it would conflict with your running KDE4 desktop.
If you want to publish your test results, instead of "make test" run
make Experimental
The test results will appear on http://my.cdash.org/index.php?project=kdelibs