Difference between revisions of "Calligra/Building"

Jump to: navigation, search
(Add Mageia instructions (and paste back an older revision as my browser messed-up layout..))
Line 1: Line 1:
 
These instructions are for Unix and similar operating systems.<br>
 
These instructions are for Unix and similar operating systems.<br>
For Windows, see the [[Calligra/Building_Calligra_on_Windows|building  
+
For Windows, see the [[Calligra/Building_Calligra_on_Windows|building Calligra on Windows]] page.<br>
Calligra on Windows]] page.<br>
+
For OSX, see the [[Calligra/Building_Calligra_on_OSX|building Calligra on OSX]] page.
For OSX, see the [[Calligra/Building_Calligra_on_OSX|building Calligra  
 
on OSX]] page.
 
  
 
= Preparation =
 
= Preparation =
{{Warning|First, to avoid conflicting copies of software, '''make sure  
+
{{Warning|First, to avoid conflicting copies of software, '''make sure you do not have other copy of Calligra or KOffice''' either installed through the package manager of your distribution or installed in any other way. Calligra and KOffice are mutually exclusive!}}
you do not have other copy of Calligra or KOffice''' either installed  
 
through the package manager of your distribution or installed in any  
 
other way. Calligra and KOffice are mutually exclusive!}}
 
  
{{Warning|Follow this guide as an ordinary user. Do not login as  
+
{{Warning|Follow this guide as an ordinary user. Do not login as '''root'''!}}
'''root'''!}}
 
  
{{Warning|Some distributions (*Buntu, Arch) are now making Qt5 the  
+
{{Warning|Some distributions (*Buntu, Arch) are now making Qt5 the defaulft! That does not work. Do not try to use Qt5, use Qt4.}}
defaulft! That does not work. Do not try to use Qt5, use Qt4.}}
 
  
 
== Recommended Setup ==
 
== Recommended Setup ==
Line 23: Line 16:
 
;$HOME/kde4/inst:directory that Calligra will be installed in
 
;$HOME/kde4/inst:directory that Calligra will be installed in
  
The ''build'' directory is needed because you cannot (or should not)  
+
The ''build'' directory is needed because you cannot (or should not) build Calligra inside the source directory; the source and build directory have to be separated.  
build Calligra inside the source directory; the source and build  
 
directory have to be separated.  
 
  
 
Create these directories with:
 
Create these directories with:
Line 32: Line 23:
  
 
'''Advantages of this setup:'''
 
