Guidelines and HOWTOs/Build from source

From KDE Community Wiki
Revision as of 23:06, 23 May 2013 by Dfaure (talk | contribs) (it's not html)

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 libqt4; sudo apt-get install libxslt-dev libxml2-dev shared-mime-info oxygen-icon-theme
  • OpenSuSE: All the necessary dependencies:
$ sudo zypper si -d libqt4 ; sudo zypper in libxslt-devel libxml2-devel shared-mime-info oxygen-icon-theme
  • Fedora: All the dependencies used for building kdelibs can be installed by running:
$ yum-builddep libqt4; yum install libxslt-devel libxml2-devel shared-mime-info oxygen-icon-theme

Qt 5

To build all of qt5 execute:

 $ git clone git://gitorious.org/qt/qt5.git --branch dev
 $ cd qt5
 $ git submodule init && git submodule update
 $ mkdir build
 $ cd build
 $ ../configure -prefix $KF5 -opensource -confirm-license -nomake tests -nomake demos -nomake examples -xcb -qpa xcb -no-gtkstyle
 $ make
 $ make install

To update qt5 later:

 $ git pull
 $ git submodule update

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: to ensure you have the same stuff as everyone else, you should check out c002a2742 in qtbase.git rather than latest dev).

NOTE: currently (May 2013), the dev branch points to a non-existent repository (qtwebkit-examples-and-demos). You can fix this by editing .gitmodules (before you run ./init-repository) and replacing

 url = git://gitorious.org/qt/qtwebkit-examples-and-demos.git

with

 url = git://gitorious.org/qt/qtwebkit-examples.git

NOTE for ArchLinux users: qtwebkit uses python to generate some files, but it uses python2 syntax. So if you have installed python3, you'll get a compilation error on the file itab.py bevause print is no longer a statement, but a function. So, you would like to make /usr/bin/python to point to /usr/bin/python2. See also https://wiki.archlinux.org/index.php/Python

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

At this point you can continue building things by hand, or download http://www.davidfaure.fr/kde/kf5-qt5-kdesrc-buildrc into your source dir, adjust the paths and run kdesrc-build. It is the preferred way of building KDE Frameworks.

If you want you can also do the work by hands following the detailed instructions: Frameworks/Building/Details.

Runtime setup

To use your new KF5 install prefix (let's call it $KF5) :

export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS
export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS
export PATH=$KF5/bin:$PATH
export LD_LIBRARY_PATH=$KF5/lib:$QTDIR/lib:$LD_LIBRARY_PATH
   (lib64 instead of lib, on OpenSUSE and similar)
export QT_PLUGIN_PATH=$KF5/lib/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
   (lib64 instead of lib, on OpenSUSE and similar)
export QML2_IMPORT_PATH=$KF5/lib/qml

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}'

Don't bother with KDEDIR and KDEHOME etc. this stuff isn't used anymore.

Running unit tests

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