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.83.0, extra-cmake-modules-5.109.0, docbook-xml-4.5, docbook-xsl-nons-1.79.2, giflib-5.2.1, libepoxy-1.5.10, libgcrypt-1.10.3, libical-3.0.17, libjpeg-turbo-3.0.1, libpng-1.6.40, libxslt-1.1.39, lmdb-0.9.31, qca-2.3.7, qrencode-4.1.1, phonon-4.12.0, plasma-wayland-protocols-1.11.1, shared-mime-info-2.2, URI-5.21, and Wget-1.21.4 (required to download the packages)

Recommended

Optional

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

Runtime dependency for FrameworkIntegration

Noto fonts

Additional recommended dependencies for kapidox

Additional image formats support in KImageFormats

JasPer-4.1.0, libavif-1.0.2, libraw-0.21.1, libheif, libjxl, and OpenEXR

Optional dependencies for KIO

MIT Kerberos V5-1.21.2

Optional dependencies for Solid

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

Optional dependency for KWallet

GPGME-1.23.1, 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.109/
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.109.0.md5 << "EOF"
b025406c6818d92ad3fedd585bd8a428  attica-5.109.0.tar.xz
#0baf0a3ded2fed5e0442591dde276c4e  extra-cmake-modules-5.109.0.tar.xz
e4cc63aafbbe019ebb8d62f6c02e9d2e  kapidox-5.109.0.tar.xz
d096b76119d8d9da91fd112811d2b408  karchive-5.109.0.tar.xz
64087cda04bec6ad068f22ce1e3dcb1e  kcodecs-5.109.0.tar.xz
fe2b1c516c2f9caadd6c8e3bf35ffd96  kconfig-5.109.0.tar.xz
b88be3c775bef6277e047f09b531ba1d  kcoreaddons-5.109.0.tar.xz
5b00c0b729b5c11d2a5733ea7db5674f  kdbusaddons-5.109.0.tar.xz
993090bb9a0e678154382daa0626fa48  kdnssd-5.109.0.tar.xz
3fc1c5e58a8202cd0722aa7ec99ad584  kguiaddons-5.109.0.tar.xz
13b867e8189e91e402e5e9b9aa33b613  ki18n-5.109.0.tar.xz
d8f87c99c0b798f04ac328d7050d2d97  kidletime-5.109.0.tar.xz
777d46bc3c7c7e66804402220dac2df0  kimageformats-5.109.0.tar.xz
e3321430de25b4b16ad48c6c2f168170  kitemmodels-5.109.0.tar.xz
c5efe890400ab8b97270f9a3e821d510  kitemviews-5.109.0.tar.xz
f334911f97cd4592e3b823dfc518f9eb  kplotting-5.109.0.tar.xz
67f4605da5e119342e91fc4670114a2b  kwidgetsaddons-5.109.0.tar.xz
2b384fcad72c84ccda75f300c14f633c  kwindowsystem-5.109.0.tar.xz
4dcacee7da9987c587511634ca90f064  networkmanager-qt-5.109.0.tar.xz
8952c4756ed0bc072a8bad998ed81bc6  solid-5.109.0.tar.xz
8aff00ce75275252f45d915c478279de  sonnet-5.109.0.tar.xz
f98889ea3fa22aaeaa9f8a85a602f3a6  threadweaver-5.109.0.tar.xz
62195272670cdec8ceb0fbda4bd8c43b  kauth-5.109.0.tar.xz
9b99972d3a25f521c20c04d1867fc3dd  kcompletion-5.109.0.tar.xz
fc2f3a9c7d12066b659b46e13a75e97a  kcrash-5.109.0.tar.xz
43e0fddae05e83dfb7cd0b0bb5cc11e5  kdoctools-5.109.0.tar.xz
7ccb53e9023ada6a5e08e4d562769ef3  kpty-5.109.0.tar.xz
30d32d8dc23c6ad4915be89831238c54  kunitconversion-5.109.0.tar.xz
eb1a478738f8f5bd5ab7bd23145594b7  kconfigwidgets-5.109.0.tar.xz
2353574c0c41d1f9e274d29fc3f174c3  kservice-5.109.0.tar.xz
8f2118a5544acd0bcb9a2202180e1e27  kglobalaccel-5.109.0.tar.xz
f9ce944b2dcc815e8df677b7018530cd  kpackage-5.109.0.tar.xz
737509807d74878037d564ab19f8f4fb  kdesu-5.109.0.tar.xz
f8ec4f236ad6d229294003478b2c8660  kemoticons-5.109.0.tar.xz
8d23dcfeaa45d04f3a03b993794c1929  kiconthemes-5.109.0.tar.xz
b108a7c58d5e63248e4043a6e2d5cd3d  kjobwidgets-5.109.0.tar.xz
37840b5eff97d1cb6105a276a14f6982  knotifications-5.109.0.tar.xz
520e1568726e76671fdbc3c5180d1e12  ktextwidgets-5.109.0.tar.xz
d52b000182f1530befcb9023db853620  kxmlgui-5.109.0.tar.xz
e230f6ef16e636ed103bd30ee9256d9d  kbookmarks-5.109.0.tar.xz
fb90ee7dad377b5fe11cc5a60c0721c5  kwallet-5.109.0.tar.xz
ab29c38a4efbb1c2a8ae844aae1482ea  kded-5.109.0.tar.xz
73fc6504264e620b0f9d0ba96c9d8ca4  kio-5.109.0.tar.xz
1d180f9106dd4e55346bf6b68f144594  kdeclarative-5.109.0.tar.xz
a3a6afb25c9d4dd0b027468c318763cb  kcmutils-5.109.0.tar.xz
4f555c40672c66df4c6d685bee6c5ae1  kirigami2-5.109.0.tar.xz
f355ac0e56c60d258c242bb5115c5879  syndication-5.109.0.tar.xz
9d263510d765e23f80558e8c83b113fd  knewstuff-5.109.0.tar.xz
d3b4d1a97b4c724a99b9920f3931db58  frameworkintegration-5.109.0.tar.xz
3ecd4e79453f9a8b378b87a63a698280  kinit-5.109.0.tar.xz
b65f54d2f7b5c7b54926f147114c3ab4  kparts-5.109.0.tar.xz
7111af3ca1d17b3b085513bf4067557e  kactivities-5.109.0.tar.xz
#929785c0f7a5594f4eac30c2f40645d5  kdewebkit-5.109.0.tar.xz
e970abb368b963a075f10f2ef26a95c0  syntax-highlighting-5.109.0.tar.xz
9405ebf54d7c675a39ef00afc81e472d  ktexteditor-5.109.0.tar.xz
cd659fa310535c476d3dcb7cba5499f8  kdesignerplugin-5.109.0.tar.xz
b9ce7efb96ee1f88f3d8c505a3c8e8b1  kwayland-5.109.0.tar.xz
08ec7edef427f681dfb3b1533ab0d880  plasma-framework-5.109.0.tar.xz
5e66a95d9998d4874aa1d9004b2bdc50  modemmanager-qt-5.109.0.tar.xz
e66ebdbc5547881e8562bab6a02ce8bb  kpeople-5.109.0.tar.xz
a1af96f8f082e4f9fca0ce476528b6ae  kxmlrpcclient-5.109.0.tar.xz
91a2f23a8a88b7ac17c94f70b50a6b71  bluez-qt-5.109.0.tar.xz
c796f5097f2185c33a61d8e32a296066  kfilemetadata-5.109.0.tar.xz
2d0a01f671615c6a1559eaa4d73193c2  baloo-5.109.0.tar.xz
#40721040f8c42a60450a94b7975d18e3  breeze-icons-5.109.0.tar.xz
#cb7872cff65fe1f62815339f40c639d8  oxygen-icons5-5.109.0.tar.xz
f09fd15d79bca7374094ea1126e6aef6  kactivities-stats-5.109.0.tar.xz
7c7a7502b568b7c3c45f7c43cefa92e7  krunner-5.109.0.tar.xz
00d1282f4dd770085cf2d72371cd3388  prison-5.109.0.tar.xz
12f3d0a80404bcd1111f5164d8e9dfd0  qqc2-desktop-style-5.109.0.tar.xz
4ca7a857b39d805ba61c94d17cbe6862  kjs-5.109.0.tar.xz
06545a811be0293dc9a79d65ce265a4e  kdelibs4support-5.109.0.tar.xz
2c1d3e7d57e6793e7bfbcd7424a199bc  khtml-5.109.0.tar.xz
b9ab15ac90dece7fa6b623be95ef40f9  kjsembed-5.109.0.tar.xz
405558700e5518f7e25eb252c0027410  kmediaplayer-5.109.0.tar.xz
e647b806ba546ea010b304f707a9d696  kross-5.109.0.tar.xz
0fc9e9fda1d3a55fd61f655a1dec0b39  kholidays-5.109.0.tar.xz
08946785eb0fa4a3d5b1ac174433f9a7  purpose-5.109.0.tar.xz
c4faaf8fa6587a0b80a0618810e9d41a  kcalendarcore-5.109.0.tar.xz
588289805cb18731d9b73ea86236b458  kcontacts-5.109.0.tar.xz
08b2dcd842dfcda7e406d16646b082bb  kquickcharts-5.109.0.tar.xz
8612d9d00ff9daeb507548ed9150d00d  knotifyconfig-5.109.0.tar.xz
d4e4e96920394601cf599ed8e36bd635  kdav-5.109.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.109.0 and oxygen-icons5-5.109.0. The kdewebkit package 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.15p2 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       &&
install -v -dm755           $KF5_PREFIX/lib         &&
ln -sfv /usr/lib/systemd    $KF5_PREFIX/lib

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 --no-cache-dir $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.109.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.

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.109.0
ln -sfvn kf5-5.109.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.109.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