Building KDE Frameworks 5 (KF5)

KDE Frameworks 5 is a collection of libraries based on top of Qt5 and QML derived from the monolithic KDE 4 libraries. They can be used independent of the KDE Display Environment (Plasma 5).

[Note]

Note

Development versions of BLFS may not build or run some packages properly if dependencies have been updated since the most recent stable versions of the book.

The instructions below build all of the KDE Frameworks packages in one step by using a bash script.

Package Information

KF5 Dependencies

Required

Boost-1.80.0, extra-cmake-modules-5.97.0, docbook-xml-4.5, docbook-xsl-nons-1.79.2, giflib-5.2.1, libepoxy-1.5.10, libgcrypt-1.10.1, libical-3.0.14, libjpeg-turbo-2.1.4, libpng-1.6.38, libxslt-1.1.37, lmdb-0.9.29, qca-2.3.4, qrencode-4.1.1, phonon-4.11.1, plasma-wayland-protocols-1.8.0, shared-mime-info-2.2, URI-5.12, and Wget-1.21.3 (required to download the packages)

Recommended

Optional

BlueZ-5.65 (needed to build Bluez-Qt), ModemManager-1.18.12 (needed to build ModemManager-Qt), Datamatrix (deemed recommended for Prison by upstream)

Runtime dependency for FrameworkIntegration

Oxygen fonts and Noto fonts

Additional recommended dependencies for kapidox

Other python modules needed by kapidox

doxypypy, doxyqml, and requests, which itself depends on certifi, charset-normalizer, idna, and urllib3 (all will be installed by the pip3 install command below)

Additional image formats support in KImageFormats

JasPer-3.0.6 and OpenEXR

Optional dependencies for KIO

MIT Kerberos V5-1.20

Optional dependencies for Solid

UDisks-2.9.4, UPower-1.90.0 and media-player-info (runtime)

Optional dependency for KWallet

GPGME-1.18.0, built with C++ bindings (which is the default).

Optional dictionary backends for Sonnet

Hspell and Hunspell

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/kf5

Downloading KDE Frameworks

The easiest way to get the KDE Frameworks packages is to use a single wget to fetch them all at once:

url=https://download.kde.org/stable/frameworks/5.97/
wget -r -nH -nd -A '*.xz' -np $url

The options used here are:
  -r            recurse through child directories
  -nH           disable generation of host-prefixed directories
  -nd           do not create a hierarchy of directories
  -A '*.xz'     just get the *.xz files
  -np           don't get parent directories

Setting Package Order

The order of building files is important due to internal dependencies. Create the list of files in the proper order as follows:

