Building Plasma 5

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

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

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

Package Information

Plasma 5 Dependencies

Required

GTK+-2.24.33, GTK+-3.24.30, KDE Frameworks-5.85.0, libpwquality-1.4.4, libxkbcommon-1.3.0, Mesa-21.2.1 built with Wayland-1.19.0, NetworkManager-1.32.10, pipewire-0.3.34, PulseAudio-15.0, qca-2.3.3, sassc-3.6.2, taglib-1.12, and xcb-util-cursor-0.1.3

Recommended

Recommended (runtime)

Optional

GLU-9.0.2, ibus-1.5.25, qtwebengine-5.15.6, Xorg Synaptics Driver-1.9.1, appstream-qt, KDevPlatform, libgps, libhybris, libraw1394, mockcpp, packagekit-qt, Qalculate, Qapt, SCIM, and socat (for pam_kwallet)

[Note]

Note

Only two plasma packages optionally use qtwebengine-5.15.6: libksysguard and kdeplasma-addons. If QtWebEngine is installed later, only those two packages have to be rebuilt. This allows to provide a more complete display in the system monitor application.

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/kf5

Downloading KDE Plasma5

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

url=https://download.kde.org/stable/plasma/5.22.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-5.22.4.md5 << "EOF"
7fab69fa5fc3211b35e3d03f1172831a  kdecoration-5.22.4.tar.xz
a587fecf0473c225f39a7f8a7c611d3b  libkscreen-5.22.4.tar.xz
115f8e14d6ef58715183eb8036c431c1  libksysguard-5.22.4.tar.xz
516a58571f6daeb60a2509057e67712b  breeze-5.22.4.tar.xz
3b06f3768fc345893625ef44d7e72a98  breeze-gtk-5.22.4.tar.xz
049dabd694abed120b4f84d37f05de8c  layer-shell-qt-5.22.4.tar.xz
17af84caeb942de9a8e3d819f20645b0  kscreenlocker-5.22.4.tar.xz
ffe09b47f6cc20d13ec311edeb13a9b3  oxygen-5.22.4.tar.xz
916bfa4ce6b40ca8ef80b75018d63ab1  kinfocenter-5.22.4.tar.xz
365f7cd632d41447561ec1bdf7497bba  kwayland-server-5.22.4.tar.xz
09cf360780185b33fca9561684a0f41f  kwin-5.22.4.tar.xz
5cb1ab2a9d3ce0c05eba07ef4c8ac478  plasma-workspace-5.22.4.tar.xz
75dd5e0fed93781f0ae031a091dcce4b  plasma-disks-5.22.4.tar.xz
3d7abfe0952b356cc12cbd75be14f5e0  bluedevil-5.22.4.tar.xz
2515439a0daaf325b0fcf9ce1a537660  kde-gtk-config-5.22.4.tar.xz
8f2f4b902c98d7890dc1ec3756c27871  khotkeys-5.22.4.tar.xz
aa03bf8d1c799a4410b567b44b47f6cd  kmenuedit-5.22.4.tar.xz
6fab0d760e9e6a33255441aab3874b2f  kscreen-5.22.4.tar.xz
3dae9ce525c52ac3bacaff464dc4264c  kwallet-pam-5.22.4.tar.xz
fa9772ef7737037992aea52739aea95a  kwayland-integration-5.22.4.tar.xz
51502b6a48f2b7790364881a578cdd1b  kwrited-5.22.4.tar.xz
6d85652d5fa13953370bc4f37247e3b4  milou-5.22.4.tar.xz
61c7fc4c00637715e8d0c4491298b5b7  plasma-nm-5.22.4.tar.xz
31272515681adc5d0ca987a9dc182de5  plasma-pa-5.22.4.tar.xz
95aefdbfd0a3cd6b871e50968ccf43d9  plasma-workspace-wallpapers-5.22.4.tar.xz
9a36fb70a6d1f1f637d75a75e77eb9ba  polkit-kde-agent-1-5.22.4.tar.xz
f7860ee18c994a8b87f39965b53f4f1f  powerdevil-5.22.4.tar.xz
ba7687bdea331a62127f7cc69029c194  plasma-desktop-5.22.4.tar.xz
9c393f6da042841ed8cf41f9ad126b5c  kdeplasma-addons-5.22.4.tar.xz
bf508d7b503f1923fdb5fbd22f957981  kgamma5-5.22.4.tar.xz
239d00ede4c0e941dc6407f8510f1678  ksshaskpass-5.22.4.tar.xz
#ba59a194b4812db25022c189e129151f  plasma-sdk-5.22.4.tar.xz
3ecfe0501ce2ec0f8c8bda3a01c78be7  sddm-kcm-5.22.4.tar.xz
a81e62bd36f3db28712274da80ed52a4  discover-5.22.4.tar.xz
#9abba589089c1088e1836cabe9e593f6  breeze-grub-5.22.4.tar.xz
#d038d1db0f1ed5e80b9d22a537dd1872  breeze-plymouth-5.22.4.tar.xz
7aef306ec8c2131f0fa22d2b558f73fb  kactivitymanagerd-5.22.4.tar.xz
8c30da2b1dbcfbfaa715c050339b0e0a  plasma-integration-5.22.4.tar.xz
006171ce3edae4b67d27b1577cdc84a1  plasma-tests-5.22.4.tar.xz
#442fd33f46a982eeeb925fd6f7d919b1  plymouth-kcm-5.22.4.tar.xz
900994c0628b8b3767c83db0b4f16e0c  xdg-desktop-portal-kde-5.22.4.tar.xz
61ebe5891cf9adcd62d32c5069573ff0  drkonqi-5.22.4.tar.xz
d464d91d37cf12da1721abc18ec94140  plasma-vault-5.22.4.tar.xz
8c9a2286634cb89fb04d0278c6af8f8c  plasma-browser-integration-5.22.4.tar.xz
257e25f2388014932ecf786dd9e49bd5  kde-cli-tools-5.22.4.tar.xz
9314599d78ed6683018ff5a7b69d2a08  systemsettings-5.22.4.tar.xz
3ea20e78932f2a487d932acd1eff10f7  plasma-thunderbolt-5.22.4.tar.xz
#0ecfa8ed1962f4f842967ed7b66d14f8  plasma-nano-5.22.4.tar.xz
#157a441ad0519936dcb75856ae83010e  plasma-phone-components-5.22.4.tar.xz
71b0da480c6b91b6445b6bdbe452bdae  plasma-firewall-5.22.4.tar.xz
026a4d3cd063ba86e77c9ffa711aa769  plasma-systemmonitor-5.22.4.tar.xz
0d72d2e9f5d6a3975068e1a472ce9982  qqc2-breeze-style-5.22.4.tar.xz
171c556167b17fd2b16783015c3f8ae6  ksystemstats-5.22.4.tar.xz
EOF
[Note]

