Building KDE Frameworks 5 (KF5)

#### Beyond Linux® From Scratch - Version 2019-02-27

### Chapter 30. KDE Frameworks 5

- Prev

  KDE Frameworks 5 Pre-installation Configuration

- Next

  KDE Frameworks 5 Based Applications

- Up
- Home

# 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).

This package is known to build and work properly using an LFS-8.4 platform.

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

### Package Information

- Download (HTTP): http://download.kde.org/stable/frameworks/5.55

- Download MD5 sum: See Below

- Download size: 264 MB

- Estimated disk space required: 1.0 GB (224 MB installed)

- Estimated build time: 15 SBU (using parallelism=4)

### KF5 Dependencies

#### Required

Boost-1.69.0, extra-cmake-modules-5.55.0, docbook-xml-4.5, docbook-xsl-1.79.2, giflib-5.1.6, libepoxy-1.5.3, libgcrypt-1.8.4, libjpeg-turbo-2.0.2, libpng-1.6.36, libxslt-1.1.33, lmdb-0.9.23, phonon-4.10.2, shared-mime-info-1.10, URI-1.76, and Wget-1.20.1 (required to download the packages)

#### Recommended

Aspell-0.60.6.1 (Dictionary backend for Sonnet), Avahi-0.7 (DNS-SD backend for KDNSSD), libdbusmenu-qt-0.9.3+16.04.20160218 (built with qt5), NetworkManager-1.14.6 (needed to build NetworkManager-Qt), and polkit-qt-0.112.0 (Authentication backend for KAuth)

#### Optional

BlueZ-5.50 (needed to build Bluez-Qt), ModemManager-1.10.0 (needed to build ModemManager-Qt)

#### Runtime dependency for FrameworkIntegration

Oxygen fonts and Noto fonts

#### Runtime dependencies for kapidox

Doxygen-1.8.15, Jinja2 , and PyYAML

#### Additional image formats support in KImageFormats

JasPer-2.0.14 and OpenEXR

#### Optional dependencies for KIO

MIT Kerberos V5-1.17

#### Optional dependencies for Solid

UDisks-2.8.1, UPower-0.99.9 and media-player-info (runtime)

#### Optional dependency for KWallet

gpgmepp

#### Optional dictionary backends for Sonnet

Hspell and Hunspell

#### Required dependencies for Prison

Datamatrix and QRencode