cat > frameworks-5.97.0.md5 << "EOF"
b6bc2ad39f48daf021eb6e3146ea1b2f  attica-5.97.0.tar.xz
#9004ad7e58f5d3ef4a68ac9d3d432c51  extra-cmake-modules-5.97.0.tar.xz
f16a3cbba1d24c73dde77895e77f9633  kapidox-5.97.0.tar.xz
fcf875c8408891c62bb15e2ffa1f523e  karchive-5.97.0.tar.xz
c4fda652d325ce599821b898c710105e  kcodecs-5.97.0.tar.xz
e007684ef4b71aa63c997f7e53257936  kconfig-5.97.0.tar.xz
aa862f672a8dfaef39af0dda8c3ea892  kcoreaddons-5.97.0.tar.xz
97dfc5ff026d71ac18ad862b1b04fdd5  kdbusaddons-5.97.0.tar.xz
effc56abeefd23cf38be0d1448c48092  kdnssd-5.97.0.tar.xz
2211961bfca22edd9b7bb4c28d3d3c94  kguiaddons-5.97.0.tar.xz
7c92678a3cbd23cc2245fa0258f5e4fb  ki18n-5.97.0.tar.xz
5ab6acca13664b38a0f789f74416b834  kidletime-5.97.0.tar.xz
8dea9b3373b266ea00eef1875e154e16  kimageformats-5.97.0.tar.xz
2b35af1ee245563dd5b521e756228e00  kitemmodels-5.97.0.tar.xz
96daac9f4c21bab82d1da2d980f614c6  kitemviews-5.97.0.tar.xz
aac1e13fb038a54a4f907665200c3c69  kplotting-5.97.0.tar.xz
c5343837bea2bb66ed8fa6371a2b9ee6  kwidgetsaddons-5.97.0.tar.xz
9b561803e8776cc1eda0809cb31f9dda  kwindowsystem-5.97.0.tar.xz
3d812644475d1f3dfeea44f4b1b7e36b  networkmanager-qt-5.97.0.tar.xz
373c435787485e571ca95f8f4b408181  solid-5.97.0.tar.xz
8975618339356417006c31da3b8ca8c1  sonnet-5.97.0.tar.xz
a22052df457b0d08f8ba15fd6f25c4a5  threadweaver-5.97.0.tar.xz
f3e57280dd260385559a531fbe8d2fc3  kauth-5.97.0.tar.xz
a4a5c5b82eb731b2229fab92d3dfb1cb  kcompletion-5.97.0.tar.xz
7d96391d642ce153a9eaae3c63b112e1  kcrash-5.97.0.tar.xz
76db6e9f9200fad4b9cbc3b01ae3755f  kdoctools-5.97.0.tar.xz
99655561b2bbd14e414b132d44bb8d90  kpty-5.97.0.tar.xz
954fc91f33ec53de224156cc10bc04c4  kunitconversion-5.97.0.tar.xz
1c150ec6adaf8685af8bc80256560a86  kconfigwidgets-5.97.0.tar.xz
3793f484ae97355d279731bb9de6f97a  kservice-5.97.0.tar.xz
029f666542f69e6f543dc18a3e02023c  kglobalaccel-5.97.0.tar.xz
d4f3946ac9544e80999ab436a27619dc  kpackage-5.97.0.tar.xz
208f34d8c979f7060958d1eee5ab91cd  kdesu-5.97.0.tar.xz
18edfe35f0d2fc06bd628c515ca47bcf  kemoticons-5.97.0.tar.xz
798e5c986dae8e2f1e83ab0868bf1fb8  kiconthemes-5.97.0.tar.xz
d4cc3101b12bd36cf4a87f0c3936ccf1  kjobwidgets-5.97.0.tar.xz
3980c8e6b94716b0d19b9e2a7d730596  knotifications-5.97.0.tar.xz
1af7d339e2f5a2a540e51339c04d1b0a  ktextwidgets-5.97.0.tar.xz
05caf363dee221bab3de1904ec53978a  kxmlgui-5.97.0.tar.xz
5836416fb862f7957dfaa08e88beb1b0  kbookmarks-5.97.0.tar.xz
b7b3921f31d6d5d8776ea68545b8ae5b  kwallet-5.97.0.tar.xz
da9188168e736982b2434f852cf3440c  kded-5.97.0.tar.xz
5cba35e9783a7df9f0f54af18c2ef368  kio-5.97.0.tar.xz
7e8f1dc158a5a175c0d83dc2427c71ef  kdeclarative-5.97.0.tar.xz
5d7fc8b6947106760c5d17e4dfea3eeb  kcmutils-5.97.0.tar.xz
1ff454d283acb8f83105acb8cf97e544  kirigami2-5.97.0.tar.xz
94d97bd68e2f3a0c5cfb55060194b349  syndication-5.97.0.tar.xz
177bb5f04eea4ea522aacda8761af2af  knewstuff-5.97.0.tar.xz
61b8d7692ad04acefcb76586cb767161  frameworkintegration-5.97.0.tar.xz
bd9eb91ce374b4156f1f00dcd69dbb2f  kinit-5.97.0.tar.xz
0a635ff4847c3642630309072f5370a1  kparts-5.97.0.tar.xz
2c742c8bd4c219546e697ea04c44349f  kactivities-5.97.0.tar.xz
#b67212701c202167ba858c76292cf878  kdewebkit-5.97.0.tar.xz
8baf05c07c7dc9dfca1a4e1f6ca9be67  syntax-highlighting-5.97.0.tar.xz
ee86c062e6243938488fa9d348eaa096  ktexteditor-5.97.0.tar.xz
ce4f59beb52eea5b5b859fca12efa0f7  kdesignerplugin-5.97.0.tar.xz
c0943e04bb7f514c58bcb9b891efb080  kwayland-5.97.0.tar.xz
f6057058a81114c935a3d7b499d86ed5  plasma-framework-5.97.0.tar.xz
#5055670cd06b0724530ff8fbfc0c5ce8  modemmanager-qt-5.97.0.tar.xz
2c0c9727577fd9c3ad76edb9782c7ef2  kpeople-5.97.0.tar.xz
2b2440eba6e162dc1656d6509034bba8  kxmlrpcclient-5.97.0.tar.xz
ae5ee6e46e3f9d4942ba7bb80f8315b9  bluez-qt-5.97.0.tar.xz
a204986f080c48927a4adb86267ba812  kfilemetadata-5.97.0.tar.xz
a4b34f2125d5383a5a4a39cdc3be1573  baloo-5.97.0.tar.xz
#ad6ca5a1b4bcd4613fe1095b2db58a97  breeze-icons-5.97.0.tar.xz
#7e8e52f68e5150fdd76f719a723bef6a  oxygen-icons5-5.97.0.tar.xz
7602faea0198bd90d4be8a4fd9a801bc  kactivities-stats-5.97.0.tar.xz
f3ec8fb5cd8c5122d168ba5c88d5e14b  krunner-5.97.0.tar.xz
49768a3b67be8b6d71991c1718fb7c4d  prison-5.97.0.tar.xz
a5a7b1ca6070ff7b6dffa95c26b3e5ef  qqc2-desktop-style-5.97.0.tar.xz
320e05aedf589b7ac7fa1d8306bbc848  kjs-5.97.0.tar.xz
100e234811619545ae2f3593d6a3b2f0  kdelibs4support-5.97.0.tar.xz
4fd0814002839e5b59f51900d0b78e58  khtml-5.97.0.tar.xz
45cf95eaf299f321dd13ad7b8a17dc97  kjsembed-5.97.0.tar.xz
05822933cf655c80e224e0485851a444  kmediaplayer-5.97.0.tar.xz
85e084c6a4840153a9fccb581e60dad6  kross-5.97.0.tar.xz
c615b5e81ea72ae6bf34a99bfc0e2a79  kholidays-5.97.0.tar.xz
f39b30f3694af24dac61c1071ed5d068  purpose-5.97.0.tar.xz
a77b9f69f5975628b8ca33d97ae2a39d  kcalendarcore-5.97.0.tar.xz
5ed0abb402a5d4b3de57a6617e208536  kcontacts-5.97.0.tar.xz
b31f41825fe3559f15585e55486ef0a2  kquickcharts-5.97.0.tar.xz
ebf49cc30a267ec0ab45c7e857e3fcd9  knotifyconfig-5.97.0.tar.xz
41abc6ed2ff884c1400fc9caa0138731  kdav-5.97.0.tar.xz
EOF

