The first thing to do is to open the Cat’s Guide To Building Krita, because that’s the base for what I’m going to try to explain here. It’s what I use for developing Krita. I usually have every version from 2.4 up ready for testing.
Now — there are very good reasons why you might want to have more than one version of Krita available. Currently, the master branch is frozen, and when it opens up, it’ll be for the Qt5 port. We’re fixing bugs like crazy in the Calligra/2.9 branch, and there’s a ton of cool stuff in there, but if your livelihood depends on Krita, you might want to use 2.8 until, say, we release 2.9.1…
So, here’s how to set that up. On Linux, of course. Building Krita on Windows or OSX is a pain.
First: remove your distribution’s Krita and Calliga packages.
As per the Cat’s guide, setup your environment, but do not create the ‘inst’ dir:
mkdir -p $HOME/kde/src mkdir -p $HOME/kde/build
Instead, we create different install directories for different versions. Let’s setup 2.8, 2.9 and git master:
mkdir -p $HOME/kde/2.8 mkdir -p $HOME/kde/2.9 mkdir -p $HOME/kde/master
Get the source code (again, check the Cat guide!):
cd ~/kde/src git clone git://anongit.kde.org/calligra.git
Now, get the git-new-workdir script. Here’s a copy on my webserver. Or check whether your distribution provides it. We’ll use it to make two new source directories out of the repository you just cloned:
cd ~/kde/src git-new-workdir calligra 2.8 cd 2.8 git checkout calligra/2.8
cd ~/kde/src git-new-workdir calligra 2.9 cd 2.9 git checkout calligra/2.9
Now you’ve got the source code for Calligra Master in ~/kde/src/calligra, for the 2.8 stabele version in ~/kde/src/2.8 and the 2.9 beta branch in ~/kde/src/2.9.
Get the libraries and dependencies. This wiki page has a lot of details: Calligra/Building. The Cat’s guide’s list is a bit outdated. Here’s the full list of dependencies we need for Krita:
- KDE (minimum 4.3)
- Qt4 (minimum 4.6)
- boost and boost-system
- Vc (the 0.7 release)
- Poppler and Poppler-Qt
- openjpeg (optional)
- fftw3 (optional, but will make blur much faster)
- openColorIO (optional, for HDR painting)
And you need cmake, make and the compiler, of course.
Now you can setup your build directories. This is different from the Cat’s guide and note that you cannot move your existing build directory around:
cd ~/kde/build mkdir master mkdir 2.8 mkdir 2.9
Now download the ‘changeto’ script and put it somewhere where you can execute it. It’s a really simple script: all it does is move around a symlink, like this:
rm ~/kde/inst ln -s ~/kde/2.8 ~/kde/inst
The script has a couple of commented lines you can enable to setup switching your configuration and settings, too, but I don’t use that myself. There are other ways to setup this, of course. This is simple-minded enough that it works for me… Note: the -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4 is needed on systems like Ubuntu where Qt5 is the default: check whether qmake is Qt4 or Qt5 first.
cd ~/kde/build/2.8 cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde/inst $HOME/kde/src/2.8 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPRODUCTSET=KRITA -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4
And build and install Krita 2.8. Then execute the changeto script:
And do what we just did for 2.9 — the same commands, but replace 2.8 with 2.9. You could do the same again for master — changeto master and build and install the master branch from the ‘calligra’ directory.
For the rest the setup is the same. If you setup your paths to point to $HOME/kde/inst and switch with changeto to the version you use, you can safely use Krita 2.8, Krita 2.9 Beta1 or git master whenever you want. You probably don’t need to ever update 2.8 again and you can keep Krita 2.9 updated as per the Cat’s guide.
Note that Krita 2.8 needs the kbuildsycoca command from the Cat’s guide, but Krita 2.9 doesn’t anymore. Everytime you switch to 2.8, execute kbuildsycoca.
If you run into trouble, join us on irc and ping me — but keep in mind that I am in Europe and enjoy my eight hours sleep every night.