2013-11-18

my script to configure,compil,build krita , and update or not



Intro :

Almost a year after I released my Compilscripts on GitHub I discovered I
made a mistake.
At the root of the project , Compilscript approach is
broken by design. So,  I decided to stop support for it. 

What was Compilscript ?

Compilscript was a set of scripts to help user to compile and install Krita ( last development version ) and doing maintenance auto-magically. The scripts met a little success. And I'm still proud about all the things I learned while making it.

What's wrong ?

When something irregular happens, Compilscript fail and stop to work  ...  And irregularities are common on Linux.  The user is dependent of a system he doesn't understand. And when it breaks, it breaks his production without letting him know how to fix it. That's not a solution.

A new approach

That’s why I thought the best new approach is
the Arch-way not to give an automatic tool , but creating a documentation dead-easy
to make artist independent in the process and understand what they do.
Artists should be able
to install, update, go back in the history of code if something
doesn’t work for them ; all of this with a minimal and easy to use
documentation.

Fully illustrated

I also offer here a set of illustrations about compiling ( all are released under CC-By  ). I hope those picture will help other project's documentation to be more user friendly and appear more simple to understand by using a simple analogy : a cat building a house. 

Why a cat ?

Because it's well known on the Internet : you can't go wrong with cats. 


This article and illustrations are licensed under a
Creative Commons Attribution 3.0 Unported License

Setup directories



First obligatory step : preparing the place. Around 5GB of disk space will be needed on your home folder. We will set the structure advised by developers :

/home/<your-user-name>/kde4/src/     for the source code.

/home/<your-user-name>/kde4/build/calligra   where Krita will be built

/home/<your-user-name>/kde4/inst  where Krita will be installed

Note : understand <your-user-name> as your user name on this documentation ( Ex :  /home/deevad/kde4/src )

To do it, open a Terminal,  copy the line under (Ctrl+C) then paste it on the Terminal (Ctrl+Shift+V ) :

Also check with your distribution package-manager that no calligra and krita packages are installed.

Use the search field of your package manager and remove packages.

Get the source code

Navigate your folder using the command cd ( change directories ) and the tab key for auto-completion.

Install git from your distribution package-manager.
Then ask git to grab source files, pasting this line code in the Terminal , on the ~/kde4/src directory :

Get the libraries and dependencies

This part can be tricky : each distribution got a different way to manage packages and so installing required libraries.

Krita as a part of Calligra need a large amount of libraries ; and there is not always a single command to get them.
Some distributions ( Ubuntu , OpenSuse ) got a general meta package for this, but other , not.

Read the official wiki documentation section linked here to get the last code to auto-get the libraries list for your operating system.

 ( Note : this link is a wiki, so don't hesitate to edit, correct, and then smooth the installation process for other artist later. ) 

If your distribution is not listed, let's go plan B and find them one by one on your package manager . it sounds painfull, but it will not take really long.

( Note : Some distributions will get sometime naming convention for libraries <library-name>-dev or <library-name>-devel as package name) .

This list will help you :

In rare case, and if your distribution is not recent, it might happen a library provided by your distribution is outdated. You'll need to build this dependencies. Remember , README files and internet search engine are your friends.

Configuring

Configuring with cmake will check if your system is ready and if you get the good libraries installed. So, if any configuration problem happen you'll be able to read what libraries are missing. That's why it's important to read if all is ok.

Also, we will inform cmake our directories structure, and also ask to build only Krita. But before, a cd to do this at the proper place :

Building

After reading the configure output, if all sounds ok , then it's time to build your own Krita.
Still on the folder /kde4/build/calligra, call make with -j<number>, where <number> has to be replaced with the number of parallel job your processor is able to do. Mine is a 8 core, let's use -j8 .

Tip : if you don't know the number of core you have, this little command will answer you the number :

Installing

If make built all the part of Krita without getting a mistake, and till 100% , you can ask make to install it in our install folder.

Path and environment variables

Your install is now done, but your system will not consider your install folder as a part of your system's application.
Let's show to your system the right path, inside a Terminal, copy line by line :

Unfortunately those environment variable are not persistent, and will be lost after a shutdown or a restart of your system and our bridge will collapse.
To set them at any login , write them with your favorite text editor at the end of your ~/.bashrc file.

And then you need to register Krita to the system, kbuildsycoca4 does it by executing in a terminal :

First run

Congratulation ! you can run "last-Krita-from-a-minute-ago" by typing krita on a Terminal or via your desktop main menu.
If this one doesn't show Krita, look at your desktop-environment 's documentation : "how to create a custom launcher" .

Updating

You've heard of a new feature developed , or you read about an annoying bug fixed, and want to update ?
Fine, call git again . This time it will only append to your source folder the missing code lines. Not downloading the whole source pack.

cd into the source folder, then ask git to pull to update your source :

But updating the source will not be sufficient ; to experience your new Krita version, we need to repeat the configure,compile and install process :

If you update daily, you might like to automatise those command by making your own minimal script. I share mine here on 'KDE paste' service .

Rescuing

Recent development version might break, and sometime be unusable. Experimental changes are made daily.

It might affect your productivity if you don't know how to 'go back in time' ( ex: your favorite brush doesn't work anymore ).

But If you know how to do it, no issue can really affect you, because you know how to come back to a previous state.

To travel the source in time we need to read the timeline history. The Terminal tool for it is git log

With git log , you can consult all the last changes to the code, named 'commit' . What interrest us is the long identification number ( ex: 15c1749105a7e7cc56b646a66919c29646f8653a ). You can scroll git log , copy the ID number then quit ( letter Q on keyboard ). Then time-travel your source directory :

Now, configure, compile, and you'll be again in a safe place. Note that I advice the packages gitg or gitk to have a graphic user interface to visualise git history. Also an online version exist here .

To update again to the actual and fresh from a minute ago source-code named master , simply ask git to come back to it with git checkout  then  pull to update :

Conclusion
I hope this documentation will help many user to have good time using Krita development version.
Use the comments to give your feedbacks or ask questions, I'll do my best to update the information on this page.

Useful Links :
- Official Calligra building documentation wiki.
- Calligra Git activities and history
- List of the last updated Krita bugs
- Form to enter a Krita bug
- Old Compilscript repository ( will be deleted soon )
- Krita blog
- Krita forum
- Krita IRC channel  ( answer can arrive sometime after 1 or 2h, be patient )

Special Thanks :
Boudewijn Rempt, Aurélien Gâteau, M.Beast, Yu Asakusa for feedback and help with corrections.

Show more