Table of Contents
- Preparing the System to Build KDE
- Setting the Configuration Data
- Module Organization and selection
- Using the kdesrc-build script
- Setting the Environment to Run Your KDE Plasma Desktop
In this chapter, we show how to use the kdesrc-build to checkout modules from the KDE repository and build them. We also provide a basic explanation of the KDE source code structure and the steps you have to perform before running the script.
All topics present in this chapter are covered with even more detail in the Building KDE 4 from Source article, at the KDE TechBase site. If you are compiling KDE for the first time, it is a good idea to read it, or consult it as a reference source. You will find detailed information about packaging tools and requirements, common compilation pitfalls and strategies and information about running your new KDE installation.
It is recommended that you use a different user account to build, install, and run your KDE software from, since less permissions are required, and to avoid interfering with your distribution's packages. If you already have KDE packages installed, the best choice would be to create a different (dedicated) user to build and run the new KDE.
Leaving your system KDE untouched also allows you to have an emergency fallback in case a compiled KDE is unstable for whatever reason.
Later, you can do a system installation if you wish. This document does not cover a system installation. If you are performing a system wide install, you should already know what you are doing. If not, then you may want to consult the documentation, or help sites, for your distribution in order to prepare and use the system installation correctly.
Before using the kdesrc-build script (or any other building strategy) you must install the development tools and libraries needed for KDE. The nearly complete list of required tools can be found from the KDE TechBase Build Requirements page.
Here is a list of some of the things you will need:
You will need CMake. The required version will vary depending on what version of KDE 4 you are building, see TechBase for specifics, however a good bet is to have the most recent available version. CMake is the program used by kdesrc-build to handle the actual configuration and build steps for the vast majority of KDE software.
You must also install the client software used to checkout the KDE source code. This means you need at least the following:
Subversion, which used to be the only source code manager in use, and is still used for some modules with large data files. You can check if you have it by running
Although it is not required, the Bazaar source control manager is used for a single module (libdbusmenu-qt) that is required for the KDE libraries. Most users can install this library through their distribution packages but kdesrc-build supports building it as well if you desire. But to build libdbusmenu-qt, you must have Bazaar installed.
You will need a full C++ development environment. GCC 4.6 or later is recommended.
Finally, you will need a “make” tool. GNU Make is recommended and should be available through your package manager. After cmake has been run by kdesrc-build, make handles actually running the build process, which is why it is required.
Most operating system distributions include a method of easily installing required development tools. Consult the TechBase Getting Started page's “Required Packages from your Distribution” section to see if these instructions are already available.
One exception to the required libraries is the Qt™ library. kdesrc-build will normally install a copy of Qt™ whether you have it installed or not, so it is not necessary for you to have it. If you do not want to use the Qt™ copy, you need to do these things:
Make sure to remove the qt module from your configuration file, as you will not need it, and having it would add extra time to your build.
The qmake command might be called qmake4 or qmake-qt4 on your distribution.
If you do not already have Qt™ installed, install it, including any relevant -dev or -devel packages. You will need at least Qt™ 4.7 if you are building KDE 4.
Some of these packages are divided into libraries (or programs or utilities), and development packages. You will need at least the program or library and its development package. The libraries you need will change depending on the modules you intend to build, as each module has its own requirements. The KDE TechBase has more details about the specific tools and techniques used to install and find the required software.
You probably already have a version of the kdesrc-build script installed in your system. However, if you do not, you can download it from kdesrc-build home page, or you can find it from its home in the KDE source repository.
If you use a more recent kdesrc-build by downloading from its
website, you should remember to run the kdesrc-build script you downloaded.
You can use the
--version option to kdesrc-build as a quick
way to verify this.
To download kdesrc-build from its home page, simply go to the kdesrc-build home page and download the latest appropriate release. The release is packaged as a compressed tarball archive, which you can extract using Ark or tar. The contents of the archive include the actual kdesrc-build script, a sample configuration file (
kdesrc-buildrc-sample), and a quick-setup program.
Or, you can obtain kdesrc-build from its source repository, by running:
with the directory you would like to install to.
No matter which technique you use, you need to make sure that the
kdesrc-build file is executable. For convenience you
should make sure it is in a directory contained in the
environment variable, otherwise you may get messages saying that the command
was not found, or you may run a previously-installed version by mistake.
kdesrc-build uses a configuration
file (located at
~/.kdesrc-buildrc) to control
which modules are built, where they are installed to, etc.
You can use a program included with kdesrc-build, called
kdesrc-build-setup in order to prepare a simple
kdesrc-build configuration. You can then edit the
~/.kdesrc-buildrc from there to make any changes you see
kdesrc-build-setup itself runs from a terminal (instead of using a graphical interface), just like kdesrc-build, so you can use it even if you have no graphical interface available yet.
You can use the included
sample configuration to get explanations as to the various options available.
You can find more information about the syntax of the configuration file in the section called “Setting the Configuration Data” and in Chapter 4, Configuring kdesrc-build.