#### Beyond Linux® From Scratch (System V Edition) - Version 12.3

### Chapter 32. KDE Plasma

- Prev

  pulseaudio-qt-1.7.0

- Next

  GNOME

- Up
- Home

# Building Plasma

KDE Plasma is a collection of packages based on top of KDE Frameworks and QML. They implement the KDE Display Environment (Plasma).

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

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

### Package Information

- Download (HTTP): https://download.kde.org/stable/plasma/6.3.2

- Download MD5 sum: See Below

- Download size: 250 MB

- Estimated disk space required: 2.2 GB (495 MB installed)

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

### Plasma Dependencies

#### Required

Boost-1.87.0, FFmpeg-7.1, GTK-3.24.48, KDE Frameworks-6.11.0, kirigami-addons-1.4.0, libdisplay-info-0.2.0, libpwquality-1.4.5, libqalculate-5.5.1, libnl-3.11.0, libxcvt-0.1.3, libxkbcommon-1.8.0, Mesa-24.3.4 built with Wayland-1.23.0, opencv-4.11.0, phonon-4.12.0, pipewire-1.2.7, pulseaudio-qt-1.7.0, qca-2.3.9, qcoro-0.11.0, sassc-3.6.2, taglib-2.0.2, xdotool-3.20211022.1, and Xorg Evdev Driver-2.11.0

#### Recommended

gsettings-desktop-schemas-47.1, libcanberra-0.30, libinput-1.27.1, libpcap-1.10.5, libwacom-2.14.0 and Xorg Wacom Driver-1.2.3 (for wacomtablet), Linux-PAM-1.7.0, lm-sensors-3-6-0, oxygen-icons-6.0.0, pciutils-3.13.0, power-profiles-daemon-0.30, and the following Python modules: psutil-7.0.0, pygdbmi-0.11.0.0, sentry-sdk-2.22.0, urllib3-2.3.0 (if they are not installed, they will be downloaded and installed by the drkonqi build procedure)

#### Recommended (runtime)

AccountsService-23.13.9, breeze-icons-6.11.0, kio-extras-24.12.2, smartmontools-7.4, xdg-desktop-portal-1.20.0, and Xwayland-24.1.6

#### Optional

AppStream-1.0.4 (build with -qt=true), GLU-9.0.3, ibus-1.5.31, qtwebengine-6.8.2, KDevPlatform, libgps, libhybris, packagekit-qt, Qapt, SCIM, and socat (for pam_kwallet)

## Downloading KDE Plasma

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

    url=https://download.kde.org/stable/plasma/6.3.2/
    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

### Important

There is one downloaded file, spectacle-6.3.2.1.tar.xz, that is mislabeled. When extracted the top level directory does not match the tarball name. We need to make that file consistent now:

    mv spectacle-6.3.2.1.tar.xz spectacle-6.3.2.tar.xz

