Scripted KDE Builds (kdesrc-build)
The easiest way to build the KDE Software Compilation (SC) from scratch is to run a script named kdesrc-build (formerly kdesvn-build), written by Michael Pyne. This approach is highly recommended for those new to building the KDE SC, because it takes care of almost the whole process for you. The builds remain compatible with the manual methods of building KDE SC, so you can change the modules you install later if you want.
kdesrc-build automates the following tasks and more:
- Performing the initial checkout
- Handling updates for modules that are already checked out
- Setting up the build system for the module
- Performing the build and install
- Specifying your CMake options or configure flags (so you don't have to remember them every time)
- Logging build errors so you can review them more easily for troubleshooting
This is not the be all and end all for your troubles building the KDE SC. Troubleshooting may still be required. Many errors that occur using other methods occur here too: you should read the log files that are stored for you.
Useful links for finding modules
These subsections cover all the things you need to get and install kdesrc-build itself.
kdesrc-build requires Perl 5.8 or higher. It is installed by default with most distributions, and is included in the previous link. Check your version of Perl with:
Downloading and installing kdesrc-build
Once your system is set up and able to compile the KDE SC, you can download kdesrc-build from its website, http://kdesrc-build.kde.org. The file you download will contain (at least) the kdesrc-build script and a sample configuration file.ut Installing kdesrc-build is as simple as saving the file and making it executable. If you'd like, you can move it to a directory in your PATH, however for this example we'll put it into the KDE SC source directory that we use (~/kdesrc).
Alternatively, the newest kdesrc-build script (and sample config file) can be pulled down directly using git:
Configuration options for kdesrc-build are taken from a file named ~/.kdesrc-buildrc. Directions for editing this file are at:
Note that the config file name begins with a leading dot (.), making it a hidden file. If you are using Dolphin or Konqueror from the desktop, you may need to show hidden files in order to find the configuration file and edit it. Alternatively, you can edit the sample file before copying it to ~/.kdesrc-buildrc.
Modules are built in the order they appear in your ~/.kdesrc-buildrc file, so the first module should be qt-copy. kdesupport should be before kdelibs, which should be before any other KDE SC module, and so on.
The sample configuration file does include these modules by default. So you won't need to make many changes unless you'd like to add some modules to the build by uncommenting them.
If a module you'd like to build isn't already present, simply add the following to the end of the ~/.kdesrc-buildrc:
module module-name end modulemodule-name is whatever the module is called in the software repository (for instance, kdemultimedia).
module kdelibs make-install-prefix sudo -S # sudo with no stdin end module module kdebase make-install-prefix sudo -S end module
Most of the KDE SC modules are in git, although a few of them still need to be ported from svn to git. Eventually, all KDE SC modules and projects will be in git.
To build these modules in kdesrc-build, you just need to add a couple of lines to the module configuration. For example, konversation is developed in the Git repository at:
So to add this module, write the following at the end of ~/.kdesrc-buildrc:
module konversation repository git://anongit.kde.org/konversation branch master end module
In this case I selected the "master" branch since that is the default git branch.
Now whenever you build konversation, kdesrc-build will use git instead of Subversion.
Useful kdesrc-build commands
|--pretend ()||This option is like a dry run. kdesrc-build will process the options and its configuration like normal, and run through the build as normal, but instead of downloading or running the build it will just print messages about what it would have done. You should always run with -p before running the script for real, to make sure it is doing what you expect.|
|--nosvn (--no-src)||This option skips the source code update step. This is useful if you're running kdesrc-build again soon after a previous update and don't want to wait just to find out there were no changes.|
|--refresh-build||This option causes kdesrc-build to delete the current build information for the modules given on the command line and build them again from scratch. This option adds a lot of time but offers the best chance of a successful build.|
Assuming you got enough of the modules to build and install to have a working KDE SC installation, you'll still need to set up your environment correctly to run it. kdesrc-build doesn't help you out here (yet), so you should follow the instructions at:
Make sure to use the same paths as the ones you defined in ~/.kdesrc-buildrc. For the KDEDIRS and KDEDIR variables, use the setting of the "prefix" option (in the global section). For the QTDIR variable, use the setting of the "qtdir" option.
Keeping your KDE installation up to date is as simple as running kdesrc-build again. Every build has these phases:
- Update the source code for all modules being built.
- Build and then install all the modules.
Old build directories are not deleted by default, so the build after a small update will not normally take as long as the initial build of a module. This is called "incremental make". However it may be necessary at times to perform a full rebuild, due to inconsistencies between the build directory configuration and changes to the source directory. You can use the --refresh-build option to force a full rebuild.
For more information on how to take advantage of kdesrc-build, see the documentation at:
The site describes all of the module options and command line options available for kdesrc-build and gives tips on how to perform various useful tasks.