Building/Building KOffice
From KOffice
For instruction on how to build the 1.6 release of KOffice read the koffice website.
Contents |
Preparation
Example of setup
Here is an example of directory structure:
- $HOME/kde4/src a directory with the source code
- $HOME/kde4/build a directory where koffice will be build
- $HOME/kde4/inst a directory where koffice will be installed
Get the source code for the latest stable version
- check on koffice.org for the latest release (currently it is 2.0.1)
- you can checkout the 2.0 branch from:
svn co svn://anonsvn.kde.org/home/kde/branches/koffice/2.0/koffice
Get the source code for development version
- you can get the latest source from subversion:
svn co svn://anonsvn.kde.org/home/kde/trunk/koffice
- from an beta
The source code for the latest beta can be found on KDE's ftp koffice-latest.
- daily snapshots can be found here ftp://ftp.kde.org/pub/kde/snapshots/ (there is no guarantee that the content of the snapshot is buildable), and once installed it can be updated using subversion
- Back here, it takes forever for a new svn checkout. So,
- Download svn trunk snapshots from http://kdesvn-build.kde.org/other/svn-checkout-tarballs.php.
- 'svn revert -R .'.
- If you have an svn account: svn switch --relocate svn://anonsvn.kde.org/ svn+ssh://username@svn.kde.org/ (replace svn+ssh by https if you are using the https protocol)
Get the source when you have a KDE developer account
For more information see using subversion with KDE. If you have https access:
svn co --username=login https://svn.kde.org/home/kde/trunk/koffice
If you have svn+ssh access:
svn co --username=login svn+ssh://svn.kde.org/home/kde/trunk/koffice
Build requirement
Hard dependency
To change a hard dependency, an explanation of the reason, and possibely a discussion must be posted on koffice-devel@kde.org, in advance. The new dependency need to be packaged in the most widely used distributions (Debian, Fedora Core, OpenSuSE, (K)ubuntu).
- Qt 4.5.0
- kdelibs, the minimal requirement is currently 4.1.0. But KOffice should build fine with either kdelibs from svn (see techbase for an explanation on how to compile kdelibs from svn), or any 4.1 release packaged in your distribution (4.2.x is recommended)
- kdebase/runtime 4.1 (4.2.x is recommended)
- kdepimlibs 4.1 (4.2.x is recommended)
- cmake 2.6.2
- lcms 1.18
For KSpread:
- libeigen 2.0
For Krita:
- libeigen 2.0
- libexiv2 >= 0.16
- libqimageblitz
Optional dependency
On deb based distribution (debian/ubuntu/...)
You can install all the dependencies used for the packages by running "apt-get build-dep packagename", for instance on ubuntu:
sudo apt-get build-dep koffice-kde4
On OpenSuSE
You can install all the dependencies used for buildink koffice on OpenSuSE with:
zypper si -d koffice-devel
Build koffice
It is higly advise to build KOffice in a different directory than the source directory.
- mkdir koffice-build
- cd koffice-build
- cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/src -DCMAKE_BUILD_TYPE=RelWithDebInfo (or you can use cmakekde if you followed those instructions to get kdelibs)
- make
- make install
- enjoy !
If you followed the exemple directory structure, it would be:
- cd $HOME/kde4/build
- mkdir koffice
- cd koffice
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde4/inst $HOME/kde4/src/koffice -DCMAKE_BUILD_TYPE=RelWithDebInfo
- make
- make install
- enjoy !
Instead of "RelWithDebInfo" which give an optimized KOffice with debug information, usefull for bug reporting, one can use "Debug" to get a slow KOffice but with even more interesting backtrace information.
To be up-to-date (in case you use the unstable or branch)
To keep your local copy up-to-date:
- cd koffice
- svn up
- cd koffice-build
- make install
If you followed the exemple directory structure, it would be:
- cd $HOME/kde4/src/koffice
- svn up
- cd $HOME/kde4/build/koffice
- make
- make install
Build only application X from KOffice
The graphical way, after executing cmake and before executing make, use the commmand:
ccmake .
And in the list of variables set to "off" the BUILD_{application} that you don't want to build (for instance set BUILD_krita to off if you don't want to build krita).
Alternatively you can from the cmake command line do -DBUILD_krita=off to disable compilation of Krita.
Running KOffice applications
To run KOffice applications you need to call it from the command line. If you have installed KOffice in a different prefix than KDElibs (which you are highly advised to do if you used packages), you need to set the following environnement variable:
- export KDEDIRS=$KDEDIRS:/path/to/install
- export PATH=$PATH:/path/to/install/bin
Instead of using KDEDIRS, you can add this to your ~/.kde/share/config/kdeglobals (the advantage of this is that KDE4 will always look for the services where KOffice is installed):
[Directories] prefixes=/path/to/install
In case you followed the example directory structure:
- export KDEDIRS=$KDEDIRS:$HOME/kde4/inst
- export PATH=$PATH:$HOME/kde4/inst/bin
And then you need to execute "kbuildsycoca4".
Run unit tests
To be able to run unit tests you need to enable test compilation in cmake with KDE4_BUILD_TESTS=ON, either run cmake -DKDE4_BUILD_TESTS=ON in the build directory, or use "ccmake ." and change the value in the directory.
Then you can run the test with "make test" or individually in the tests directories, it is also recommended to call "make install" before running tests.

