kdesvn-build is a tool to allow users and developers to easily download and build the latest versions of KDE (3.5 and 4) from the KDE source code repository. It automates the following tasks and more:
So why use kdesvn-build? There are several reasons you may like to use it:
kdesvn-build is fairly easy to install and setup, but you also need to have the right software installed to build KDE. The requirements to build KDE are available as follows:
In addition to those listed requirements, kdesvn-build requires the Perl scripting platform to be installed. It is installed by default with most distributions, and is required to build KDE 3. kdesvn-build is designed to work with 5.6 or later but has only been tested on Perl 5.8.
|kdesvn-build is developed on a Linux system, but it should work on the various BSD distributions as well (although GNU tools may be required).|
Once your system is setup to be able to compile KDE, you can download kdesvn-build from its website, kdesvn-build.kde.org. The file you download will contain (at least) the kdesvn-build script and a sample configuration file. Installing kdesvn-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 source directory that we use (~/kdesvn)
mkdir -p ~/kdesvn cd ~/kdesvn tar xjvf ~/path/to/kdesvn-build-1.8.tar.bz2 cp kdesvn-build-1.8/kdesvn-build .
Alternatively, the newest kdesvn-build script (and sample config file) can be pulled directly from svn:
mkdir -p ~/kdesvn cd ~/kdesvn svn cat svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk/scripts/kdesvn-build > kdesvn-build svn cat svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk/scripts/kdesvn-buildrc-sample > ~/.kdesvn-buildrc chmod +x kdesvn-build
Now you should setup your configuration. For the most part the defaults in the included kdesvn-buildrc-sample should be sufficient.
cp ~/kdesvn/kdesvn-build-1.4/kdesvn-buildrc-sample ~/.kdesvn-buildrc # Now edit the ~/.kdesvn-buildrc
|Note that the config file's name begins with a leading ., making it a hidden file. You may need to show hidden files in Konqueror to find the configuration file to edit it. Or you can edit the sample before copying it to ~/.kdesvn-buildrc.|
While editing the sample file you'll want to take note of the use-stable-kde option. If you want to build the latest KDE, make sure it is either commented or explicitly set to false. To build KDE 3.5 by default, uncomment it and set it to true.
Also, make sure that the modules you'll want to build are included. You'll want the following at the least:
Modules are built in the order they appear in your ~/.kdesvn-buildrc, so the first module should be qt-copy, kdelibs should be before any other KDE module, and so on.
|The sample configuration file does include these modules by default, you won't need to make many changes unless you'd like to add some modules to the build by uncommenting them.|
You may want to enable the make-install-prefix option if you are installing KDE or qt-copy to a directory not in your home directory. make-install-prefix allows you to run su or sudo during the make install process so you can install files as root, or set certain programs as setuid (for instance, this is required for the KDE screensaver locking program).
module kdelibs make-install-prefix sudo -S # sudo with no stdin end module module kdebase make-install-prefix sudo -S end module
If a module you'd like to build isn't already present, simply add
module <module-name> end moduleat the end of the ~/.kdesvn-buildrc.
kdesvn-build is driven from the command line, so here's a guide to some of the more useful command line options:
|--pretend (Short form -p)||This option is like a dry run. kdesvn-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 will instead output what kdesvn-build would have done. You should always run with -p before running kdesvn-build to make sure it is doing what you expect.|
|--no-svn||This option skips the source code update step. This is useful if you're running kdesvn-build again soon after the last update and don't want to wait to find out there were no changes.|
|--refresh-build||This option causes kdesvn-build to delete the current build information for the given modules and start building them again from scratch. This option takes a lot of time but gives the best chance of a successful build.|
|--reconfigure||This option runs the configure or cmake command again before starting the build, which is sometimes required when the build system configuration changes from the source update. The build directory is left intact which can save some time rebuilding but risks a failed build.|
Any other non-option arguments on the command line are assumed to be modules to build (and are built in the order provided on the command line). If no modules are specified, all of the modules listed in the ~/.kdesvn-buildrc (except those with manual-build enabled) are built in the order listed in the file.
We're almost there. If you're happy with your settings then it's time to test out kdesvn-build. In theory things are as simple as running kdesvn-build and then coming back later. ;)
cd ~/kdesvn ./kdesvn-build
You may want to test by building qt-copy first however.
cd ~/kdesvn ./kdesvn-build qt-copy
|If you have the GNU screen program available then you should definitely use it to run kdesvn-build, as you can detach your kdesvn-build session and logout while kdesvn-build is still running.|
If the build failed (kdesvn-build will error out with a nice bright red error message) then there are several possibilities:
How do you find out what the error was? The output of the failing command will be in the log directory. By default, all log output is in the log subdirectory of the KDE source directory. The log directory is laid out like this: log/date-run/module/output-file.log. To simplify finding the appropriate file, there are a couple of symlinks created:
log/latest always has the debugging output for the last time kdesvn-build was run (--pretend doesn't count toward this) log/latest/<module>/error.log has the debugging output for the command that caused a module build to fail.
For instance if qt-copy just failed to build you could read the output like this:
cd ~/kdesvn kwrite log/latest/qt-copy/error.log
Replace kwrite with your preferred editor. Hopefully the output can guide you to resolving the problem. For instance, if the failure is a cmake output saying you're missing a library, install that library and try again. ;) For link errors you can try running a --refresh-build on the module (or if that doesn't work, required libraries like qt-copy and kdelibs).
If you're stumped by the error you may want to wait a day and try updating again, and hope that the reason for the error has been fixed. You can also try mailing the kde-devel mailing list to see if others know about the problem or have had similar issues.
Assuming you got enough of the modules to build and install to have a working KDE installation, you'll still need to setup your environment correctly to run it. kdesvn-build doesn't help you out here (yet), but the instructions at the .bashrc wiki page apply just as well, except that you'll need to set the environment variables to the settings that are in your ~/.kdesvn-buildrc.
For the KDEDIRS and KDEDIR variable use the setting of the "prefix" option (in the global section). For the QTDIR variable use the setting of the "qtdir" option.
|When copying settings over to the .bashrc, change any ~'s in the paths to $HOME, as the ~ character is not expanded correctly in the .bashrc.|
Once your .bashrc is setup logout and log back in again and then you should be able to run your new KDE installation.
Keeping your KDE installation up to date is as simple as running kdesvn-build again. Every kdesvn-build has these phases:
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 configuation 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 kdesvn-build, see the online documentation for kdesvn-build, which describes all of the module options and command line options available for kdesvn-build and gives tips on how to perform various useful tasks.
If you have any questions that are not answered please feel free to add them under the Discussion entry for this page and hopefully someone will be able to get the answer.