In the above list, notice that some files have been commented out with a hash (#) character. The extra-cmake-modules entry has been commented out because it was built earlier in the Introduction to KDE. The icon packages are covered separately at breeze-icons-5.97.0 and oxygen-icons5-5.97.0. The modemmanager-qt package may be built if its optional dependency has been installed. The kdewebkit may be built if the external package QtWebkit has been built. The kapidox package is a pure python package and cannot be built with the instructions below.

Installation of KDE Frameworks

[Note]

Note

When installing multiple packages in a script, the installation needs to be done as the root user. There are three general options that can be used to do this:

  1. Run the entire script as the root user (not recommended).

  2. Use the sudo command from the Sudo-1.9.11p3 package.

  3. Use su -c "command arguments" (quotes required) which will ask for the root password for every iteration of the loop.

One way to handle this situation is to create a short bash function that automatically selects the appropriate method. Once the command is set in the environment, it does not need to be set again.

as_root()
{
  if   [ $EUID = 0 ];        then $*
  elif [ -x /usr/bin/sudo ]; then sudo $*
  else                            su -c \\"$*\\"
  fi
}

export -f as_root
[Caution]

Caution

If installing in /opt and there is an existing /opt/kf5 either as a regular directory or a symbolic link, it should be reinitialized (as root):

mv -v /opt/kf5 /opt/kf5.old                         &&
install -v -dm755           $KF5_PREFIX/{etc,share} &&
ln -sfv /etc/dbus-1         $KF5_PREFIX/etc         &&
ln -sfv /usr/share/dbus-1   $KF5_PREFIX/share       &&
ln -sfv /usr/share/polkit-1 $KF5_PREFIX/share

First, start a subshell that will exit on error:

bash -e

Install all of the packages by running the following commands:

while read -r line; do

    # Get the file name, ignoring comments and blank lines
    if $(echo $line | grep -E -q '^ *$|^#' ); then continue; fi
    file=$(echo $line | cut -d" " -f2)

    pkg=$(echo $file|sed 's|^.*/||')          # Remove directory
    packagedir=$(echo $pkg|sed 's|\.tar.*||') # Package directory

    name=$(echo $pkg|sed 's|-5.*$||') # Isolate package name

    tar -xf $file
    pushd $packagedir

      # kapidox is a python module
      case $name in
        kapidox)
          # First install some python module dependencies
          as_root pip3 install --no-user doxypypy doxyqml requests

          pip3 wheel -w dist --no-build-isolation --no-deps $PWD
          as_root pip3 install --no-index --find-links dist --no-cache-dir --no-user kapidox
          popd
          rm -rf $packagedir
          continue
      esac

      mkdir build
      cd    build

      cmake -DCMAKE_INSTALL_PREFIX=$KF5_PREFIX \
            -DCMAKE_PREFIX_PATH=$QT5DIR        \
            -DCMAKE_BUILD_TYPE=Release         \
            -DBUILD_TESTING=OFF                \
            -Wno-dev ..
      make
      as_root make install
    popd

  as_root rm -rf $packagedir
  as_root /sbin/ldconfig