'''Advantages of this setup:'''
*It is possible to have different builds (e.g. with different options  
+
*It is possible to have different builds (e.g. with different options out of the same source code)
out of the same source code)
+
*[http://techbase.kde.org/Getting_Started/Increased_Productivity_in_KDE4_with_Scripts David Faure's scripts] can be used to make development easier. With those scripts "make" can be typed in the source directory and building will happen in the right (build) directory automatically.
*[http://techbase.kde.org/Getting_Started/Increased_Productivity_in_KDE4_with_Scripts
 
  
David Faure's scripts] can be used to make development easier. With
+
Also, check the [http://techbase.kde.org/Getting_Started/Build Techbase instructions on setting up a build environment]. That contains some useful scripts and functions.
those scripts "make" can be typed in the source directory and building
 
will happen in the right (build) directory automatically.
 
 
 
Also, check the [http://techbase.kde.org/Getting_Started/Build Techbase  
 
instructions on setting up a build environment]. That contains some  
 
useful scripts and functions.
 
  
 
== Getting the Source Code ==
 
== Getting the Source Code ==
 
There are two most useful options:
 
There are two most useful options:
 
#'''Get the source code for the latest stable version.'''
 
#'''Get the source code for the latest stable version.'''
#'''Get the source code for the current development version.''' Needed  
+
#'''Get the source code for the current development version.''' Needed to test, check and give feedback about features that is in development and have not been released yet.
to test, check and give feedback about features that is in development  
 
and have not been released yet.
 
  
 
If unsure pick the stable version.
 
If unsure pick the stable version.
Line 57: Line 39:
 
The latest stable Calligra version is '''{{Calligra/Stable}}'''.
 
The latest stable Calligra version is '''{{Calligra/Stable}}'''.
  
*'''Option 1: It can be downloaded as a single archive file''' from  
+
*'''Option 1: It can be downloaded as a single archive file''' from http://download.kde.org/stable/calligra-{{Calligra/Stable}}/calligra-{{Calligra/Stable}}.tar.xz. Right now it weights about 114 MiB. The source code has to be uncompressed using:
http://download.kde.org/stable/calligra-{{Calligra/Stable}}/calligra-{{Calligra/Stable}}.tar.xz.
 
 
 
Right now it weights about 114 MiB. The source code has to be  
 
uncompressed using:
 
  
  
 
  tar xJf calligra-{{Calligra/Stable}}.tar.xz
 
  tar xJf calligra-{{Calligra/Stable}}.tar.xz
  
:Then ''calligra-{{Calligra/Stable}}'' will appear. You '''do not'''  
+
:Then ''calligra-{{Calligra/Stable}}'' will appear. You '''do not''' need to execute initrepo.sh in it, the code is ready to build. Please note there is a price for smaller download: to update the source code to a newer version, another .tar.xz should be downloaded. See the option 2 to see how to address this with one-time bigger updatable download.
need to execute initrepo.sh in it, the code is ready to build. Please  
 
note there is a price for smaller download: to update the source code to
 
a newer version, another .tar.xz should be downloaded. See the option 2
 
to see how to address this with one-time bigger updatable download.
 
  
:When the source code is properly downloaded, the next step is to ensure
+
:When the source code is properly downloaded, the next step is to ensure that [[#Build_Requirements|build requirements]] are met and to [[#Build_Calligra|build Calligra]].
that [[#Build_Requirements|build requirements]] are met and to  
 
[[#Build_Calligra|build Calligra]].
 
  
*'''Option 2: Alternative download from the git repository''', what  
+
*'''Option 2: Alternative download from the git repository''', what weights about 650MB. If you prefer, stable versions are also available on the git repository too. It is heavier but one-time download, the advantage is that lightweight updates can be obtained without a need for downloading entire source code again.
weights about 650MB. If you prefer, stable versions are also available  
 
on the git repository too. It is heavier but one-time download, the  
 
advantage is that lightweight updates can be obtained without a need for
 
downloading entire source code again.
 
  
:To get stable version x.y (currently {{Calligra/Stable}}) from git,  
+
:To get stable version x.y (currently {{Calligra/Stable}}) from git, first follow instructions for downloading [[#Development Version|the development version]] below, either the Option #1 (directly from git) or the Option #2 (download a repository tarball). Then you need to switch from the development version to stable version of the source code. To do so, in the main Calligra source code directory that has been downloaded, type:
first follow instructions for downloading [[#Development Version|the  
 
development version]] below, either the Option #1 (directly from git) or
 
the Option #2 (download a repository tarball). Then you need to switch  
 
from the development version to stable version of the source code. To do
 
so, in the main Calligra source code directory that has been  
 
downloaded, type:
 
  
 
  git checkout calligra/{{Calligra/StableBranch}}
 
  git checkout calligra/{{Calligra/StableBranch}}
  
:''calligra/x.y'' is a notation for branches in the Calligra project.  
+
:''calligra/x.y'' is a notation for branches in the Calligra project. For the latest stable version {{Calligra/Stable}} the branch is called calligra/{{Calligra/StableBranch}} and contains code updates for current minor stable release '''{{Calligra/Stable}}''' plus updates for the next minor planned stable update (if there is any [[Schedules|planned]]).
For the latest stable version {{Calligra/Stable}} the branch is called  
 
calligra/{{Calligra/StableBranch}} and contains code updates for current
 
minor stable release '''{{Calligra/Stable}}''' plus updates for the  
 
next minor planned stable update (if there is any  
 
[[Schedules|planned]]).
 
  
:When the source code is properly downloaded, the next step is to ensure
+
:When the source code is properly downloaded, the next step is to ensure that [[#Build_Requirements|build requirements]] are met and to [[#Build_Calligra|build Calligra]].
that [[#Build_Requirements|build requirements]] are met and to  
 
[[#Build_Calligra|build Calligra]].
 
  
 
=== Development Version ===
 
=== Development Version ===
  
The latest development version of Calligra is '''{{Calligra/Unstable}}  
+
The latest development version of Calligra is '''{{Calligra/Unstable}} {{Calligra/Stage}}'''; developers always refer to it as to '''master'''. Applications from ''Master'' should always compile and be reasonably stable. Calligra developers never place experimental features there. Once tested and released, ''Master'' becomes the new current stable version {{Calligra/UnstableBranch}}.  
{{Calligra/Stage}}'''; developers always refer to it as to '''master'''.
 
Applications from ''Master'' should always compile and be reasonably  
 
stable. Calligra developers never place experimental features there.  
 
Once tested and released, ''Master'' becomes the new current stable  
 
version {{Calligra/UnstableBranch}}.  
 
  
''TODO: Here we should explain local branches, staging and  
+
''TODO: Here we should explain local branches, staging and always-release-ready Master, if we have that setup.''
always-release-ready Master, if we have that setup.''
 
  
 
*'''Option 1: directly from git'''
 
*'''Option 1: directly from git'''
  
To retrieve the source code from Git you have to use the following  
+
To retrieve the source code from Git you have to use the following setup:
setup:
 
  
 
Add the following text to your ~/.gitconfig:  
 
Add the following text to your ~/.gitconfig:  
Line 131: Line 79:
 
  $ git clone kde:calligra
 
  $ git clone kde:calligra
  
By using the kde: prefix, read access will automatically happen over  
+
By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.
Git, and authenticated SSH is only required for pushes.
 
  
Note that pushing your changes will only work if you have a KDE  
+
Note that pushing your changes will only work if you have a KDE developer identity. You can get a contributor account as explained on [http://techbase.kde.org/Contribute/Get_a_Contributor_Account the KDE Techbase].
developer identity. You can get a contributor account as explained on  
 
[http://techbase.kde.org/Contribute/Get_a_Contributor_Account the KDE  
 
Techbase].
 
  
The $HOME/kde4/src/calligra directory will be created regardless of the  
+
The $HOME/kde4/src/calligra directory will be created regardless of the way how the source code has been downloaded.
way how the source code has been downloaded.
 
  
 
*'''Option 2: download a repository tarball'''
 
*'''Option 2: download a repository tarball'''
  
Go to https://projects.kde.org/projects/calligra/repository. Press the  
+
Go to https://projects.kde.org/projects/calligra/repository. Press the "Tarball" button. Copy the url text and paste it on your command line. It will look like:
"Tarball" button. Copy the url text and paste it on your command line.  
 
It will look like:
 
  
 
  wget -c http://anongit.kde.org/calligra/calligra-latest.tar.gz
 
  wget -c http://anongit.kde.org/calligra/calligra-latest.tar.gz
Line 165: Line 106:
  
  
*'''Option 3: if beta or rc version was released''', the source code for
+
*'''Option 3: if beta or rc version was released''', the source code for the latest beta can be found on KDE's ftp [ftp://ftp.kde.org/pub/kde/unstable/calligra-latest/ calligra-latest]. Uncompress the code so that $HOME/kde4/src/calligra is created.
the latest beta can be found on KDE's ftp  
 
[ftp://ftp.kde.org/pub/kde/unstable/calligra-latest/ calligra-latest].  
 
Uncompress the code so that $HOME/kde4/src/calligra is created.
 
  
 
=== Working with Multiple Versions ===
 
=== Working with Multiple Versions ===
You will often want to have more than one build environment in parallel,
+
You will often want to have more than one build environment in parallel, for example if you want to work on both stable and unstable branches at the same time or several ''feature'' branches.
for example if you want to work on both stable and unstable branches at
 
the same time or several ''feature'' branches.
 
 
 
Recommended way is to use '''git-new-workdir''' tool. The solution is
 
based on a single git repository clone multiplied to many separate
 
source directories for each branch you wish to use, all without
 
performing full clone (what consumes disk space and requires fetching
 
each clone separately). It is explained in the Techbase article
 
[http://techbase.kde.org/Development/Git/Configuration#Multiple_Work_Branches
 
  
Multiple Work Branches] and you can find the script there.
+
Recommended way is to use '''git-new-workdir''' tool. The solution is based on a single git repository clone multiplied to many separate source directories for each branch you wish to use, all without performing full clone (what consumes disk space and requires fetching each clone separately). It is explained in the Techbase article [http://techbase.kde.org/Development/Git/Configuration#Multiple_Work_Branches Multiple Work Branches] and you can find the script there.
  
Example commands to have code for both Calligra  
+
Example commands to have code for both Calligra ''{{Calligra/UnstableBranch}}.x'' and ''master'' versions:
''{{Calligra/UnstableBranch}}.x'' and ''master'' versions:
 
  
 
To get the ''master'' into <tt>$HOME/kde4/src/calligra</tt>:
 
To get the ''master'' into <tt>$HOME/kde4/src/calligra</tt>:
 
  $ git clone kde:calligra
 
  $ git clone kde:calligra
  
Then, to get the Calligra ''{{Calligra/UnstableBranch}}.x'' into  
+
Then, to get the Calligra ''{{Calligra/UnstableBranch}}.x'' into <tt>$HOME/kde4/src/calligra-{{Calligra/UnstableBranch}}</tt>:
<tt>$HOME/kde4/src/calligra-{{Calligra/UnstableBranch}}</tt>:
+
$ git-new-workdir $HOME/kde4/src/calligra $HOME/kde4/src/calligra-{{Calligra/UnstableBranch}} calligra/{{Calligra/UnstableBranch}}
  
 
+
(which means ''git-new-workdir <original clone's directory> <new source directory> <branch name>'')
$ git-new-workdir $HOME/kde4/src/calligra
 
$HOME/kde4/src/calligra-{{Calligra/UnstableBranch}}
 
calligra/{{Calligra/UnstableBranch}}
 
 
 
(which means ''git-new-workdir <original clone's directory>  
 
<new source directory> <branch name>'')
 
  
 
= Build Requirements =
 
= Build Requirements =
This section provides information about '''hard''' (required) and  
+
This section provides information about '''hard''' (required) and '''optional''' software packages needed to build the Calligra software.
'''optional''' software packages needed to build the Calligra software.
 
  
 
== Required Dependencies ==
 
== Required Dependencies ==
  
{{Note|'''A note for developers:''' to add (or remove) a hard  
+
{{Note|'''A note for developers:''' to add (or remove) a hard dependency, an explanation of the reason, and possibly a discussion must be posted in advance on [email protected] The new dependency need to be packaged in the most widely used distributions (Debian, Fedora Core, OpenSuSE, (K)ubuntu). First try to make your new feature optional.}}
dependency, an explanation of the reason, and possibly a discussion must
 
be posted in advance on [email protected] The new dependency need
 
to be packaged in the most widely used distributions (Debian, Fedora  
 
Core, OpenSuSE, (K)ubuntu). First try to make your new feature  
 
optional.}}
 
  
Following are the general must-have dependencies for Calligra (unless  
+
Following are the general must-have dependencies for Calligra (unless you really need to do otherwise, just install relevant binary packages):
you really need to do otherwise, just install relevant binary packages):
 
 
* Qt 4.7.0 or newer
 
* Qt 4.7.0 or newer
 
*kdelibs and kdelibs development files
 
*kdelibs and kdelibs development files
**the minimal requirement is currently 4.3.0, that or any later release  
+
**the minimal requirement is currently 4.3.0, that or any later release packaged in your distribution is OK
packaged in your distribution is OK
+
**On opensuse the development package is called libkde4-devel; on Ubuntu and Debian it is called kdelibs5-dev. (TODO: add info for other distributions)
**On opensuse the development package is called libkde4-devel; on Ubuntu
+
**Calligra should also build fine with either kdelibs from ''git'' repository (see [http://techbase.kde.org/Getting_Started/Build/KDE4 techbase] for an explanation on how to compile kdelibs from svn), needed for parts of Calligra build with the Mobile Frameworks Profile of the KDE platform (Calligra Words, Calligra Sheets, Calligra Stage, krita)
and Debian it is called kdelibs5-dev. (TODO: add info for other  
 
distributions)
 
**Calligra should also build fine with either kdelibs from ''git''  
 
repository (see [http://techbase.kde.org/Getting_Started/Build/KDE4  
 
techbase] for an explanation on how to compile kdelibs from svn), needed
 
for parts of Calligra build with the Mobile Frameworks Profile of the  
 
KDE platform (Calligra Words, Calligra Sheets, Calligra Stage, krita)
 
 
* kdebase/runtime 4.3 or newer
 
* kdebase/runtime 4.3 or newer
 
* cmake 2.6.2 or newer
 
* cmake 2.6.2 or newer
 
* lcms 2.4 or newer
 
* lcms 2.4 or newer
* libpng development package (libpng14-devel on opensuse, libpng-dev on  
+
* libpng development package (libpng14-devel on opensuse, libpng-dev on Ubuntu/Debian)
Ubuntu/Debian)
+
** development packages for other libraries may be needed; on ubuntu/Debian these can be installed using 'apt-get build-dep kdelibs5'
** development packages for other libraries may be needed; on  
 
ubuntu/Debian these can be installed using 'apt-get build-dep kdelibs5'
 
  
 
For Calligra Sheets:
 
For Calligra Sheets:
Line 247: Line 153:
  
 
For Kexi:
 
For Kexi:
* sqlite3 and sqlite3-devel packages (package names can differ on  
+
* sqlite3 and sqlite3-devel packages (package names can differ on various distributions), version >= 3.7.10
various distributions), version >= 3.7.10
 
 
* icu, libicu and libicu-devel (unicode support)
 
* icu, libicu and libicu-devel (unicode support)
  
 
== Optional Dependencies ==
 
== Optional Dependencies ==
  
All optional dependencies are logged at the end of the cmake run, so it  
+
All optional dependencies are logged at the end of the cmake run, so it is easy to figure out what is missing. The buildsystem also reports what component will not be built because given missing dependency.
is easy to figure out what is missing. The buildsystem also reports what
 
component will not be built because given missing dependency.
 
  
For users who want to use Krita it is also recommended to install the  
+
For users who want to use Krita it is also recommended to install the [http://code.compeng.uni-frankfurt.de/projects/vc Vc library]. It is optional, but makes the performance much higher.
[http://code.compeng.uni-frankfurt.de/projects/vc Vc library]. It is  
 
optional, but makes the performance much higher.
 
  
 
== Distribution Specific Instructions ==
 
== Distribution Specific Instructions ==
  
 
=== Debian-based Distributions ===
 
=== Debian-based Distributions ===
On '''Debian''', '''Ubuntu''' and '''Kubuntu''', all the dependencies  
+
On '''Debian''', '''Ubuntu''' and '''Kubuntu''', all the dependencies used for the packages can be installed by running :
used for the packages can be installed by running :
+
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo apt-get build-dep calligra</pre>
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap;  
 
white-space:-o-pre-wrap; white-space:pre-wrap;  
 
word-wrap:break-word">sudo apt-get build-dep calligra</pre>
 
 
Note you'll need to activate 'software sources' in your repositories.  
 
Note you'll need to activate 'software sources' in your repositories.  
  
Additionnal more or less mandatory librairies for Ubuntu and derivatives
+
Additionnal more or less mandatory librairies for Ubuntu and derivatives :
:
+
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo apt-get install libeigen3-dev libxi-dev phonon-backend-gstreamer kdelibs5-dev libboost-dev exiv2</pre>
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap;  
 
white-space:-o-pre-wrap; white-space:pre-wrap;  
 
word-wrap:break-word">sudo apt-get install libeigen3-dev libxi-dev  
 
phonon-backend-gstreamer kdelibs5-dev libboost-dev exiv2</pre>
 
  
 
For a better appearance on non-KDE desktop environment :
 
For a better appearance on non-KDE desktop environment :
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap;  
+
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo apt-get install kde-style-oxygen</pre>
white-space:-o-pre-wrap; white-space:pre-wrap;  
 
word-wrap:break-word">sudo apt-get install  
 
kde-style-oxygen</pre>
 
  
On '''Linux Mint''' , you'll need to activate the software sources  
+
On '''Linux Mint''' , you'll need to activate the software sources repositories manually. ( Search for 'Software Sources' in your menu then open it,  On the tab 'Linux Mint Software' , check to activate 'Source code', On the tab 'Other Software' check to activate 'Ubuntu **.** <name> (source code) then close the windows to finish )''
repositories manually. ( Search for 'Software Sources' in your menu then
 
open it,  On the tab 'Linux Mint Software' , check to activate 'Source  
 
code', On the tab 'Other Software' check to activate 'Ubuntu **.**  
 
<name> (source code) then close the windows to finish )''
 
  
 
=== OpenSuSE ===
 
=== OpenSuSE ===
All the dependencies used for building Calligra can be installed by  
+
All the dependencies used for building Calligra can be installed by running:
running:
 
  
 
  zypper si -d calligra
 
  zypper si -d calligra
  
''( Note : enable in 'Yast' > 'Software Repository' the sources  
+
''( Note : enable in 'Yast' > 'Software Repository' the sources packages )''
packages )''
 
  
 
=== Fedora ===
 
=== Fedora ===
All the dependencies used for building Calligra can be installed by  
+
All the dependencies used for building Calligra can be installed by running:
running:
 
 
  yum-builddep calligra
 
  yum-builddep calligra
  
 
=== Arch Linux & Manjaro ===
 
=== Arch Linux & Manjaro ===
All the dependencies used for building Calligra can be installed by  
+
All the dependencies used for building Calligra can be installed by running:
running:
 
  
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap;  
+
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo pacman -Sy automoc4 git cmake make kdepimlibs eigen freetds kdegraphics-okular libgsf libwpd libwpg libwps pstoedit glew gsl cmake automoc4 boost libkdcraw libpqxx fftw lcms2 vc</pre>
white-space:-o-pre-wrap; white-space:pre-wrap;  
 
word-wrap:break-word">sudo pacman -Sy automoc4 git cmake make  
 
kdepimlibs eigen freetds kdegraphics-okular libgsf libwpd libwpg libwps  
 
pstoedit glew gsl cmake automoc4 boost libkdcraw libpqxx fftw lcms2  
 
vc</pre>
 
  
''( Note : Manual installation of some packages may be needed, since the
+
''( Note : Manual installation of some packages may be needed, since the package manager (pacman) may miss certain packages during installation. Use pacman -S <package_name> to install missing package.)''
package manager (pacman) may miss certain packages during installation.
 
Use pacman -S <package_name> to install missing package.)''
 
  
 
=== Chakra ===
 
=== Chakra ===
All the dependencies used for building Calligra can be installed by  
+
All the dependencies used for building Calligra can be installed by running:
running:
 
  
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap;  
+
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word">sudo pacman -S kdelibs kdepimlibs eigen freetds kdegraphics-okular kdeedu-marble xbase libgsf libwpd libwpg libwps libvisio pstoedit glew gsl cmake automoc4 libspnav libqtgtl boost libkdcraw libpqxx fftw opengtl docbook-xsl create-resources lcms2 qrencode libdmtx</pre>
white-space:-o-pre-wrap; white-space:pre-wrap;  
 
word-wrap:break-word">sudo pacman -S kdelibs kdepimlibs eigen freetds
 
kdegraphics-okular kdeedu-marble xbase libgsf libwpd libwpg libwps  
 
libvisio pstoedit glew gsl cmake automoc4 libspnav libqtgtl boost  
 
libkdcraw libpqxx fftw opengtl docbook-xsl create-resources lcms2  
 
qrencode libdmtx</pre>
 
  
 
===Mageia ===
 
===Mageia ===
Line 342: Line 211:
  
 
= Build Calligra =
 
= Build Calligra =
{{Note|It is '''not''' possible to build Calligra in the source  
+
{{Note|It is '''not''' possible to build Calligra in the source directory. Set up your directories as described in the [[#Recommended_setup|Recommended setup]] section above}}
directory. Set up your directories as described in the  
 
[[#Recommended_setup|Recommended setup]] section above}}
 
  
 
Type:
 
Type:
Line 356: Line 223:
 
       -DCMAKE_BUILD_TYPE=RelWithDebInfo
 
       -DCMAKE_BUILD_TYPE=RelWithDebInfo
  
'''Note:''' if version of your Qt framework if exactly 4.8.0 or 4.8.1  
+
'''Note:''' if version of your Qt framework if exactly 4.8.0 or 4.8.1 add an extra parameter to the above command [[/Qt 4.8.0 and 4.8.1 patch/|as explained here]].
add an extra parameter to the above command [[/Qt 4.8.0 and 4.8.1  
 
patch/|as explained here]].
 
  
(''cmakekde'' tool can be used as explained on  
+
(''cmakekde'' tool can be used as explained on [http://techbase.kde.org/Getting_Started/Build/KDE4 the build instructions for KDE4])
[http://techbase.kde.org/Getting_Started/Build/KDE4 the build  
 
instructions for KDE4])
 
  
 
Then type:
 
Then type:
Line 370: Line 233:
 
  make install
 
  make install
  
'''But first read the advice below''' regarding speeding up the build  
+
'''But first read the advice below''' regarding speeding up the build process and adding extra debugging capabilities.
process and adding extra debugging capabilities.
 
  
Please follow the  
+
Please follow the [[Calligra/Building#Running_Calligra_Applications|Running Calligra Applications]] instructions before trying to run an application.
[[Calligra/Building#Running_Calligra_Applications|Running Calligra  
 
Applications]] instructions before trying to run an application.
 
  
 
==Speed up==
 
==Speed up==
'''Recommended: Taking advantage of multi-core processors.''' On  
+
'''Recommended: Taking advantage of multi-core processors.''' On dual-core machines compilation can be '''greatly speed up''' with the <tt>-j</tt> parameter of the <tt>make</tt> program. For example whenever you are invoking <tt>make</tt>, for dual-core processor try to invoke:
dual-core machines compilation can be '''greatly speed up''' with the  
 
<tt>-j</tt> parameter of the <tt>make</tt>  
 
program. For example whenever you are invoking  
 
<tt>make</tt>, for dual-core processor try to invoke:
 
 
  make -j3
 
  make -j3
 
Similarly, for quad-core processor:
 
Similarly, for quad-core processor:
 
  make -j5
 
  make -j5
  
Generaly for ''N-core'' processor use the <tt>-jN+1</tt>  
+
Generaly for ''N-core'' processor use the <tt>-jN+1</tt> parameter.
parameter.
 
  
'''Recommended: Faster linking on Linux.'''  
+
'''Recommended: Faster linking on Linux.''' [http://en.wikipedia.org/wiki/Linker_%28computing%29 Linking] can take noticeable time in large software such as Calligra. On Linux [http://en.wikipedia.org/wiki/Gold_%28linker%29 Gold linker] can be used to speed up this task. If you're building for Linux, install the Gold linker package and add the following to your <tt>cmake</tt> command:
[http://en.wikipedia.org/wiki/Linker_%28computing%29 Linking] can take  
+
  -DCMAKE_C_FLAGS=-fuse-linker-plugin -DCMAKE_CXX_FLAGS=-fuse-linker-plugin
noticeable time in large software such as Calligra. On Linux  
 
[http://en.wikipedia.org/wiki/Gold_%28linker%29 Gold linker] can be used
 
to speed up this task. If you're building for Linux, install the Gold  
 
linker package and add the following to your <tt>cmake</tt>  
 
command:
 
  -DCMAKE_C_FLAGS=-fuse-linker-plugin  
 
-DCMAKE_CXX_FLAGS=-fuse-linker-plugin
 
  
(you can set the <tt>CMAKE_C_FLAGS</tt> adn  
+
(you can set the <tt>CMAKE_C_FLAGS</tt> adn <tt>CMAKE_CXX_FLAGS</tt> variables in your {build dir}/CMakeCache.txt file either using text editor or the <tt>ccmake</tt> tool)
<tt>CMAKE_CXX_FLAGS</tt> variables in your {build  
 
dir}/CMakeCache.txt file either using text editor or the  
 
<tt>ccmake</tt> tool)
 
  
 
==Debugging options==
 
==Debugging options==
'''Recommended for accurate debugging:''' The default debug setting is  
+
'''Recommended for accurate debugging:''' The default debug setting is <tt>RelWithDebInfo</tt> which is suitable only for obtaining backtraces. If you are developing or debugging an application by setting breakpoints, watchpoints, using step by step command accurately in your debugger, if you rely on assertions, debug and warning messages, you can replace <tt>-DCMAKE_BUILD_TYPE=RelWithDebInfo</tt> with:
<tt>RelWithDebInfo</tt> which is suitable only for obtaining
 
backtraces. If you are developing or debugging an application by  
 
setting breakpoints, watchpoints, using step by step command accurately  
 
in your debugger, if you rely on assertions, debug and warning messages,
 
you can replace <tt>-DCMAKE_BUILD_TYPE=RelWithDebInfo</tt>  
 
with:
 
 
  -DCMAKE_BUILD_TYPE=DebugFull
 
  -DCMAKE_BUILD_TYPE=DebugFull
  
Using <tt>DebugFull</tt> results in a slower code. That can  
+
Using <tt>DebugFull</tt> results in a slower code. That can be acceptable in most cases during testing and development given the machine is fast enough. It is not intended for production releases of the software unless you know what you're doing.
be acceptable in most cases during testing and development given the  
 
machine is fast enough. It is not intended for production releases of  
 
the software unless you know what you're doing.
 
  
'''Special case for Krita:''' If you are working on Krita, always use  
+
'''Special case for Krita:''' If you are working on Krita, always use the <tt>KritaDevs</tt> option by setting:
the <tt>KritaDevs</tt> option by setting:
 
 
  -DCMAKE_BUILD_TYPE=KritaDevs
 
  -DCMAKE_BUILD_TYPE=KritaDevs
  
 
= Updating and Rebuilding =
 
= Updating and Rebuilding =
If the source code has been cloned using Git, it is possible to update  
+
If the source code has been cloned using Git, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.
the source code with newly added changes and build again. Usually only  
 
changing parts will be built, so this operation would be faster than  
 
building the source code from scratch.
 
  
 
Type:
 
Type:
Line 437: Line 269:
 
  make install
 
  make install
  
(note that you can always append the <tt>-jN</tt> option to  
+
(note that you can always append the <tt>-jN</tt> option to the <tt>make</tt> command to speed up the build as explained earlier in the [[#Speed_up|Speed up]] section.
the <tt>make</tt> command to speed up the build as explained
 
earlier in the [[#Speed_up|Speed up]] section.
 
  
 
= Building Selected Applications =
 
= Building Selected Applications =
 
== Using Product Sets ==
 
== Using Product Sets ==
By default, the build system tries to build all applications. The  
+
By default, the build system tries to build all applications. The recommended way to change this is to specify a different product set by setting the <tt>PRODUCTSET</tt> CMake variable. The following table illustrates the predefined product sets.
recommended way to change this is to specify a different product set by  
 
setting the <tt>PRODUCTSET</tt> CMake variable. The  
 
following table illustrates the predefined product sets.
 
  
 
{| class="wikitable" style="margin: 1em auto; text-align: center;"
 
{| class="wikitable" style="margin: 1em auto; text-align: center;"
Line 537: Line 364:
 
  |}
 
  |}
  
For example, to build the <tt>CREATIVE</tt> product set,  
+
For example, to build the <tt>CREATIVE</tt> product set, pass
pass
 
  
 
  -DPRODUCTSET=CREATIVE
 
  -DPRODUCTSET=CREATIVE
Line 544: Line 370:
 
on the CMake command line.
 
on the CMake command line.
  
{{note|The set of included plugins, import/export filters and extra  
+
{{note|The set of included plugins, import/export filters and extra tools may differ between product sets. Consult the product set definitions in the <tt>cmake/productsets</tt> directory of the Calligra sources for detailed information about what is included in each product set.}}
tools may differ between product sets. Consult the product set  
 
definitions in the <tt>cmake/productsets</tt> directory of  
 
the Calligra sources for detailed information about what is included in  
 
each product set.}}
 
  
 
== Specific Product Sets ==
 
== Specific Product Sets ==
Line 643: Line 465:
  
 
== Fine-grained Selection ==
 
== Fine-grained Selection ==
Advanced users and developers wishing to design completely own  
+
Advanced users and developers wishing to design completely own productsets can do so. How to do that is described in the file [https://projects.kde.org/projects/calligra/repository/revisions/master/entry/cmake/productsets/README README] in the <tt> cmake/productsets </tt> directory of the Calligra sources. Creating own productsets is the recommended solution for this wish.
productsets can do so. How to do that is described in the file  
 
[https://projects.kde.org/projects/calligra/repository/revisions/master/entry/cmake/productsets/README
 
  
README] in the <tt> cmake/productsets </tt> directory of
+
Alternatively, though not recommended, instead of designing completely own productsets, it is also possible to disabe products from a selected pre-defined productset. One does so by setting the corresponding <tt>BUILD_{application}</tt> variable to <tt>OFF</tt>. For example, to disable compilation of Krita and Karbon, you can pass
the Calligra sources. Creating own productsets is the recommended
 
solution for this wish.
 
 
 
Alternatively, though not recommended, instead of designing completely  
 
own productsets, it is also possible to disabe products from a selected  
 
pre-defined productset. One does so by setting the corresponding  
 
<tt>BUILD_{application}</tt> variable to  
 
<tt>OFF</tt>. For example, to disable compilation of Krita  
 
and Karbon, you can pass
 
  
 
  -DBUILD_krita=OFF -DBUILD_karbon=OFF
 
  -DBUILD_krita=OFF -DBUILD_karbon=OFF
  
on the CMake command line. You can also do this using the  
+
on the CMake command line. You can also do this using the <tt>ccmake</tt> tool included with CMake, which you may run ''after'' the initial CMake run but ''before'' you run <tt>make</tt>.
<tt>ccmake</tt> tool included with CMake, which you may run  
 
''after'' the initial CMake run but ''before'' you run  
 
<tt>make</tt>.
 
  
{{note|Many components should '''not''' be disabled using  
+
{{note|Many components should '''not''' be disabled using <tt>BUILD_{something}</tt>. Set these variables with caution!}}
<tt>BUILD_{something}</tt>. Set these variables with  
 
caution!}}
 
  
 
= Running Calligra Applications =
 
= Running Calligra Applications =
After you installed them, there are two options to now make the Calligra
+
After you installed them, there are two options to now make the Calligra applications available for running.
applications available for running.
 
  
 
== Running from Command Line ==
 
== Running from Command Line ==
If you have installed Calligra in a different prefix than KDElibs (which
+
If you have installed Calligra in a different prefix than KDElibs (which is recommended in this document), you have to set the environment variables as folows. '''These are example values reflecting the the recommended directory structure''':
is recommended in this document), you have to set the environment  
 
variables as folows. '''These are example values reflecting the the  
 
recommended directory structure''':
 
  
 
  export KDEDIRS=$HOME/kde4/inst:$KDEDIRS
 
  export KDEDIRS=$HOME/kde4/inst:$KDEDIRS
Line 690: Line 492:
 
  mkdir -p $KDEVARTMP
 
  mkdir -p $KDEVARTMP
  
{{note|It is important to set KDEHOME to a directory different of  
+
{{note|It is important to set KDEHOME to a directory different of $HOME/.kde, and if the directory does not exist, it will be created automatically.}}
$HOME/.kde, and if the directory does not exist, it will be created  
 
automatically.}}
 
  
Then in this special environment you need to register all the Calligra  
+
Then in this special environment you need to register all the Calligra internal plugins, by executing:
internal plugins, by executing:
 
  
 
  kbuildsycoca4
 
  kbuildsycoca4
  
 
== Running from Menus or Desktop Icons ==
 
== Running from Menus or Desktop Icons ==
Instead of using ''KDEDIRS'', you can add these lines to  
+
Instead of using ''KDEDIRS'', you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:
$HOME/.kde/share/config/kdeglobals file using text editor:
 
  
 
  [Directories]
 
  [Directories]
 
  prefixes=/path/to/install
 
  prefixes=/path/to/install
  
And then you need to register all the Calligra internal plugins to the  
+
And then you need to register all the Calligra internal plugins to the system, by executing:
system, by executing:
 
  
 
  kbuildsycoca4
 
  kbuildsycoca4
  
The advantage of this is that KDE will always look for the services  
+
The advantage of this is that KDE will always look for the services where Calligra is installed.  
where Calligra is installed.  
 
 
For example for the recommended directory structure:
 
For example for the recommended directory structure:
  
Line 719: Line 515:
  
 
= Executing Unit Tests =
 
= Executing Unit Tests =
1. To be able to execute unit tests, you need to explicitly enable them  
+
1. To be able to execute unit tests, you need to explicitly enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command in the build directory:
in the build configuration. To do so, set the KDE4_BUILD_TESTS variable  
 
to "ON", either by issuing the command in the build directory:
 
  
 
  cd $HOME/kde4/build/calligra
 
  cd $HOME/kde4/build/calligra
 
  cmake -DKDE4_BUILD_TESTS=ON .
 
  cmake -DKDE4_BUILD_TESTS=ON .
  
Or you can run <code>ccmake .</code> in the buld directory  
+
Or you can run <code>ccmake .</code> in the buld directory and set KDE4_BUILD_TESTS to "on".
and set KDE4_BUILD_TESTS to "on".
 
  
 
2. Then run the test by executing:
 
2. Then run the test by executing:
Line 742: Line 535:
  
 
= CMake Build Options =
 
= CMake Build Options =
When you enter your build directory, you can type "ccmake ." to see many
+
When you enter your build directory, you can type "ccmake ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.
build options, e.g. you can turn off compilation of apps you don't want
 
- you can save time when compiling.
 
  
 
Here is list for Krita related options:
 
Here is list for Krita related options:
* HAVE_MEMORY_LEAK_TRACKER [On/Off] - You can turn on compilation of the
+
* HAVE_MEMORY_LEAK_TRACKER [On/Off] - You can turn on compilation of the tool in krita which detects memory leak. If you want to help debug Krita memory usage, it is useful. Otherwise you just slow down your Krita.
tool in krita which detects memory leak. If you want to help debug  
+
* HAVE_BACKTRACE_SUPPORT [On/Off] - It is related to the memory leak tool. If you activate, you will be able to see code path which leads to memory leak.
Krita memory usage, it is useful. Otherwise you just slow down your  
 
Krita.
 
* HAVE_BACKTRACE_SUPPORT [On/Off] - It is related to the memory leak  
 
tool. If you activate, you will be able to see code path which leads to  
 
memory leak.
 
  
 
= Resources =
 
= Resources =
 
*[[../Developer Info|Useful hints for who wants to hack on Calligra]]
 
*[[../Developer Info|Useful hints for who wants to hack on Calligra]]
*[http://wiki.opengtl.org/libraries:developers-resources Opengtl  
+
*[http://wiki.opengtl.org/libraries:developers-resources Opengtl debugging, or turning it off]
debugging, or turning it off]
+
*[http://winkde.org/pub/kde/ports/win32/dashboard/ Status of Calligra build on Windows (msvc 2008, mingw)]
*[http://winkde.org/pub/kde/ports/win32/dashboard/ Status of Calligra  
 
build on Windows (msvc 2008, mingw)]
 
  
 
= Possible Issues =
 
= Possible Issues =
Line 766: Line 550:
 
If you get errors when running an application like:
 
If you get errors when running an application like:
  
  krita(8565)/calligra (lib komain) KoPluginLoader::load: Loading plugin  
+
  krita(8565)/calligra (lib komain) KoPluginLoader::load: Loading plugin "Animation Tool" failed,  
"Animation Tool" failed,  
+
  "Cannot load library /home/michael/kde4/inst/lib/kde4/kpresentertoolanimation.so:  
  "Cannot load library  
 
/home/michael/kde4/inst/lib/kde4/kpresentertoolanimation.so:  
 
 
  (/home/michael/kde4/inst/lib/libkopageapp.so.7: undefined symbol:
 
  (/home/michael/kde4/inst/lib/libkopageapp.so.7: undefined symbol:
 
  _ZN28KoShapeContainerDefaultModel3addEP7KoShape)" ( 1 )  
 
  _ZN28KoShapeContainerDefaultModel3addEP7KoShape)" ( 1 )  
  
or crashes when starting an application, then you very likely have a  
+
or crashes when starting an application, then you very likely have a version of Calligra installed through your package manager. '''As emphasized earlier in this document, you can only have one version of Calligra, and you should uninstall your packaged Calligra'''.
version of Calligra installed through your package manager. '''As  
 
emphasized earlier in this document, you can only have one version of  
 
Calligra, and you should uninstall your packaged Calligra'''.
 
  
 
See also:
 
See also:
Line 782: Line 561:
 
*[[/Developing With KDevelop/]]
 
*[[/Developing With KDevelop/]]
 
*[[/Developing With QtCreator/]]
 
*[[/Developing With QtCreator/]]
*[http://techbase.kde.org/Projects/KDE_on_Windows Pages about compiling  
+
*[http://techbase.kde.org/Projects/KDE_on_Windows Pages about compiling KDE software for Windows]
KDE software for Windows]
+
*[http://techbase.kde.org/Getting_Started/Build/KDE4/Mac_OS_X Pages about compiling KDE software for Mac OS X]
*[http://techbase.kde.org/Getting_Started/Build/KDE4/Mac_OS_X Pages  
+
*[https://wiki.kubuntu.org/CompilingKoffice2 Community HOWTO dedicated to building for Kubuntu]
about compiling KDE software for Mac OS X]
+
*[http://community.kde.org/Sysadmin/GitKdeOrgManual kde's git infrastructure manual]
*[https://wiki.kubuntu.org/CompilingKoffice2 Community HOWTO dedicated  
+
*[http://techbase.kde.org/Development/Tutorials/Git KDE and Git for developers]
to building for Kubuntu]
 
*[http://community.kde.org/Sysadmin/GitKdeOrgManual kde's git  
 
infrastructure manual]
 
*[http://techbase.kde.org/Development/Tutorials/Git KDE and Git for  
 
developers]
 
 
*[http://git.or.cz/course/svn.html git crash course]
 
*[http://git.or.cz/course/svn.html git crash course]
*[http://community.kde.org/Calligra/Building_Calligra_on_Windows Bulding
+
*[http://community.kde.org/Calligra/Building_Calligra_on_Windows Bulding Calligra on Windows]
Calligra on Windows]
 
 
 
Note: if you want to build FreOffice using the Nokia Qt SDK, please
 
check out the
 
[http://techbase.kde.org/index.php?title=User:Kumarafaque&oldid=54703
 
  
build instructions on techbase].
+
Note: if you want to build FreOffice using the Nokia Qt SDK, please check out the [http://techbase.kde.org/index.php?title=User:Kumarafaque&oldid=54703 build instructions on techbase].

Revision as of 18:16, 18 July 2014

These instructions are for Unix and similar operating systems.
For Windows, see the building Calligra on Windows page.
For OSX, see the building Calligra on OSX page.

Preparation

Warning.png
Warning
First, to avoid conflicting copies of software, make sure you do not have other copy of Calligra or KOffice either installed through the package manager of your distribution or installed in any other way. Calligra and KOffice are mutually exclusive!


Warning.png
Warning
Follow this guide as an ordinary user. Do not login as root!


Warning.png
Warning
Some distributions (*Buntu, Arch) are now making Qt5 the defaulft! That does not work. Do not try to use Qt5, use Qt4.


Recommended Setup

Here is recommendation of a directory structure:

$HOME/kde4/src/
source code
$HOME/kde4/build/calligra
directory that Calligra will be built in
$HOME/kde4/inst
directory that Calligra will be installed in

The build directory is needed because you cannot (or should not) build Calligra inside the source directory; the source and build directory have to be separated.

Create these directories with:

mkdir -p ~/kde4/src; mkdir -p ~/kde4/build; mkdir -p ~/kde4/inst

Advantages of this setup:

  • It is possible to have different builds (e.g. with different options out of the same source code)
  • David Faure's scripts can be used to make development easier. With those scripts "make" can be typed in the source directory and building will happen in the right (build) directory automatically.

Also, check the Techbase instructions on setting up a build environment. That contains some useful scripts and functions.

Getting the Source Code

There are two most useful options:

  1. Get the source code for the latest stable version.
  2. Get the source code for the current development version. Needed to test, check and give feedback about features that is in development and have not been released yet.

If unsure pick the stable version.

Latest Stable Version

The latest stable Calligra version is 3.1.0.


tar xJf calligra-3.1.0.tar.xz
Then calligra-3.1.0 will appear. You do not need to execute initrepo.sh in it, the code is ready to build. Please note there is a price for smaller download: to update the source code to a newer version, another .tar.xz should be downloaded. See the option 2 to see how to address this with one-time bigger updatable download.
When the source code is properly downloaded, the next step is to ensure that build requirements are met and to build Calligra.
  • Option 2: Alternative download from the git repository, what weights about 650MB. If you prefer, stable versions are also available on the git repository too. It is heavier but one-time download, the advantage is that lightweight updates can be obtained without a need for downloading entire source code again.
To get stable version x.y (currently 3.1.0) from git, first follow instructions for downloading the development version below, either the Option #1 (directly from git) or the Option #2 (download a repository tarball). Then you need to switch from the development version to stable version of the source code. To do so, in the main Calligra source code directory that has been downloaded, type:
git checkout calligra/3.1
calligra/x.y is a notation for branches in the Calligra project. For the latest stable version 3.1.0 the branch is called calligra/3.1 and contains code updates for current minor stable release 3.1.0 plus updates for the next minor planned stable update (if there is any planned).
When the source code is properly downloaded, the next step is to ensure that build requirements are met and to build Calligra.

Development Version

The latest development version of Calligra is 3.1.0 Alpha; developers always refer to it as to master. Applications from Master should always compile and be reasonably stable. Calligra developers never place experimental features there. Once tested and released, Master becomes the new current stable version 3.1.

TODO: Here we should explain local branches, staging and always-release-ready Master, if we have that setup.

  • Option 1: directly from git

To retrieve the source code from Git you have to use the following setup:

Add the following text to your ~/.gitconfig:

[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "ssh://[email protected]/"]
    pushInsteadOf = kde:

Then execute

$ git clone kde:calligra

By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.

Note that pushing your changes will only work if you have a KDE developer identity. You can get a contributor account as explained on the KDE Techbase.

The $HOME/kde4/src/calligra directory will be created regardless of the way how the source code has been downloaded.

  • Option 2: download a repository tarball

Go to https://projects.kde.org/projects/calligra/repository. Press the "Tarball" button. Copy the url text and paste it on your command line. It will look like:

wget -c http://anongit.kde.org/calligra/calligra-latest.tar.gz

Unpack and cd into directory, then run

$ ./initrepo.sh

From now on, you can run

$ git pull

to update, or if you have local changes:

$ git rebase origin/master



  • Option 3: if beta or rc version was released, the source code for the latest beta can be found on KDE's ftp calligra-latest. Uncompress the code so that $HOME/kde4/src/calligra is created.

Working with Multiple Versions

You will often want to have more than one build environment in parallel, for example if you want to work on both stable and unstable branches at the same time or several feature branches.

Recommended way is to use git-new-workdir tool. The solution is based on a single git repository clone multiplied to many separate source directories for each branch you wish to use, all without performing full clone (what consumes disk space and requires fetching each clone separately). It is explained in the Techbase article Multiple Work Branches and you can find the script there.

Example commands to have code for both Calligra 3.1.x and master versions:

To get the master into $HOME/kde4/src/calligra:

$ git clone kde:calligra

Then, to get the Calligra 3.1.x into $HOME/kde4/src/calligra-3.1:

$ git-new-workdir $HOME/kde4/src/calligra $HOME/kde4/src/calligra-3.1 calligra/3.1

(which means git-new-workdir <original clone's directory> <new source directory> <branch name>)

Build Requirements

This section provides information about hard (required) and optional software packages needed to build the Calligra software.

Required Dependencies

Note-box-icon.png
Note
A note for developers: to add (or remove) a hard dependency, an explanation of the reason, and possibly a discussion must be posted in advance on [email protected] The new dependency need to be packaged in the most widely used distributions (Debian, Fedora Core, OpenSuSE, (K)ubuntu). First try to make your new feature optional.


Following are the general must-have dependencies for Calligra (unless you really need to do otherwise, just install relevant binary packages):

  • Qt 4.7.0 or newer
  • kdelibs and kdelibs development files
    • the minimal requirement is currently 4.3.0, that or any later release packaged in your distribution is OK
    • On opensuse the development package is called libkde4-devel; on Ubuntu and Debian it is called kdelibs5-dev. (TODO: add info for other distributions)
    • Calligra should also build fine with either kdelibs from git repository (see techbase for an explanation on how to compile kdelibs from svn), needed for parts of Calligra build with the Mobile Frameworks Profile of the KDE platform (Calligra Words, Calligra Sheets, Calligra Stage, krita)
  • kdebase/runtime 4.3 or newer
  • cmake 2.6.2 or newer
  • lcms 2.4 or newer
  • libpng development package (libpng14-devel on opensuse, libpng-dev on Ubuntu/Debian)
    • development packages for other libraries may be needed; on ubuntu/Debian these can be installed using 'apt-get build-dep kdelibs5'

For Calligra Sheets:

  • libeigen 3.0

For Krita:

  • libeigen 3.0
  • libexiv2 >= 0.16

For Stage:

  • boost

For Kexi:

  • sqlite3 and sqlite3-devel packages (package names can differ on various distributions), version >= 3.7.10
  • icu, libicu and libicu-devel (unicode support)

Optional Dependencies

All optional dependencies are logged at the end of the cmake run, so it is easy to figure out what is missing. The buildsystem also reports what component will not be built because given missing dependency.

For users who want to use Krita it is also recommended to install the Vc library. It is optional, but makes the performance much higher.

Distribution Specific Instructions

Debian-based Distributions

On Debian, Ubuntu and Kubuntu, all the dependencies used for the packages can be installed by running :

sudo apt-get build-dep calligra

Note you'll need to activate 'software sources' in your repositories.

Additionnal more or less mandatory librairies for Ubuntu and derivatives :

sudo apt-get install libeigen3-dev libxi-dev phonon-backend-gstreamer kdelibs5-dev libboost-dev exiv2

For a better appearance on non-KDE desktop environment :

sudo apt-get install kde-style-oxygen

On Linux Mint , you'll need to activate the software sources repositories manually. ( Search for 'Software Sources' in your menu then open it, On the tab 'Linux Mint Software' , check to activate 'Source code', On the tab 'Other Software' check to activate 'Ubuntu **.** <name> (source code) then close the windows to finish )

OpenSuSE

All the dependencies used for building Calligra can be installed by running:

zypper si -d calligra

( Note : enable in 'Yast' > 'Software Repository' the sources packages )

Fedora

All the dependencies used for building Calligra can be installed by running:

yum-builddep calligra

Arch Linux & Manjaro

All the dependencies used for building Calligra can be installed by running:

sudo pacman -Sy automoc4 git cmake make kdepimlibs eigen freetds kdegraphics-okular libgsf libwpd libwpg libwps pstoedit glew gsl cmake automoc4 boost libkdcraw libpqxx fftw lcms2 vc

( Note : Manual installation of some packages may be needed, since the package manager (pacman) may miss certain packages during installation. Use pacman -S <package_name> to install missing package.)

Chakra

All the dependencies used for building Calligra can be installed by running:

sudo pacman -S kdelibs kdepimlibs eigen freetds kdegraphics-okular kdeedu-marble xbase libgsf libwpd libwpg libwps libvisio pstoedit glew gsl cmake automoc4 libspnav libqtgtl boost libkdcraw libpqxx fftw opengtl docbook-xsl create-resources lcms2 qrencode libdmtx

Mageia

(Mageia 5 alpha 1/Cauldron recommended for current git master version)
All the dependencies used for building Calligra can be installed by running as root:

urpmi task-c++-devel git li64boost-static-devel && urpmi --buildrequires http://mirror.internode.on.net/pub/mageia/distrib/cauldron/SRPMS/core/release/calligra-2.8.5-1.mga5.src.rpm 
Note-box-icon.png
Note
change the link to the src.rpm file to actual up-to-date location.

Template:Note2

Build Calligra

Note-box-icon.png
Note
It is not possible to build Calligra in the source directory. Set up your directories as described in the Recommended setup section above


Type:

mkdir -p $HOME/kde4/build/calligra
mkdir -p $HOME/kde4/inst
cd $HOME/kde4/build/calligra

Then, type this command:

cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde4/inst $HOME/kde4/src/calligra \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo

Note: if version of your Qt framework if exactly 4.8.0 or 4.8.1 add an extra parameter to the above command as explained here.

(cmakekde tool can be used as explained on the build instructions for KDE4)

Then type:

make

Then type this command to install the software:

make install

But first read the advice below regarding speeding up the build process and adding extra debugging capabilities.

Please follow the Running Calligra Applications instructions before trying to run an application.

Speed up

Recommended: Taking advantage of multi-core processors. On dual-core machines compilation can be greatly speed up with the -j parameter of the make program. For example whenever you are invoking make, for dual-core processor try to invoke:

make -j3

Similarly, for quad-core processor:

make -j5

Generaly for N-core processor use the -jN+1 parameter.

Recommended: Faster linking on Linux. Linking can take noticeable time in large software such as Calligra. On Linux Gold linker can be used to speed up this task. If you're building for Linux, install the Gold linker package and add the following to your cmake command:

-DCMAKE_C_FLAGS=-fuse-linker-plugin -DCMAKE_CXX_FLAGS=-fuse-linker-plugin

(you can set the CMAKE_C_FLAGS adn CMAKE_CXX_FLAGS variables in your {build dir}/CMakeCache.txt file either using text editor or the ccmake tool)

Debugging options

Recommended for accurate debugging: The default debug setting is RelWithDebInfo which is suitable only for obtaining backtraces. If you are developing or debugging an application by setting breakpoints, watchpoints, using step by step command accurately in your debugger, if you rely on assertions, debug and warning messages, you can replace -DCMAKE_BUILD_TYPE=RelWithDebInfo with:

-DCMAKE_BUILD_TYPE=DebugFull

Using DebugFull results in a slower code. That can be acceptable in most cases during testing and development given the machine is fast enough. It is not intended for production releases of the software unless you know what you're doing.

Special case for Krita: If you are working on Krita, always use the KritaDevs option by setting:

-DCMAKE_BUILD_TYPE=KritaDevs

Updating and Rebuilding

If the source code has been cloned using Git, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.

Type:

cd $HOME/kde4/src/calligra
git pull --rebase
cd $HOME/kde4/build/calligra
make
make install

(note that you can always append the -jN option to the make command to speed up the build as explained earlier in the Speed up section.

Building Selected Applications

Using Product Sets

By default, the build system tries to build all applications. The recommended way to change this is to specify a different product set by setting the PRODUCTSET CMake variable. The following table illustrates the predefined product sets.

Application Product Set
DESKTOP CREATIVE ACTIVE OSX ALL
Active X X
Author X X X
Braindump X X X
Flow X X X
Karbon X X X X
Kexi X X
Krita X X X X
Plan X X
Sheets X X X
Stage X X X
Words X X X

For example, to build the CREATIVE product set, pass

-DPRODUCTSET=CREATIVE

on the CMake command line.

Note-box-icon.png
Note
The set of included plugins, import/export filters and extra tools may differ between product sets. Consult the product set definitions in the cmake/productsets directory of the Calligra sources for detailed information about what is included in each product set.


Specific Product Sets

For convenience, specific cases have been covered by extra product sets.

Application Product Set
KEXI KEXI+SHEETS KRITA
Active
Author
Braindump
Flow
Karbon
Kexi X X
Krita X
Plan
Sheets X
Stage
Words

Fine-grained Selection

Advanced users and developers wishing to design completely own productsets can do so. How to do that is described in the file README in the cmake/productsets directory of the Calligra sources. Creating own productsets is the recommended solution for this wish.

Alternatively, though not recommended, instead of designing completely own productsets, it is also possible to disabe products from a selected pre-defined productset. One does so by setting the corresponding BUILD_{application} variable to OFF. For example, to disable compilation of Krita and Karbon, you can pass

-DBUILD_krita=OFF -DBUILD_karbon=OFF

on the CMake command line. You can also do this using the ccmake tool included with CMake, which you may run after the initial CMake run but before you run make.

Note-box-icon.png
Note
Many components should not be disabled using BUILD_{something}. Set these variables with caution!


Running Calligra Applications

After you installed them, there are two options to now make the Calligra applications available for running.

Running from Command Line

If you have installed Calligra in a different prefix than KDElibs (which is recommended in this document), you have to set the environment variables as folows. These are example values reflecting the the recommended directory structure:

export KDEDIRS=$HOME/kde4/inst:$KDEDIRS
export PATH=$HOME/kde4/inst/bin:$PATH
export KDEHOME=$HOME/kde4/.kde
export KDETMP=/tmp/kdedev-$USER
export KDEVARTMP=/var/tmp/kdedev-$USER
export KDESYCOCA=$KDEVARTMP/ksycoca

Make sure temporary directories exist:

mkdir -p $KDETMP
mkdir -p $KDEVARTMP
Note-box-icon.png
Note
It is important to set KDEHOME to a directory different of $HOME/.kde, and if the directory does not exist, it will be created automatically.


Then in this special environment you need to register all the Calligra internal plugins, by executing:

kbuildsycoca4

Running from Menus or Desktop Icons

Instead of using KDEDIRS, you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:

[Directories]
prefixes=/path/to/install

And then you need to register all the Calligra internal plugins to the system, by executing:

kbuildsycoca4

The advantage of this is that KDE will always look for the services where Calligra is installed. For example for the recommended directory structure:

[Directories]
prefixes=$HOME/kde4/inst

Executing Unit Tests

1. To be able to execute unit tests, you need to explicitly enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command in the build directory:

cd $HOME/kde4/build/calligra
cmake -DKDE4_BUILD_TESTS=ON .

Or you can run ccmake . in the buld directory and set KDE4_BUILD_TESTS to "on".

2. Then run the test by executing:

make test

or run a test app individually in the tests directories.

3. Note: It is recommended to execute

make install

before running tests.

CMake Build Options

When you enter your build directory, you can type "ccmake ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.

Here is list for Krita related options:

  • HAVE_MEMORY_LEAK_TRACKER [On/Off] - You can turn on compilation of the tool in krita which detects memory leak. If you want to help debug Krita memory usage, it is useful. Otherwise you just slow down your Krita.
  • HAVE_BACKTRACE_SUPPORT [On/Off] - It is related to the memory leak tool. If you activate, you will be able to see code path which leads to memory leak.

Resources

Possible Issues

If you get errors when running an application like:

krita(8565)/calligra (lib komain) KoPluginLoader::load: Loading plugin "Animation Tool" failed, 
"Cannot load library /home/michael/kde4/inst/lib/kde4/kpresentertoolanimation.so: 
(/home/michael/kde4/inst/lib/libkopageapp.so.7: undefined symbol:
_ZN28KoShapeContainerDefaultModel3addEP7KoShape)" ( 1 ) 

or crashes when starting an application, then you very likely have a version of Calligra installed through your package manager. As emphasized earlier in this document, you can only have one version of Calligra, and you should uninstall your packaged Calligra.

See also:

Note: if you want to build FreOffice using the Nokia Qt SDK, please check out the build instructions on techbase.


Content is available under Creative Commons License SA 4.0 unless otherwise noted.