Home Wiki > openSUSE:KDE developers guide
Sign up | Login

(Redirected from KDE/Developing/Guide)

openSUSE:KDE developers guide

tagline: From openSUSE

Build Guide for KDE on openSUSE

Building KDE trunk

Why use this guide? The KDE team at openSUSE are a group of fanatical KDE developers who work hard to make it easy to use and develop KDE on openSUSE. By using our precompiled packages accessible via One Click Install, you can cut out the hassle of building qt-copy, or other KDE support libraries like Akonadi, Phonon, Soprano or QCA2. Since we are very close to the KDE release team, our packages include all the patches KDE trunk needs and are always up to date. This saves you time and effort in tracking the latest innovations as KDE moves towards KDE 4.2 (at the time of writing).

This guide does not use a magic build script to do everything for you. Instead it shows you how to build KDE by hand with a few easy steps and a couple of simple helpers to prevent mistakes.

The following instructions show you how to build KDE 4 SVN trunk on openSUSE 11.0 or 10.3. They don't assume any prerequisites besides a freshly installed openSUSE.


Install software needed to build KDE 4

  • Ensure the online community repositories are enabled.

FIXME: These instructions are outdated and need to be updated for 11.3, 11.4 and 12.0

Version: 11.2Open YaST, go to Software, Software Repositories. Click Add. Select 'Community Repositories'. Click Next. Make sure that 'Main Repository OSS' is checked. Click Finish.
Version: 11.1Open YaST, go to Software, Software Repositories. Click Add. Select 'Community Repositories'. Click Next. Make sure that 'Main Repository OSS' is checked. Click Finish.
Version: 11.0Open YaST, go to Software, Software Repositories. Click Add. Select 'Community Repositories'. Click Next. Make sure that 'Main Repository OSS' is checked. Click Finish.
  • Install the packages required for general KDE development: Open the Software Management module of YaST2 and select Patterns in the Filter combo box. Scroll down to the Development section and select 'KDE Development'. Click Accept.
  • Install the KDE 4 development prerequisites: These are located in the openSUSE Build Service. You can install them using One Click Install. (All this *very nice* guide will mesh your current system with unstable packages...)

FIXME: These links do not work and it appears the developers have changed the paradigm and/or no longer support One Click Installs for releases after the release of openSuSE 11.3.

Version: 11.2Kde4-ymp.png KDE trunk build dependencies for 11.2
Version: 11.1Kde4-ymp.png KDE trunk build dependencies for 11.1
Version: 11.0Kde4-ymp.png KDE trunk build dependencies for 11.0
  • Install optional dependencies. These packages are not strictly needed to build KDE 4, and give optional functionality:
    • libjasper-devel : used for the JPEG2000 image format.
    • enchant-devel : a spell checking library abstraction, used by Sonnet
    • OpenEXR-devel : access images in EXR format.
    • libraw1394-devel : used to show FireWire devices in KInfoCenter
    • pciutils-devel : used to show information on PCI devices in KInfoCenter
    • cyrus-sasl-devel: Needed to support authentication of logins
    • openldap2-devel: Needed to provide LDAP functionality in KDE

If you are tired of the Software Management YaST module already, just use

zypper in libjasper-devel enchant-devel OpenEXR-devel libraw1394-devel pciutils-devel cyrus-sasl-devel openldap2-devel

as root in a shell.

FIXME: actually, there is three other packages, which now required for building kdelibs : DocBook XML, DocBook XSL, and DBusMenuQt

As of openSuSE11.4 these packages described in the above FIXME note do not exist, so this FIXME needs to be further updated as well.

Setup a build environment for KDE trunk

The environment is a set of shell variables that specify where to find the tools and libraries you installed in the previous step, and sets where KDE trunk is to be installed. KDE and openSUSE have provided a set of scripts that set up the environment for building KDE trunk, and for running it:

FIXME: The following links are broken, please repair them! Without these scripts the rest of the instructions on this web page are rendered useless!

Save these scripts somewhere handy. You may want to edit them to suit your system. By default they put everything in $HOME/kde - sources, builds and the installed KDE 4. If you want more than one user to use this hand-built KDE4, a more central location is more appropriate. The storage requirements for a KDE development build (on i586, with gcc 4.2) are

  • source - libs, pimlibs, base: 682Mb
  • build - libs, pimlibs, base: 3.8Gb
  • install - libs, pimlibs, base 1.6Gb

These numbers are so large because of the size overhead of building with full debugging symbols.

If you edit the variables, the ones you are most likely to change are KDE_DEVEL_PREFIX in kde4-build-env and KDE_INSTALL_PREFIX in kde4-run-env. Note also that these scripts set KDEHOME to $HOME/.kde4, so that KDE 4 applications will not overwrite KDE 3 applications' settings. You may change compiler and linker flags such as CFLAGS, CXXFLAGS and LDFLAGS using environment variables as normal.

When you have customised the scripts to meet your needs, source the build script into your current environment (The build script sources the runtime script internally) :

