Krita/kf5build

From KDE Community Wiki

This section provides information about 'building Qt5, Kf5 and Krita3.

If you want to figure out bugs in Qt5 and Kf5, you need to build those, too, and need this guide. If you just want to build krita from git master, you should be able to install the kf5 and qt5 devel packages through your package manager and build krita in the usual way.

To build Qt5 and Kf5 follow the instructions in Frameworks/Building on Techbase. I assume that you are building in $HOME/kf5. The result will be completely independent from your kde4 build of Krita. The frameworks instructions have the deps you need for Qt5 and kf5, but you also need Krita's own deps, of course.

you can build just the frameworks with:

./kdesrc-build frameworks

Note

To get all the right things build you need Solid build, and solid depends on udev. On Ubuntu 14.04 this is package libudev-dev


Here's my kdesrcbuildrc, adjust to your home directory:

# Adjust all these settings at will

global

  qtdir /home/boud/kf5/qt5/qtbase
  source-dir /home/boud/kf5/src
  build-dir /home/boud/kf5/build
  kdedir /home/boud/kf5/inst

  git-repository-base kde-projects kde:

  cmake-options -DCMAKE_BUILD_TYPE:STRING=relwithdebinfo -DBUILD_TESTING=false

  # If you want to use ninja instead of make (it's faster!), uncomment the next line
  #custom-build-command ninja

  make-options -j8

  cxxflags -pipe -DQT_STRICT_ITERATORS -DQURL_NO_CAST_FROM_STRING -DQT_NO_HTTP -DQT_NO_FTP -Wformat -Werror=format-security -Werror=return-type -Wno-variadic-macros -Wlogical-op -Wmissing-include-dirs  -std=c++11

  #install-session-driver true

  branch-group kf5-qt5

end global

include extragear/utils/kdesrc-build/data/build-include/kf5-qt5.ksb

The following script will setup all the paths. You should save the script as, say, ~/kf5/kf5.sh and source it when you want to do a spot of Krita3 building.

export KF5=$HOME/kf5/inst

export QTDIR=$HOME/kf5/qt5/qtbase
export CMAKE_PREFIX_PATH=$KF5:$QTDIR:$CMAKE_PREFIX_PATH

export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share
export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg
export XDG_DATA_HOME=$KF5/../local5/share
export XDG_CONFIG_HOME=$KF5/../config5
export XDG_CACHE_HOME=$KF5/../cache5

export PATH=$KF5/bin:$QTDIR/bin:$PATH

export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH

export QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml
export QML_IMPORT_PATH=$QML2_IMPORT_PATH

export KDE_SESSION_VERSION=5
export KDE_FULL_SESSION=true
export KDE_SRC=$HOME/kf5/src
export KDE_BUILD=$HOME/kf5/build

c=`echo -e "\033"`
export QT_MESSAGE_PATTERN="%{appname}(%{pid})/(%{category}) ${c}[31m%{if-debug}${c}[34m%{endif}\
%{function}${c}[0m: %{message}"
unset c

After building Qt and Kf5 as per instructions, you should end up with the following items in the top-level kf5 directory:

~/kf5/build/
~/kf5/cache/
~/kf5/config5/
~/kf5/inst/
~/kf5/kdesrc-build (symlink to ~/kf5/extragear/utils/kdesrc-build/kdesrc-build)
~/kf5/kdesrcbuildrc
~/kf5/kf5.sh
~/kf5/local5
~/kf5/qt5/
~/kf5/src/

If everything has been built, you can checkout the krita src in ~/kf5/src, build it in ~/kf5/build and install to ~/kf5/inst. There are no weird cmake incantations needed.