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 LFS or dependencies have been updated since the most recent stable versions of the books.

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.82.0, extra-cmake-modules-5.106.0, docbook-xml-4.5, docbook-xsl-nons-1.79.2, giflib-5.2.1, libepoxy-1.5.10, libgcrypt-1.10.2, libical-3.0.16, libjpeg-turbo-3.0.0, libpng-1.6.40, libxslt-1.1.38, lmdb-0.9.31, qca-2.3.6, qrencode-4.1.1, phonon-4.11.1, plasma-wayland-protocols-1.10.0, shared-mime-info-2.2, URI-5.17, and Wget-1.21.4 (required to download the packages)

Recommended

Optional

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

Runtime dependency for FrameworkIntegration

Oxygen fonts and Noto fonts

Additional recommended dependencies for kapidox

Additional image formats support in KImageFormats

JasPer-4.0.0, libavif-0.11.1, libraw-0.21.1, libheif, libjxl, and OpenEXR

Optional dependencies for KIO

MIT Kerberos V5-1.21.1

Optional dependencies for Solid

UDisks-2.10.0, UPower-1.90.2 and media-player-info (runtime)

Optional dependency for KWallet

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

Optional dependency for kdewebkit

QtWebkit

Optional dictionary backends for Sonnet

Hspell and Hunspell