. kde4-build-env

Yes, that's a full stop or period character on its own.

Obtain the KDE 4 SVN trunk sources

As you are probably not a KDE developer with an account on the GIT server, we use the anonymous GIT mirrors for public access to download the KDE 4 trunk sources.

First, set up your GIT client

cd
cat >.gitconfig<<EOF
[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "ssh://git@git.kde.org/"]
    pushInsteadOf = kde:
EOF

switch to the source directory:

cd ~/kde/sources

Next, change into the root you just checked out:

mkdir trunk
cd trunk
mkdir KDE
cd KDE
git clone kde:kdelibs
git clone kde:kdepimlibs
git clone kde:kdebase

FIXME! The repository for kde:kdebase is not available and the git command to clone it gives the following error:

Cloning into kdebase... fatal: The remote end hung up unexpectedly

Please fix ASAP.


kdelibs are the basic libraries comprising the KDE Platform. kdepimlibs are specialized libraries for Personal Information Management, and are also required. The last mandatory component, kdebase, contains the basic runtime elements of KDE as well as the programs that make up the workspace such as Plasma.

Build KDE trunk

We're now ready to begin the build process. If you have more than one Linux computer you may want to take a detour to the Icecream build farm page, because Icecream, a distributed build system developed by SUSE, can reduce the time it takes to build a large project like KDE 4 enormously.

Change into the kdelibs source tree:

cs KDE/kdelibs

'cs' is a shell function defined in in kde4-build-env which stands for 'Change [To] Sources'. It won't work unless you sourced kde4-build-env already. Without any argument it takes you to the root of the KDE sources tree.

And start the build:

cmakekde

While kdelibs build, you could look at kde4-build-env to see what cmakekde does. Basically it switches you to the build dir, creating it if needed, sets up the build system ('cmake' is the equivalent of the well known './configure' here), builds and, all being well, installs the result. Once you have run cmakekde once, you can also just use 'make -j2 install'.

When kdelibs has built, repeat the process, in order, for kdepimlibs and kdebase:

cs KDE/kdepimlibs
cmakekde
cs KDE/kdebase
cmakekde

If something goes wrong

Remember you are using KDE 4 trunk - what will become KDE 4.2. There is no guarantee that it will build at any given time. You can check the KDE Dashboard, an automated service that frequently rebuilds KDE 4 from scratch to check for errors. If a module won't build, but is green in Dashboard, check that you have at least that version of trunk in your working copy (svn up $MODULENAME in sources/trunk/KDE). If that doesn't help, 'make clean' in that module to clean out old built code and make again. If all else fails, try #opensuse-kde or #kde-devel on FreeNode for help.

Running KDE trunk

You can start KDE trunk in two ways; by hand from a text console, or as usual via KDM or any other display manager. We'll go briefly over the manual method first, as this can help troubleshooting when the easier KDM route fails.

Important

kde4-run-kde sets KDEHOME to ~/.kde4 . If you run KDE3 apps in this environment, they will also save their data and config to KDEHOME. This is not supported. Before running a KDE 3 app, unset KDEHOME or clean the environment entirely, for example, with su - youruser.

Starting a KDE 4 session manually

  • Switch to a text console:
 <ctrl> <alt> <F1>
  • Login
  • Setup the KDE4 runtime environment
. kde4-run-env
  • Start the DBus session. DBus is normally started automatically for you by the display manager.
eval `dbus-launch --auto-syntax`
  • Start the X server.
export DISPLAY=:1
X -novtswitch $DISPLAY
  • Start KDE 4
startkde
  • Lastly, switch to the X server. KDE 4 will be starting up - the first start takes some time as the system configuration cache has to be created from scratch - and after the splash screen disappears, you should see the familiar Plasma desktop
 <ctrl> <alt> <F8>

Using a display manager to start KDE 4

We've provided a pair of files that you will need to install to your system to tell the display manager how to start KDE 4.

  • kde4-svn-trunk.desktop - save this in /usr/share/xsessions .
  • kde4-launch - edit this so it sources kde4-run-env from where you saved it, then save it in /usr/local/bin and make it executable:
chmod 755 /usr/local/bin/kde4-launch

Once you've followed these steps, start a new session (K Menu->Leave->Switch User) and "KDE 4 SVN Trunk" will be selectable in the Session Type menu.

If you get a KDE 3 session after logging in from the display manager, you didn't read the bit about editing kde4-launch above.

Next steps

Build more modules

So far you only checked out and built the minimal set of KDE modules. To get a useful desktop you will have to checkout other modules. You can see the other modules by switching into sources/trunk/KDE and doing a

svn ls

kdegraphics, kdemultimedia, kdepim, kdenetwork are some of the more important modules. To get amarok or digikam, in sources/trunk, svn up extragear/multimedia or extragear/graphics.

Stay up to date

E.g. with kdelibs

cs KDE
cd kdelibs
git pull

Useful Resources

FIXME: Many of the following links are broken or point to incomplete pages, please repair them!