## 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 > plasma-6.3.2.md5 << "EOF"
    34c760dc07f498d800c78013e89720b8  kdecoration-6.3.2.tar.xz
    1a23a3c130d5a73e851556638e05c86a  libkscreen-6.3.2.tar.xz
    f8d52a88a1b4bb492fb4c590d93efd9f  libksysguard-6.3.2.tar.xz
    7d88c11927b7254a48c239f8ff833161  breeze-6.3.2.tar.xz
    7c23c6cca6ae3b75c7d6e338d655f6be  breeze-gtk-6.3.2.tar.xz
    f56e4b5f766ddf07974646305e32f86e  layer-shell-qt-6.3.2.tar.xz
    c1ee6ea5e63f87819e53aae19e7175f5  plasma-activities-6.3.2.tar.xz
    d98a720f6c7bf6b18f68eaa0842454c9  libplasma-6.3.2.tar.xz
    97d0ef783470792339b0ab04325bc374  kscreenlocker-6.3.2.tar.xz
    cb1b7c21781685de53e066ed83f0ec88  kinfocenter-6.3.2.tar.xz
    153b3403440f5376a170055b3e0e7740  kglobalacceld-6.3.2.tar.xz
    425782c861e1b1bf0bb49a782b402cd6  kwayland-6.3.2.tar.xz
    e4c54188e25914eb0d0e5693b0e6332c  kwin-6.3.2.1.tar.xz
    #309881e87eab586be5448455f4d81b19  kwin-6.3.2.tar.xz
    0c0eaea9839bff9b0ac70e09814618f2  plasma5support-6.3.2.tar.xz
    b59f54a9c59f5633d4141f9acd6369ce  plasma-activities-stats-6.3.2.tar.xz
    dbdc3c9f45d0e0e09ab2b6cf6b6b75d7  kpipewire-6.3.2.tar.xz
    b83418536dead5549a9c87eaf7b1fe4d  plasma-workspace-6.3.2.tar.xz
    5737bfdf712844e76b0da0acedd8f339  plasma-disks-6.3.2.tar.xz
    62d50988f3833ed98e22a0c6fbb805ff  bluedevil-6.3.2.tar.xz
    dfd47627bc8da5c5b53475214a648b28  kde-gtk-config-6.3.2.tar.xz
    06577237fc872fb7659b11e829594144  kmenuedit-6.3.2.tar.xz
    77dba21438203d747f9361ef91e3f27b  kscreen-6.3.2.tar.xz
    2b880797d9e6ccd1cba40285436b1789  kwallet-pam-6.3.2.tar.xz
    bf7edbc9fd326ab2764e1244e6835ffa  kwrited-6.3.2.tar.xz
    7d787ff90098760bf8eb5db7fd833bc8  milou-6.3.2.tar.xz
    1b9dd5ae4ebf274bc282d2636af50fbb  plasma-nm-6.3.2.tar.xz
    281ec80a71b3942a8d42a5132682f1bc  plasma-pa-6.3.2.tar.xz
    0f225ead05e73c43599a66cd6d796cc6  plasma-workspace-wallpapers-6.3.2.tar.xz
    5bdd87252dc6713f4b9ebd44e2caaf4e  polkit-kde-agent-1-6.3.2.tar.xz
    29608ea71ab87f3491adcb5584ca8dc9  powerdevil-6.3.2.tar.xz
    f323dda4120302a0759fe81679c9dbd6  plasma-desktop-6.3.2.tar.xz
    4353d584447fb28011637ed3d85b4920  kgamma-6.3.2.tar.xz
    e278489c407a411270f70d945f6d6a51  ksshaskpass-6.3.2.tar.xz
    #bf4d0d25e309e930cbf867b0f4460e51  plasma-sdk-6.3.2.tar.xz
    2b4b42f97b187209a6d93f7167b793ca  sddm-kcm-6.3.2.tar.xz
    #05dd805ad6eaaa6563ac16ef413f8ad3  discover-6.3.2.tar.xz
    #037192907099c3a3edcceee135336040  breeze-grub-6.3.2.tar.xz
    #5e2b70c2282b5597f86008e3bf27b632  breeze-plymouth-6.3.2.tar.xz
    a7846a4612e60ac416b1db227d208e95  kactivitymanagerd-6.3.2.tar.xz
    477b200bc4bc43344529a835c5e607a3  plasma-integration-6.3.2.tar.xz
    #9b3e41e24234f6c01f64739babcede7a  plymouth-kcm-6.3.2.tar.xz
    79cea0f52385ce4bb8448a0f7b17f212  xdg-desktop-portal-kde-6.3.2.tar.xz
    6fd748a372f52c33ce869b58b7d5fe18  drkonqi-6.3.2.tar.xz
    ed431307e4784a87bd24576df4394e6e  plasma-vault-6.3.2.tar.xz
    #6ed2a9395f7e569ca38875c44db408db  plasma-browser-integration-6.3.2.tar.xz
    147069fdc10dea3a7a7701df9fd2d9ee  kde-cli-tools-6.3.2.tar.xz
    3a846d5cf8d923780e21f011ae2ceb17  systemsettings-6.3.2.tar.xz
    8b43cda434ae5d88c9436e3d4b793164  plasma-thunderbolt-6.3.2.tar.xz
    #5c1c23af1627d25842bfc28dc56fe048  plasma-mobile-6.3.2.tar.xz
    #9a07133320259913c5a826b5256f86d8  plasma-nano-6.3.2.tar.xz
    488fc23da31e10dd7bc2a1e36ee6716d  plasma-firewall-6.3.2.tar.xz
    602917d54289a02a6711f215dae470bb  plasma-systemmonitor-6.3.2.tar.xz
    361d1a0da813fd82bd36e11fcc4b157b  qqc2-breeze-style-6.3.2.tar.xz
    b26d38fb9f9d83b27bcafaec1597843a  ksystemstats-6.3.2.tar.xz
    2102f13838581d36a8247e2b54fff369  oxygen-sounds-6.3.2.tar.xz
    ba8261586695cccdb01a6de8d400281c  kdeplasma-addons-6.3.2.tar.xz
    #b32d6d4486fd549d61aeff96c1dfff85  flatpak-kcm-6.3.2.tar.xz
    8d3998b1e171ee55c91a419cc8ba6319  plasma-welcome-6.3.2.tar.xz
    faf86ec8c776cd351c1a96ed70328da3  ocean-sound-theme-6.3.2.tar.xz
    f7a577b9baf316504e2ab9481f376008  print-manager-6.3.2.tar.xz
    7d06df172f05b46ea6e97ae41f6e8be7  wacomtablet-6.3.2.tar.xz
    #8575d2950cff501301f92426145e3056  kwayland-integration-6.3.2.tar.xz
    #3679989f3a64f9c5b976175267119334  krdp-6.3.2.tar.xz
    b812507c2d6720a1a9aca4e38b993f68  oxygen-6.3.2.tar.xz
    #99b5985ac398900121545d03ab54530e  plasma-dialer-6.3.2.tar.xz
    #ffeddc23f3e90de981301940b21550d0  spacebar-6.3.2.tar.xz
    e9fc02ced53504b97341e0f248c63ee8  spectacle-6.3.2.tar.xz
    EOF