done < frameworks-5.97.0.md5

exit
[Note]

Note

Any modules that have been omitted can be installed later by using the same mkdir build; cd build; cmake; make; make install procedure as above.

Useless systemd units have been installed in $KF5_PREFIX/lib. Remove them now (as root):

rm -rf $KF5_PREFIX/lib/systemd

Sometimes the installation paths are hardcoded into installed files. If the installed directory is not /usr, rename the directory and create a symlink:

mv -v /opt/kf5 /opt/kf5-5.97.0
ln -sfvn kf5-5.97.0 /opt/kf5

Command Explanations

-DCMAKE_PREFIX_PATH=$QT5DIR: This switch is used to allow cmake to find the proper Qt libraries.

-DCMAKE_BUILD_TYPE=Release: This switch is used to apply higher level of the compiler optimizations.

-DBUILD_TESTING=OFF: This switch is used to prevent building test programs and libraries that are of no use to an end user.

Contents

Installed Programs: balooctl, baloo_file, baloo_file_extractor, baloosearch, balooshow, checkXML5, depdiagram-generate, depdiagram-generate-all, depdiagram-prepare, desktoptojson, gentrigrams, kactivities-cli, kapidox_generate, kate-syntax-highlighter, kbuildsycoca5, kcookiejar5, kdebugdialog5, kded5, kdeinit5, kdeinit5_shutdown, kdeinit5_wrapper, kf5-config, kf5kross, kgendesignerplugin, kglobalaccel5, kiconfinder5, kjs5, kjscmd5, kjsconsole, knewstuff-dialog, kpackagelauncherqml, kpackagetool5, kquitapp5, kreadconfig5, kshell5, ktelnetservice5, ktrash5, kwalletd5, kwallet-query, kwrapper5, kwriteconfig5, meinproc5, parsetrigrams, plasmapkg2, preparetips5, protocoltojson, and solid-hardware5
Installed Libraries: libkdeinit5_klauncher.so, libKF5Activities.so, libKF5ActivitiesStats.so, libKF5Archive.so, libKF5Attica.so, libKF5AuthCore.so, libKF5Auth.so, libKF5Baloo.so, libKF5BluezQt.so, libKF5Bookmarks.so, libKF5CalendarCore.so, libKF5CalendarEvents.so, libKF5Codecs.so, libKF5Completion.so, libKF5ConfigCore.so, libKF5ConfigGui.so, libKF5ConfigWidgets.so, libKF5Contacts.so, libKF5CoreAddons.so, libKF5Crash.so, libKF5DAV.so, libKF5DBusAddons.so, libKF5Declarative.so, libKF5DNSSD.so, libKF5DocTools.so, libKF5Emoticons.so, libKF5FileMetaData.so, libKF5GlobalAccel.so, libKF5GuiAddons.so, libKF5Holidays.so, libKF5I18n.so, libKF5IconThemes.so, libKF5IdleTime.so, libKF5ItemModels.so, libKF5ItemViews.so, libKF5JobWidgets.so, libKF5JSApi.so, libKF5JsEmbed.so, libKF5JS.so, libKF5KCMUtils.so, libKF5KDELibs4Support.so, libKF5KHtml.so, libKF5KIOCore.so, libKF5KIOFileWidgets.so, libKF5KIOGui.so, libKF5KIONTLM.so, libKF5KIOWidgets.so, libKF5Kirigami2.so, libKF5KrossCore.so, libKF5KrossUi.so, libKF5MediaPlayer.so, libKF5NetworkManagerQt.so, libKF5NewStuffCore.so, libKF5NewStuff.so, libKF5Notifications.so, libKF5NotifyConfig.so, libKF5Package.so, libKF5Parts.so, libKF5PeopleBackend.so, libKF5People.so, libKF5PeopleWidgets.so, libKF5PlasmaQuick.so, libKF5Plasma.so, libKF5Plotting.so, libKF5Prison.so, libKF5Pty.so, libKF5Purpose.so, libKF5PurposeWidgets.so, libKF5QuickAddons.so, libKF5Runner.so, libKF5Service.so, libKF5Solid.so, libKF5SonnetCore.so, libKF5SonnetUi.so, libKF5Style.so, libKF5Su.so, libKF5SyntaxHighlighting.so, libKF5TextEditor.so, libKF5TextWidgets.so, libKF5ThreadWeaver.so, libKF5UnitConversion.so, libKF5Wallet.so, libKF5WaylandClient.so, libKF5WaylandServer.so, libKF5WidgetsAddons.so, libKF5WindowSystem.so, libKF5XmlGui.so, libKF5XmlRpcClient.so, and libkwalletbackend5.so
Installed Directories: /opt/kf5 (symlink to /opt/kf5-5.97.0) if installing in /opt