User Notes: http://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=http://download.kde.org/stable/frameworks/5.55/
    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.55.0.md5 << "EOF"
    c6ea8536f0886a83c89036c26c141cfe  attica-5.55.0.tar.xz
    #f8efb80c1c3c4bfe3ada218fa1eb6daa  extra-cmake-modules-5.55.0.tar.xz
    1d51d64bfaa08b852f93b70be6bb0f8b  kapidox-5.55.0.tar.xz
    9feb5965a5438ea7900b10b6734b6b5d  karchive-5.55.0.tar.xz
    9cf8636f8ecd5699dc4cff2cd003bdaa  kcodecs-5.55.0.tar.xz
    83c4f3c39797bb014ae3d8addda3ee84  kconfig-5.55.0.tar.xz
    b84b0d269fbbf63dba84ba7b345ab77f  kcoreaddons-5.55.0.tar.xz
    fbcc4a6e4daaf8dbbb623c8e58f48748  kdbusaddons-5.55.0.tar.xz
    305545c320e2bd3901ca42a5d2a390fe  kdnssd-5.55.0.tar.xz
    86cdc362ac9b086762725ce50ad02254  kguiaddons-5.55.0.tar.xz
    e22ba2c4be9a642d52202941f311092f  ki18n-5.55.0.tar.xz
    b1be65f6c85633f98e13555fdf185ec7  kidletime-5.55.0.tar.xz
    6d89478ffa273724e47d937cf88715ef  kimageformats-5.55.0.tar.xz
    045f5c3b771e03c4d7d3ed8a61cce555  kitemmodels-5.55.0.tar.xz
    57f6924d2811f47b7805529f66a74f8b  kitemviews-5.55.0.tar.xz
    0f6c2f958cf17b8f3d1f1ae41511e4f1  kplotting-5.55.0.tar.xz
    cec11096084112885bb70c8af54b6c18  kwidgetsaddons-5.55.0.tar.xz
    47b9fdf114802c1618be3a808d3fb5f9  kwindowsystem-5.55.0.tar.xz
    cbc3ebe49b84228d4bea3b9f7dcb9638  networkmanager-qt-5.55.0.tar.xz
    d9d13af96a11f19b68a8787b07a9a8c4  solid-5.55.0.tar.xz
    9c2820d220904d527568ac3fd0ef901a  sonnet-5.55.0.tar.xz
    c78281f2572886467e906c7441673930  threadweaver-5.55.0.tar.xz
    9caa8c9db684df909a404c987b20bcd2  kauth-5.55.0.tar.xz
    51cfb4f5aafea5e85fb962da96e7eac3  kcompletion-5.55.0.tar.xz
    44f4b49602863fcfbaa2b142d913ebe2  kcrash-5.55.0.tar.xz
    bab2d57e0f7d0654e1c551c2c4e27a12  kdoctools-5.55.0.tar.xz
    e6095ee56197b9d67c1393ba53c7d3d0  kpty-5.55.0.tar.xz
    4476d603af984cb6322a9f831a906c41  kunitconversion-5.55.0.tar.xz
    5f36ce8b06f046d14309afba6307531d  kconfigwidgets-5.55.0.tar.xz
    2b7a006d241718cb3c411a42c67c84b4  kservice-5.55.0.tar.xz
    b7efe78d929ce60c2f6d6f91ffb99da5  kglobalaccel-5.55.0.tar.xz
    d49e0c95cc12e210705f843b8c8ae624  kpackage-5.55.0.tar.xz
    3b9f611ebb82225cd9021f3d8ba65d4e  kdesu-5.55.0.tar.xz
    a088d5a2316ce177c17823a7383216e3  kemoticons-5.55.0.tar.xz
    fcabfaf2a08be0bee4317dd7b48a46ac  kiconthemes-5.55.0.tar.xz
    550af897cf2b536c0b3370c414f2e607  kjobwidgets-5.55.0.tar.xz
    c6f26a73d4ea4835afbc07dd30f24f1b  knotifications-5.55.0.tar.xz
    104ea71b7a1495649a6c2b10ec76d49a  ktextwidgets-5.55.0.tar.xz
    ee8eb1f361e86568f8d63e3eef52c3d9  kxmlgui-5.55.0.tar.xz
    2c6edfead8cbea6eb513b69bd81f352f  kbookmarks-5.55.0.tar.xz
    e9aea329a955d888363452ef57dd351b  kwallet-5.55.0.tar.xz
    5ea8d5b98580eea963e20466fd0949cd  kio-5.55.0.tar.xz
    df0b9df0c1241debaeae2acc634ce917  kdeclarative-5.55.0.tar.xz
    b6903266cb40093a903e3f745c0b45dc  kcmutils-5.55.0.tar.xz
    bf939786cff333aa2d4c25502e4b2d08  kirigami2-5.55.0.tar.xz
    b79143c6c4aa5f5e207c4513bcce0eb8  knewstuff-5.55.0.tar.xz
    56cadbbd46a2b489fe43f063090fc1ce  frameworkintegration-5.55.0.tar.xz
    398d370cfc7060dbd8a2fa31d36a73f7  kinit-5.55.0.tar.xz
    fb2aa145caf992e812de648d77dc3d6d  knotifyconfig-5.55.0.tar.xz
    2be64b9dab33e65523b0a113f95f5fdd  kparts-5.55.0.tar.xz
    e643d57385e5bddb12cba895af11f93e  kactivities-5.55.0.tar.xz
    a53b413d3bd78f90af64da9c6433ffdb  kded-5.55.0.tar.xz
    #9e573a2efc794c7b2056a09ac21113f4  kdewebkit-5.55.0.tar.xz
    40c0bfab00d45324d232d94001903126  syntax-highlighting-5.55.0.tar.xz
    188a9f7d092c93bf06259baf0e83f7d7  ktexteditor-5.55.0.tar.xz
    15ec5f8445a23415a1f51980d1dd40c8  kdesignerplugin-5.55.0.tar.xz
    3238b6fe1c25908de1b38452f206b0a8  kwayland-5.55.0.tar.xz
    2afbba41e0f841b1775b0f002dbf2eca  plasma-framework-5.55.0.tar.xz
    #e605734af73a902175fcafd3de312ec8  modemmanager-qt-5.55.0.tar.xz
    b0dbb756aff5bc0c811411573d43dc5c  kpeople-5.55.0.tar.xz
    22e294d6a362245a0b9a9da19eb84262  kxmlrpcclient-5.55.0.tar.xz
    3242b966706240f90da8c22b0a7e007c  bluez-qt-5.55.0.tar.xz
    1d3f694c8a8a3a71a51ddb7f9172794a  kfilemetadata-5.55.0.tar.xz
    dbcac71cf905d6e282d04964ddd93e9f  baloo-5.55.0.tar.xz
    #6830eded1a3222a3dd91ba16d9fd8f60  breeze-icons-5.55.0.tar.xz
    #a8a6e3889a0b1507bbb16d1c62619438  oxygen-icons5-5.55.0.tar.xz
    5c6c869f871520f53eaf043415b39765  kactivities-stats-5.55.0.tar.xz
    32c65a65016c944a02060f75d65dbf3b  krunner-5.55.0.tar.xz
    #c09b474c3f96c20504834b5df84c54f1  prison-5.55.0.tar.xz
    46ff1ecbdcd631b1a88bc8789b362c1b  qqc2-desktop-style-5.55.0.tar.xz
    bdcbb64afef6a317eadfbfe3e8f08036  kjs-5.55.0.tar.xz
    8f936d42df6edc311758a2be928b3f32  kdelibs4support-5.55.0.tar.xz
    a91b430e12c09d01ec2a67d711737609  khtml-5.55.0.tar.xz
    f5b31ebf9337ee041f2fd9ef05df1494  kjsembed-5.55.0.tar.xz
    f3bad578dc409b557d63cf7f058bd5c9  kmediaplayer-5.55.0.tar.xz
    652b408be88fc8dde4dd6c2cf053588d  kross-5.55.0.tar.xz
    a28376dc7e56982df710307bef1a63e8  kholidays-5.55.0.tar.xz
    bfd74337cb26fe7f011de0eca4f08ffe  purpose-5.55.0.tar.xz
    450567c456f2215cc02ec70c941d5744  syndication-5.55.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.55.0 and oxygen-icons5-5.55.0. The modemmanager-qt package may be built if its optional dependency has been installed. The prison package (bar code reader) may be built if the required external libraries are installed. The kdewebkit may be built if the external package QtWebkit has been built.

## Installation of KDE Frameworks

### 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.8.27 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

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

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

        tar -xf $file
        pushd $packagedir
          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.55.0.md5

    exit

### 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.55.0
    ln -sfvn kf5-5.55.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: There are 48 programs installed in /opt/kf5/bin.
Installed Libraries: There are too many kf5 libraries (191) to list separately.
Installed Directories: /opt/kf5 (symlink to /opt/kf5-5.55.0)

### 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.
kactivitymanagerd | is the KDE Plasma Workspace Activity Manager.
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.
kgenapidox | is a tool to generate API documentation in the KDE style.
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.
kmailservice5 | is a mail service.
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.

Last updated on 2019-02-18 15:50:23 -0600

- Prev

  KDE Frameworks 5 Pre-installation Configuration

- Next

  KDE Frameworks 5 Based Applications

- Up
- Home