### About Commented Out Packages

In the above list, several files are commented out with a hash (#) character.

- The plasma-sdk package is optional and used for software development.

- The discover package requires AppStream-1.0.4 to be built with the -D qt=true switch.

- The breeze-grub, breeze-plymouth, and plymouth-kcm packages above are all for customized support of Plymouth which is designed to be run within an initial ram disk during boot (see the section called “About initramfs”).

- The plasma-browser-integration package is designed to implement browser integration for Plasma into Mozilla Firefox and Google Chrome. The package does build, but is only useful if you want these browsers to be integrated into the shell in a way that lets you see (and control) downloads from Plasma's notifications area, as well as allowing you to search browser history in the KDE Runner. Note that you must also install a browser extension for this to work. For more details, see the KDE Plasma wiki page about browser integration.

- The krdp package is used to allow an RDP server to be run while using Plasma. This feature requires the 2.x version of FreeRDP, which is not in BLFS.

- The plasma-nano package is used for embedded systems.

- The plasma-mobile, plasma-dialer, and spacebar packages provide phone functionality for Plasma.

- The flatpak-kcm package is for managing support of flatpak applications.

- The kwayland-integration application requires plasma5 support.

## Installation of Plasma

### 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.16p2 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

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.*||') # Source directory

        tar -xf $file
        pushd $packagedir

           mkdir build
           cd    build

           cmake -D CMAKE_INSTALL_PREFIX=$KF6_PREFIX \
                 -D CMAKE_INSTALL_LIBEXECDIR=libexec \
                 -D CMAKE_BUILD_TYPE=Release         \
                 -D BUILD_QT5=OFF                    \
                 -D BUILD_TESTING=OFF                \
                 -W no-dev ..  &&

            make
            as_root make install
        popd

        as_root rm -rf $packagedir
        as_root /sbin/ldconfig

    done < plasma-6.3.2.md5

    exit

If you did not set `$KF6_PREFIX` to `/usr`, create symlinks to allow display managers to find Plasma, and to allow the XDG Desktop Portal to be detected. As the `root` user:

    # Setup xsessions (X11 sessions)
    install -dvm 755 /usr/share/xsessions
    cd /usr/share/xsessions

    [ -e plasma.desktop ] ||
    ln -sfv $KF6_PREFIX/share/xsessions/plasmax11.desktop

    # Setup wayland-sessions
    install -dvm 755 /usr/share/wayland-sessions
    cd /usr/share/wayland-sessions

    [ -e plasmawayland.desktop ] ||
    ln -sfv $KF6_PREFIX/share/wayland-sessions/plasma.desktop

    # Setup xdg-desktop-portal
    install -dvm 755 /usr/share/xdg-desktop-portal
    cd /usr/share/xdg-desktop-portal

    [ -e kde-portals.conf ] ||
    ln -sfv $KF6_PREFIX/share/xdg-desktop-portal/kde-portals.conf

    # Setup kde portal
    install -dvm 755 /usr/share/xdg-desktop-portal/portals
    cd /usr/share/xdg-desktop-portal/portals

    [ -e kde.portal ] ||
    ln -sfv $KF6_PREFIX/share/xdg-desktop-portal/portals/kde.portal

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

    rm -rf $KF6_PREFIX/lib/systemd

## Configuring Plasma

### Linux PAM Configuration

If you built Plasma with the recommended Linux PAM support, create necessary configuration files by running the following commands as the `root` user:

    cat > /etc/pam.d/kde << "EOF"
    # Begin /etc/pam.d/kde

    auth     requisite      pam_nologin.so
    auth     required       pam_env.so

    auth     required       pam_succeed_if.so uid >= 1000 quiet
    auth     include        system-auth

    account  include        system-account
    password include        system-password
    session  include        system-session

    # End /etc/pam.d/kde
    EOF

    cat > /etc/pam.d/kde-np << "EOF"
    # Begin /etc/pam.d/kde-np

    auth     requisite      pam_nologin.so
    auth     required       pam_env.so

    auth     required       pam_succeed_if.so uid >= 1000 quiet
    auth     required       pam_permit.so

    account  include        system-account
    password include        system-password
    session  include        system-session

    # End /etc/pam.d/kde-np
    EOF

    cat > /etc/pam.d/kscreensaver << "EOF"
    # Begin /etc/pam.d/kscreensaver

    auth    include system-auth
    account include system-account

    # End /etc/pam.d/kscreensaver
    EOF

## Starting Plasma

You can start Plasma from runlevel 3, using xinit-1.4.3, or from runlevel 5, using a Display Manager, such as lightdm-1.32.0.

To start Plasma using xinit-1.4.3, run the following commands:

    cat > ~/.xinitrc << "EOF"
    dbus-launch --exit-with-x11 $KF6_PREFIX/bin/startplasma-x11
    EOF

    startx

The X session starts on the first unused virtual terminal, normally vt7. You can switch to another vtn simultaneously pressing the keys Ctrl-Alt-Fn (n=1, 2, ...). To switch back to the X session, normally started at vt7, use Ctrl-Alt-F7. The vt where the command startx was executed will display many messages, including X starting messages, applications automatically started with the session, and eventually, some warning and error messages. You may prefer to redirect those messages to a log file, which not only will keep the initial vt uncluttered, but can also be used for debugging purposes. This can be done starting X with:

    startx &> ~/x-session-errors

When shutting down or rebooting, the shutdown messages appear on the vt where X was running. If you wish to see those messages, simultaneously press keys Alt-F7 (assuming that X was running on vt7).

## Contents

Installed Programs: There are too many plasma programs (over 50 in /opt/kf6/bin) to list separately here.
Installed Libraries: There are too many plasma libraries (over 250 in /opt/kf6/lib) to list separately here.
Installed Directories: There are too many plasma directories (over 2700 in /opt/kf6) to list separately here.

- Prev

  pulseaudio-qt-1.7.0

- Next

  GNOME

- Up
- Home