Editor 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.106/
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.106.0.md5 << "EOF"
c9548a1bcbc9ee52aa381de5a9822b10  attica-5.106.0.tar.xz
#16b1ad1b3a7151d84ff2104f07237a3b  extra-cmake-modules-5.106.0.tar.xz
11e897a44a0fed30473f1e7aee3b11e8  kapidox-5.106.0.tar.xz
dfd9803d588061c420e4c21e45bbc82b  karchive-5.106.0.tar.xz
6d53afadf98dc09647fedf3a3d519c90  kcodecs-5.106.0.tar.xz
6e618177050612191057f906d51ad98a  kconfig-5.106.0.tar.xz
71071280a3b5313681dbefb89c4dd889  kcoreaddons-5.106.0.tar.xz
bb60e1b80909b3293ea0be046b4c6827  kdbusaddons-5.106.0.tar.xz
785877a24b481b4fae0bd54c7b7196a0  kdnssd-5.106.0.tar.xz
2af14a9b137197513b1022490fb6fdfa  kguiaddons-5.106.0.tar.xz
06e8dc354a7d46761cdaab0ab6e458f6  ki18n-5.106.0.tar.xz
8f2548f1407fe4e09f9b7339af82f108  kidletime-5.106.0.tar.xz
8c8f404c8628aa3db7b37bef6de53664  kimageformats-5.106.0.tar.xz
13aaa10de79d49d2781ce7a0890b724d  kitemmodels-5.106.0.tar.xz
964c2693c15ea496a41c47c5ac286222  kitemviews-5.106.0.tar.xz
e37e4e120db15ab92a3fe6ef0207c223  kplotting-5.106.0.tar.xz
87ca3355280eda48f6a61eef25167e66  kwidgetsaddons-5.106.0.tar.xz
a4982009669cedee946a5379fc1a4c30  kwindowsystem-5.106.0.tar.xz
2572346e5daabf8d5be3418a69a70451  networkmanager-qt-5.106.0.tar.xz
3bfafc664f1e5d025a6ebaa1baa793d7  solid-5.106.0.tar.xz
caca4e217329a85cd58b78bab3cbe167  sonnet-5.106.0.tar.xz
2f7cd398bfdf759a33999f4a4e81cd74  threadweaver-5.106.0.tar.xz
fc1f6a8a6cde23a0c77c1e354a3e243c  kauth-5.106.0.tar.xz
00eb8503138799b934642e3a7ebfe142  kcompletion-5.106.0.tar.xz
281d83ff9bedc95bc5ae6c8c3a66bea1  kcrash-5.106.0.tar.xz
73636293c4b66b07c1789b0e6ae5458b  kdoctools-5.106.0.tar.xz
56b51a26a6a82c1d724b8a63c85f46e9  kpty-5.106.0.tar.xz
4e28d363dc42525fc2f1708c064379bb  kunitconversion-5.106.0.tar.xz
795e05c9e41061b45d127bad60ab6765  kconfigwidgets-5.106.0.tar.xz
7109d500ee2055736e4723f8e390e7d3  kservice-5.106.0.tar.xz
8c2dbab0024e9c17c0d9c3220938190d  kglobalaccel-5.106.0.tar.xz
d46f04644047108488bbce0d4d876a18  kpackage-5.106.0.tar.xz
56a36906e5b218ef62cd9fa0aa372b3c  kdesu-5.106.0.tar.xz
ecff8e66871f3db534161dab62bdd0cd  kemoticons-5.106.0.tar.xz
e4b939308e0a5fd119794ee3643c2028  kiconthemes-5.106.0.tar.xz
b24dee45b9cb1698e1949b6ec9bc47f7  kjobwidgets-5.106.0.tar.xz
1c366d3a17dfc51724790517414db993  knotifications-5.106.0.tar.xz
ef6aa42a38bbb9fca8db8aaddb050293  ktextwidgets-5.106.0.tar.xz
5c15337714c5c7806d545e877c35483c  kxmlgui-5.106.0.tar.xz
b30a04c5a05be86a5a8c25cc8513c757  kbookmarks-5.106.0.tar.xz
3057a1b16262cd5fd5570a62b751a6d7  kwallet-5.106.0.tar.xz
a7f57864564e38aaff1ca23843d4056a  kded-5.106.0.tar.xz
5f18940a736b3991060b0c4e73074c68  kio-5.106.0.tar.xz
d225d89c6b114f56c97f8413da3138f2  kdeclarative-5.106.0.tar.xz
e01f86ba9b8948f8a5edaf5dfa47e574  kcmutils-5.106.0.tar.xz
f32e5add05190a77eff2d47fbce9cee1  kirigami2-5.106.0.tar.xz
94e9226872126929c24d59538fb8d951  syndication-5.106.0.tar.xz
2124ff91ba84e76d291199447e7bf020  knewstuff-5.106.0.tar.xz
43cd745baa65088a81bf96338eff3b0e  frameworkintegration-5.106.0.tar.xz
3e4f651f912935212b3aac20c1fb21df  kinit-5.106.0.tar.xz
bdebdd84a1237b2de43f258435970083  kparts-5.106.0.tar.xz
f24170e4aee172a2ac85b478443d139c  kactivities-5.106.0.tar.xz
#62039700ab8494b2bc623e39b1101222  kdewebkit-5.106.0.tar.xz
c3167f33196c8e4ae86752b28de280d2  syntax-highlighting-5.106.0.tar.xz
282aff486eb50c1e0529065caf4fd341  ktexteditor-5.106.0.tar.xz
e2ff93005477446119dcc0b8698ea53c  kdesignerplugin-5.106.0.tar.xz
e6b40bfbefa781ebc22dc6d2d95e6c42  kwayland-5.106.0.tar.xz
de7bc5553f002e7ef149f6aedc91481b  plasma-framework-5.106.0.tar.xz
d3cf2ad7ff94041682e62a01ba795f4c  modemmanager-qt-5.106.0.tar.xz
6850b289edfeba9f67eef13ab9fc40db  kpeople-5.106.0.tar.xz
2076b4836462ef1800106d55bdca2d6c  kxmlrpcclient-5.106.0.tar.xz
9369365e6b6aa7404f7036f9ef9556ef  bluez-qt-5.106.0.tar.xz
ea8bc3c476bb27342fafb32fcb7dd6a6  kfilemetadata-5.106.0.tar.xz
4117ce30552eea7fa2e55a5f3632d929  baloo-5.106.0.tar.xz
#a333a53590aff3b74a1b594b53f3dacb  breeze-icons-5.106.0.tar.xz
#c77ae5f7f33ebea5769fee4100a9a768  oxygen-icons5-5.106.0.tar.xz
c11114fa56c73e5d0512244896f16e62  kactivities-stats-5.106.0.tar.xz
db7de47bc0f73fb63dd0a5f880617266  krunner-5.106.0.tar.xz
f6c429a37904acd4a8a8cfe9ec3b0c91  prison-5.106.0.tar.xz
1cdc450fa7e1e07cf637e6026e6768f9  qqc2-desktop-style-5.106.0.tar.xz
2e347ab380b8b7450119bddbd505a560  kjs-5.106.0.tar.xz
16d7628e6576c9acb742bff169dec14d  kdelibs4support-5.106.0.tar.xz
92601cc332432e615352652a2ec49d3b  khtml-5.106.0.tar.xz
e92614ac995ec56dbbb3dfd37f82ca8b  kjsembed-5.106.0.tar.xz
b2d2fa392ab236e15d3376b5ca8bd01a  kmediaplayer-5.106.0.tar.xz
22918b1811f5c813f3a5246edd184fec  kross-5.106.0.tar.xz
cba74a08d4dcf9664dc4833be478206c  kholidays-5.106.0.tar.xz
6bda5c85b614940ac9c4e9bf30a4b9a0  purpose-5.106.0.tar.xz
6b88780028330d903aa49799fced871d  kcalendarcore-5.106.0.tar.xz
e63befc8f0c2c9cd8d7c426e42e3e095  kcontacts-5.106.0.tar.xz
d8e656dfa8c58277652234e3622fcc4b  kquickcharts-5.106.0.tar.xz
28a004a6220918538cd5d27aa7aa1a9c  knotifyconfig-5.106.0.tar.xz
3a6fa0e3ea44dee8316ddec6a9da25c8  kdav-5.106.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.106.0 and oxygen-icons5-5.106.0. The kdewebkit may be built if the external package QtWebkit has been built.

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.14p2 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)
          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
          ;;
        kfilemetadata)
          sed -i s/toLong/toUint32/g src/extractors/exiv2extractor.cpp
          ;;
      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.106.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.106.0
ln -sfvn kf5-5.106.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.106.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