Building Plasma

#### Beyond Linux® From Scratch (System V Edition) - Version r13.1-84

### Chapter 32. KDE Plasma

- Prev

  tesseract-5.5.3

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

### 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 Plasma packages in one step by using a bash script.

### Package Information

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

- Download MD5 sum: See Below

- Download size: 343 MB

- Estimated disk space required: 3.5 GB (821 MB installed)

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

### Plasma Dependencies

#### Required

Boost-1.92.0, corrosion-0.6.1, FFmpeg-9.0.1, GTK-3.24.52, KDE Frameworks-6.29.0, kirigami-addons-1.13.1, kquickimageeditor-0.6.2.1, libdisplay-info-0.4.0, libpwquality-1.4.5, libqalculate-5.12.0, libnl-3.12.0, libxcvt-0.1.3, libxkbcommon-1.13.2, Mesa-26.1.7 built with Wayland-1.26.0, opencv-4.13.0, phonon-4.12.0, pipewire-1.6.8, pulseaudio-qt-1.8.1, qca-2.3.12, qcoro-0.13.0, qtkeychain-0.16.0, sassc-3.6.2, taglib-2.3.2, tesseract-5.5.3, xdotool-4.20260303.1, and Xorg Evdev Driver-2.11.0

#### Recommended

bolt-0.9.11, gsettings-desktop-schemas-50.1, libcanberra-0.30, libinput-1.31.3, libpcap-1.10.7, libwacom-2.19.1 and Xorg Wacom Driver-1.2.4 (for wacomtablet), Linux-PAM-1.7.2, lm-sensors-3-6-2, oxygen-icons-6.29.0, pciutils-3.15.0, power-profiles-daemon-0.30, and the following Python modules: psutil-7.2.2, pygdbmi-0.11.0.0, sentry-sdk-2.68.0, urllib3-2.7.0 (if they are not installed, they will be downloaded and installed by the drkonqi build procedure)

#### Recommended (runtime)

AccountsService-26.27.3, breeze-icons-6.29.0, kio-extras-26.04.3, smartmontools-7.5, xdg-desktop-portal-1.22.1, and Xwayland-24.1.13

#### Optional