Short Descriptions

checkXML5

is a tool to check for syntax errors in KDE DocBook XML files

depdiagram-generate

is a tool to generate a dependency diagram

depdiagram-generate-all

is a tool to generate a dependency diagram for all frameworks at once

depdiagram-prepare

is a tool to prepare dot files

desktoptojson

is a tool to convert a .desktop file to a .json file

kbuildsycoca5

rebuilds the KService desktop file system configuration cache

kcookiejar5

is a command line interface to the HTTP cookie store used by KDE, a D-BUS service to store/retrieve/clean cookies

kded5

consolidates several small services in one process

kdeinit5

is a process launcher somewhat similar to the famous init used for booting UNIX

kf5-config

is a command line program used to retrieve information about KDE installation or user paths

kf5kross

executes kross scripts written in KDE Javascript, Python, Ruby, Java and Falcon

kgendesignerplugin

generates widget plugins for Qt(TM) Designer

kglobalaccel5

is a daemon use to register the key bindings and for getting notified when the action triggered

kjs5

is KDE ECMAScript/JavaScript engine

kjscmd5

is a tool for launching KJSEmbed scripts from the command line

kjsconsole

is a console for kjs5

kpackagelauncherqml

is a commandline tool for launching kpackage QML application

kpackagetool5

is a command line kpackage tool

kreadconfig5

is a command line tool to retrieve values from KDE configuration files

kshell5

start applications via kdeinit

ktelnetservice5

is a telnet service

ktrash5

is a helper program to handle the KDE trash can

kwalletd5

is the wallet manager daemon

kwriteconfig5

is a command line tool to write values in KDE configuration files

meinproc5

converts DocBook files to HTML

plasmapkg2

is a tool to install, list, remove Plasma packages

preparetips5

is a script to extract the text from a tips file

solid-hardware5

is a command line tool to investigate available devices