Determine Your Needs

KDE versions are split into branches off of the Trunk. The steps to build most branches are very similar. However, Each branch has different prerequisites.

Version

For production use, we recommend using a stable "branch" version of KDE. If you just want to use KDE, take a look at http://userbase.kde.org/. If you are developing applications, your distribution's dev packages and the kde-sdk may work. If your distribution does not have KDE you'll need to build it yourself.

If you want to hack at KDE's core modules, you'll need to build it, and TRUNK is the main branch where new features (and prerequisites) are added, however it can be difficult to keep up with.

Gather Prerequisites

Your build will fail if you are missing one of them, and the list changes. There are some options, however the make system can often find optional packages even if you do not intend to use them, so you may need to pass disable options.

Location

It is possible to install KDE in a variety of ways. Instructions should be listed with each build method, however much is common between methods and reading all may be requied.

development user home

This is a common way to do it so that it does not interefere with your production user and the rest of the system. A common user name is kde-devel. This is recommended for the cautious testers and developers. You can still use scripts to switch between system and regular.

your home directory

Useful on development machines, or if you have no other access to the machine, however it can be confusing to set environment variables, There are some scripts to help you use it. And there is not guarantee the code won't eat your personal data.

system-wide

on development builds, do it to test KDM and other system level KDE functionality. Obviously desired for production use. If you are just testing KDM, you may want to use a virtual machine so you do not damage a production system.

Method

Regardless of method chosen, reading up on the manual steps below will be very helpful.
CMake may also be of interest.

distribution specific

There may be pre-made builds for your distribution, For example, in Kubuntu, Project Neon, aims to provide a recent trunk build environment, and PPA's provide latest branch versions.

Troubleshooting the build

Compile and Linking errors are frequent sources of discouragement. make careful note of the first occurrence of an error in your build process. It could be as simple as a bad environment variable, an unexpected version of a library or missing prerequisite.

Contribution

You may not need the latest bleeding-edge KDE to develop with, Much code will be similiar between versions and your patch might work, however Trunk is where major changes are introduced, and branches are mostly maintenance/bug fix.