📜 ⬆️ ⬇️

Build Krita for Linux for cats


Finally, a translation of the next article from David Revua, an excellent artist using free software, as well as a permanent member of the Krita Foundation and Blender Institute communities. The master shares with novice artists instructions for assembling the latest version of the graphical editor Krita from the source codes. He believes that this process is actually not as complicated and cunning as it seems at first glance. All stages are beautifully illustrated. Join

Introduction


Almost a year after I released the Compilscripts on GitHub , I realized that I had made a mistake. The very idea of ​​the Compilscript approach was wrong, so I decided to stop supporting it .

What is Compilscript?
The Compilscript project was a set of scripts that help users build and install Krita (the latest version for developers) and implement “automatic” maintenance of the program. The scripts have achieved a little success. I'm still proud of how much I learned while I was doing it.

What was wrong?
If something unusual happened, something that I did not take into account, Compilscript gave an error and stopped working ... And since "unusual" is a common phenomenon in Linux, the user depended heavily on a system that he did not understand. And when it broke, it also broke the entire workflow of the user, leaving him unable to fix anything. This is not a solution.
')
New approach
Therefore, I decided that the best way for Arch Linux is not to give an automatic tool, but instead to create documentation that allows the artist to easily perform the process on his own and understand what is happening. The artist should be able to install, update and, in case something does not work, go back to the old version of the code; all this is simple and easy to do using the instructions.

All illustrated
I also offer a number of compilation illustrations (distributed under the CC-By license). I hope these images will help other projects to become more user-friendly and more clearly convey the meaning through a simple analogy: the cat builds a house.

Why a cat?
Because seals are well aware of the entire Internet: with seals it is impossible to make a mistake.

Preparing directories



First required step: site preparation. It will take approximately 5GB of free space in your home directory. We will use the structure recommended by the developers:

/ home / <username> / kde4 / src for source code
/ home / <username> / kde4 / build to build Krita
/ home / <username> / kde4 / inst to install Krita

Note: in this instruction, take <username> as your username (ex: / home / deevad / kde4 / src )

To do this, open the Terminal, copy the line (Ctrl + C) and paste it into the Terminal (Ctrl + Shift + V):

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

Also check with the package manager of your distribution that calligra and krita packages are not installed. Use a search by name and, if necessary, delete them.

Get the source code



Navigate to the folder using the cd (change directory) command and the Tab key to auto-add titles.

cd ~ / kde4 / src

Install git using the package manager of your distribution.
Then give the git command to get the source code, insert this line in the Terminal, being in the ~ / kde4 / src directory:

git clone git: //anongit.kde.org/calligra.git


Attention! Currently (March 2015) in connection with the transition to Qt5, the main development of Krita is in the calligra / 2.9 branch, so immediately after receiving the source texts, you need to switch the current branch with commands

cd ~ / kde4 / src / calligra
git checkout calligra / 2.9


We get libraries and dependencies



This part can be complicated: each distribution kit uses its own way of managing packages, therefore we install libraries. Krita is part of Calligra, therefore it depends on a large number of libraries; and it is not always possible to install them with one command. Some distributions (Ubuntu, openSUSE) have a basic meta package for this, but others do not. Read the official documentation at the link to clarify the code for auto-obtaining the necessary libraries. ( Note: this is a link to a wiki page, so feel free to edit, add, make edits to make this process easier for other users .)

If your distribution is not in the list, go to plan “B” and look for packages one by one in your package manager . It sounds awful, but should not take too long. ( Note: in some distributions these libraries are named according to the principle: <library-name> -dev or <library-name> -devel ).

This list will be useful to you:
git make cmake boost boost-build kdepimlibs eigen kdegraphics-okular
libgsf libwpd libwpg libwps pstoedit glew gsl automoc4 boost libkdcraw
libpqxx fftw opengtl lcms2 vc exiv2

In rare cases, and also if your distribution is outdated, it may happen that only old versions of libraries will be available to you. You will need to collect these dependencies manually. Remember, README files and search engines are your friends.

Configuration



Configuring with cmake will check if there are enough libraries installed to build Krita. If you get errors during configuration, look at which libraries are missing, the output of the command will be written about this. That is why it is important to check that everything is in order.