Note

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-sdk package is optional and used for software development. The plasma-nano package is used for embedded systems and plasma-phone-components provides phone functionality for Plasma.

Installation of Plasma5

[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.7p2 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.*||') # Package directory

    tar -xf $file
    pushd $packagedir

       mkdir build
       cd    build

       cmake -DCMAKE_INSTALL_PREFIX=$KF5_PREFIX \
             -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 < plasma-5.22.4.md5

exit

If you did not set $KF5_PREFIX to /usr, create symlinks to allow display managers to find Plasma:

as_root install -dvm 755 /usr/share/xsessions              &&
cd /usr/share/xsessions/                                   &&
[ -e plasma.desktop ]                                      ||
as_root ln -sfv $KF5_PREFIX/share/xsessions/plasma.desktop &&
as_root install -dvm 755 /usr/share/wayland-sessions       &&
cd /usr/share/wayland-sessions/                            &&
[ -e plasmawayland.desktop ]                               ||
as_root ln -sfv $KF5_PREFIX/share/wayland-sessions/plasmawayland.desktop

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 Plasma5

You can start Plasma5 from a TTY, using xinit-1.4.1.

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

cat > ~/.xinitrc << "EOF"
dbus-launch --exit-with-session $KF5_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 (63 in /opt/kf5/bin) to list separately here.
Installed Libraries: There are too many plasma libraries (40 in /opt/kf5/lib) to list separately here.
Installed Directories: There are too many plasma directories (over 1000 in /opt/kf5) to list separately here.

Last updated on