AppStream-1.2.0 (build with -qt=true), GLU-9.0.3, ibus-1.5.34, qtwebengine-6.11.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.7.4/
    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 > plasma-6.7.4.md5 << "EOF"
    2a668e675bdf8dd5ae06b1e8b68a1f7e  kdecoration-6.7.4.tar.xz
    227422d0896d13924d99a74707b3e05c  libkscreen-6.7.4.tar.xz
    190204011ed963eed51d1bde7a2fdf8f  libksysguard-6.7.4.tar.xz
    b5684af3d9c5f65056ce4b64e0c59a3c  breeze-6.7.4.tar.xz
    a6501aa2fbd1b520e3cdb3122e7f3a60  breeze-gtk-6.7.4.tar.xz
    34f89e74bc586c7e280ac512f8474691  layer-shell-qt-6.7.4.tar.xz
    6a331108a351cee3c3c4649bdf880501  plasma-activities-6.7.4.tar.xz
    d968787e8579337c7749bcabb860e5e9  libplasma-6.7.4.tar.xz
    70129667dcb43f4ee8c9a12240a7850d  kscreenlocker-6.7.4.tar.xz
    60664e1402c27654632456362613fa12  kglobalacceld-6.7.4.tar.xz
    020f2d5ae392678298050babb4e60337  kwayland-6.7.4.tar.xz
    e3117b48474022601917b1643f629656  aurorae-6.7.4.tar.xz
    b035d3a464916c60a21b8a57d0698612  knighttime-6.7.4.tar.xz
    c3d800536ee56ecda08019fe1226b301  plasma-keyboard-6.7.4.tar.xz
    b5b51b6b7568329a8cf1190bdeba6e4a  kwin-6.7.4.tar.xz
    e53ce629f3c963b3b17a236a0bd867b2  kwin-x11-6.7.4.tar.xz
    649967c3120b2eacf73969528d7f6191  plasma5support-6.7.4.tar.xz
    bc863afab26218d4105eff8d39ecadca  plasma-activities-stats-6.7.4.tar.xz
    4d1b0c26f8b55e117388ccf8c48a6f14  kpipewire-6.7.4.tar.xz
    05560389f2f05f669e009c2fd0ebe59f  plasma-workspace-6.7.4.tar.xz
    a8cc96ebd2c5151d36d442ccc11a8733  plasma-disks-6.7.4.tar.xz
    572ef1ebb4acd46b0f6b8dcecff97993  bluedevil-6.7.4.tar.xz
    1938ec7c3ddd15229974f319bede1400  kde-gtk-config-6.7.4.tar.xz
    f0b635c72c777d56f4d0e129f350304f  kmenuedit-6.7.4.tar.xz
    4ac0f5f96942c954bb1e2c5d9022775e  kscreen-6.7.4.tar.xz
    e6073ba97e05a06c0ee3d6141e2cf387  kwallet-pam-6.7.4.tar.xz
    3f7e64d7ad382a5c4fc9a4cc83d6c0a4  kwrited-6.7.4.tar.xz
    3060fbba5172818f9020cb58d4954ec4  milou-6.7.4.tar.xz
    2dd1ab12f435d709e055b635629f5c14  plasma-nm-6.7.4.tar.xz
    7060baf2c23ac660cfd410dd1966199f  plasma-pa-6.7.4.tar.xz
    c5d1d25a57d6c15a489b01874faa6328  plasma-workspace-wallpapers-6.7.4.tar.xz
    318152d6ed611fc6ad5d4b865736f91f  polkit-kde-agent-1-6.7.4.tar.xz
    b22d49f39d68c06fa0dccd1f0b020d0b  powerdevil-6.7.4.tar.xz
    ac1a9aac994ae3cb85eaa99188669ecf  plasma-desktop-6.7.4.tar.xz
    6a491e214b16835c855776bc2ddad64e  kgamma-6.7.4.tar.xz
    b1788bd5285df58b80f74f8430b1e43a  ksshaskpass-6.7.4.tar.xz
    #93fa4cc83b05e191730df4525c724774  plasma-sdk-6.7.4.tar.xz
    317ca68615ef017390275a222b15ce9d  sddm-kcm-6.7.4.tar.xz
    #35282b0e26bbe89b7da2f136ebd43fe1  discover-6.7.4.tar.xz
    #7de6ed35df494409cc27142696c3dd84  breeze-grub-6.7.4.tar.xz
    #cf245907c918bc9530e4ab9349f55c23  breeze-plymouth-6.7.4.tar.xz
    4fac322a8f29f9368c2dc4df8ac1550a  kactivitymanagerd-6.7.4.tar.xz
    270a34cd1483afba2295c18ee09c5da7  plasma-integration-6.7.4.tar.xz
    #e5a59138ebef078776c9c8a5957f5cc4  plymouth-kcm-6.7.4.tar.xz
    3973cb7ade619898813fbb17a6dd39a1  xdg-desktop-portal-kde-6.7.4.tar.xz
    cc4b7b53165f9b458743a3e732c7eebf  drkonqi-6.7.4.tar.xz
    bed38426773005100e6059874e8f1d54  plasma-vault-6.7.4.tar.xz
    #3c985ed775c64cb4eaf7047098a515fc  plasma-browser-integration-6.7.4.tar.xz
    2c6f6683c45669f1a7a3bb297f6a16b6  kde-cli-tools-6.7.4.tar.xz
    23e88b2df1b3ddf58022ce658a831d1c  systemsettings-6.7.4.tar.xz
    #f51e98d278d37b99cb260fd11141f12b  plasma-mobile-6.7.4.tar.xz
    #a7e2f1cd72faf3dd3c988337d1f730db  plasma-nano-6.7.4.tar.xz
    b2d5232b994b197a0524f1982069715c  plasma-firewall-6.7.4.tar.xz
    71e9c21163c2304bea2cbf1c013811d1  plasma-systemmonitor-6.7.4.tar.xz
    97bd995296967e15827b872e7d8d2466  qqc2-breeze-style-6.7.4.tar.xz
    cc47c85067e1db3b084c94e07e650398  ksystemstats-6.7.4.tar.xz
    a3673682283357c8f04e89606af11d93  oxygen-sounds-6.7.4.tar.xz
    fface9f4ea1a88a2e37b01edd8757db5  kdeplasma-addons-6.7.4.tar.xz
    #368e89588052aad475f25468996d432d  flatpak-kcm-6.7.4.tar.xz
    3085f2d5441d8be0e1f68ec2408afcd5  plasma-welcome-6.7.4.tar.xz
    6096363f350019ccb5a269779d3837d5  ocean-sound-theme-6.7.4.tar.xz
    7e54089100df8684ce3e421f0f85b26e  print-manager-6.7.4.tar.xz
    6b25901d6278559630a849b1e10a1fcc  wacomtablet-6.7.4.tar.xz
    #98b9ab5cce0e6f15b94c5473437c776b  kwayland-integration-6.7.4.tar.xz
    #2e4786a19dcba04d94c3bff46a167eef  krdp-6.7.4.tar.xz
    360d670ed2bb8aa1286d466539011106  oxygen-6.7.4.tar.xz
    #895f1aff8fb4d347e935237d9c83c1ee  plasma-dialer-6.7.4.tar.xz
    #974b77c0b9a1af2864ade856c0b42b51  spacebar-6.7.4.tar.xz
    49398c5c4d5cef31ffb07b4cc36a4a8e  spectacle-6.7.4.tar.xz
    #fcf0d9b0b50d85000135646e97a1296d  plasma-login-manager-6.7.4.tar.xz
    001cae1a7e6326074643dde0f097498e  plasma-setup-6.7.4.tar.xz
    780166b539d9c9800ad096d9f3ca48ad  kinfocenter-6.7.4.tar.xz
    b9129e3342abb80f4b43d160d26dcb15  plasma-thunderbolt-6.7.4.tar.xz
    #936d3d9689ea25070f356aa0c4b64c40  plasma-bigscreen-6.7.4.tar.xz
    #60fecb60b6d7c0117a637a5d7eabf714  union-6.7.4.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.2.0 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.

- The plasma-login-manager application provides a display manager for KDE Plasma, forked from SDDM and with an new frontend providing a greeter, wallpaper plugin integration and System Settings module (KCM).

## 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.17p2 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
        name=$(      echo $pkg |sed 's|-6.*$||')   # Isolate package name
        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-author ..  &&

            make
            as_root make install
        popd

        as_root rm -rf $packagedir
        as_root /sbin/ldconfig

    done < plasma-6.7.4.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.4, or from runlevel 5, using a Display Manager, such as lightdm-1.33.1.

To start Plasma using xinit-1.4.4, 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

  tesseract-5.5.3

- Next

  GNOME

- Up
- Home