We inform cmake about our folder structure, and also give the command to build only Krita. But first we do cd to do everything in the right place:

cd ~ / kde4 / build
cmake -DCMAKE_INSTALL_PREFIX = $ HOME / kde4 / inst $ HOME / kde4 / src / calligra -DCMAKE_BUILD_TYPE = RelWithDebInfo -DPRODUCTSET = KRITA

Assembly



After you read the configuration report, if everything looks fine, it will be time to collect Krita.
While remaining in the / kde4 / build folder, invoke make with the -j <number> parameter, where <number> should be replaced by the number of parallel operations supported by your processor (+1 is sometimes recommended). For example, I have 8 cores, so I use -j9.

make -j9

Tip: if you do not know how many cores you have, you can find out with a simple command:

cat / proc / cpuinfo | grep processor | wc -l

Installation



If the build reaches 100% without errors, you can tell the make command to install the files in your folder.

make install -j9

Paths and environment variables




The installation is complete, but your system does not yet consider the contents of the installation folder as part of the set of applications in the system. Let's point out to the system the correct path, in the Terminal we copy in turn the lines:

export KDEDIRS = $ HOME / kde4 / inst: $ KDEDIRS
export PATH = $ HOME / kde4 / inst / bin: $ PATH

Unfortunately, these environment variables are not constant, after shutting down or restarting the system, they will be lost and our bridge will collapse. To set them each time you log in, paste them at the end of the ~ / .profile file with your favorite text editor (in some distributions, the profile is called xprofile, check the hidden files in the home / <username> folder). Then you need to register Krita in the system, kbuildsycoca4 will do this after running in the terminal:

kbuildsycoca4

First start



Congratulations! You can launch “Krita-Minute-Freshness” by writing krita in the Terminal or using the system menu.
If Krita is not displayed there, read the documentation for your desktop environment: "How to create a custom launch button."

Update



Have you heard about the addition of a terrific new feature or read about fixing an annoying bug and want to update the version? Calm, call git again. It is time to add the missing lines of code to your folder. No need to pump the whole package.

Move (cd) to the folder with the code, then ask git pull to update your code:
cd ~ / kde4 / src / calligra /
git pull


But only updating the code is not enough; To test the new version of Krita, you need to repeat the configuration, compilation and installation:
cd ~ / kde4 / build
cmake -DCMAKE_INSTALL_PREFIX = $ HOME / kde4 / inst $ HOME / kde4 / src / calligra -DCMAKE_BUILD_TYPE = RelWithDebInfo -DPRODUCTSET = KRITA
make -j8
make install -j8

If you update daily, you can automate the process by creating your minimum script. I shared it using the 'KDE paste' service .

Recovery



The latest version for developers can sometimes fall or be unsuitable for work. Experimental changes are added daily. This can undermine your productivity if you don’t know how to go back in time (eg: your favorite brush no longer works). But if you know how to do it, nothing will embarrass you , because you can return to the previous state.

To travel through code and time, you need to familiarize yourself with the chronology. The terminal uses git log for this.
cd ~ / kde4 / src / calligra /
git log

With git log , you can track any code changes that are called 'commit'. We are interested in a long identification number (ex .: 15c1749105a7e7cc56b646a66919c29646f8653a). You can scroll through the git log , copy the ID number and exit (the letter Q on the keyboard). Now let's go to the past of your code folder:
git checkout 15c1749105a7e7cc56b646a66919c29646f8653a

Now we configure, compile and we are safe again. I also recommend gitg or gitk packages to have a graphical interface for displaying git history. An online version is also available here.

To upgrade again to the minute freshness code called master, just ask git to go to it with git checkout and get the ( pull ) update:
git checkout master
git pull


Total


I hope this guide will help many users to enjoy the features of the Krita version for developers.
You can leave comments and corrections in the comments, I will do everything I can to maintain the relevance of this page (note lane: I will also try to keep the translation of this article relevant).

Useful links:
- Group of Russian-speaking users in VK

- Error message form (official error database)
- Error form in Russian
- Official Krita Blog
- Official Krita Forum
More links
- Official Calligra build wiki page .
- Calligra Git: Activity and History
- List of detected and fixed bugs Krita
- Old Compilscript repository (will be deleted soon)

Source: https://habr.com/ru/post/252289/


All Articles