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

[Note]

Note

Development versions of BLFS may not build or run some packages properly if dependencies have been updated since the most recent stable versions of the book.

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.34, KDE Frameworks-5.94.0, libpwquality-1.4.4, libqalculate-4.2.0, libxkbcommon-1.4.1, Mesa-22.1.6 built with Wayland-1.21.0, NetworkManager-1.38.4, pipewire-0.3.54, PulseAudio-16.1, qca-2.3.4, 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.26, qtwebengine-5.15.10, Xorg Synaptics Driver-1.9.2, 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.10: 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.24.5/
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.24.5.md5 << "EOF"
f239aaffb15592e8d35f250763de0928  kdecoration-5.24.5.tar.xz
97ef068eddbe1d00c920192d1500dd93  libkscreen-5.24.5.tar.xz
6d43b014fcf7d220653c82c9187ad238  libksysguard-5.24.5.tar.xz
558c03416d5e97946857232ff4a205fe  breeze-5.24.5.tar.xz
1f728695039f0354474e0d77d94ec609  breeze-gtk-5.24.5.tar.xz
91adcae1cd632ca63d309bb2f55afbc6  layer-shell-qt-5.24.5.tar.xz
fd288ff836cc804e3f87dd2f5bf73350  kscreenlocker-5.24.5.tar.xz
4610a92cb8b16ca1dedfd343b9f2550c  oxygen-5.24.5.tar.xz
4dd8450c600a4f0ba418d937e5b7aee7  kinfocenter-5.24.5.tar.xz
598ae49b82277a94c5b35ac2b22f2cee  kwayland-server-5.24.5.tar.xz
a92ef62e3780435009e1d67623727d9e  kwin-5.24.5.tar.xz
1756314f3b95077a4a177d6e150c0c74  plasma-workspace-5.24.5.tar.xz
681b486cc87c2cddd24a6a6051907dd4  plasma-disks-5.24.5.tar.xz
6e8da61b41691b811f0029d0692af2b8  bluedevil-5.24.5.tar.xz
f3eed29817d18a008012b70d64935894  kde-gtk-config-5.24.5.tar.xz
4f09f37ac7ebce792e2a12d582677370  khotkeys-5.24.5.tar.xz
ab0af707f54eb2c3272123613fff0546  kmenuedit-5.24.5.tar.xz
8480ee90af0592d04b8d13747c9dc984  kscreen-5.24.5.tar.xz
0ee9d2bcc73d974fb06d0ac4a0e96e11  kwallet-pam-5.24.5.tar.xz
aae5d820d1ecd19301a23cb672c9a45a  kwayland-integration-5.24.5.tar.xz
589eb5c7d72ca98478da6f1ff3575cd7  kwrited-5.24.5.tar.xz
02bb77b13e49ad6e5b6defb3c672868a  milou-5.24.5.tar.xz
fad6a3d603afffd3ef8312c58aa810a1  plasma-nm-5.24.5.tar.xz
5c824cba591a84e2a04d8864f42e74d9  plasma-pa-5.24.5.tar.xz
e2bc71e7ee87a399f28c7c31b74eab9d  plasma-workspace-wallpapers-5.24.5.tar.xz
61be40b45e827a149d964a11275d75b6  polkit-kde-agent-1-5.24.5.tar.xz
ac1e83397316954fb587c86d00f04591  powerdevil-5.24.5.tar.xz
c8209bc8147b8e556b59270af9b90666  plasma-desktop-5.24.5.tar.xz
1e64236fd3f83c2244b7f43786e5973e  kdeplasma-addons-5.24.5.tar.xz
e9544512d566ec8c862d415c688cad5a  kgamma5-5.24.5.tar.xz
d3e087db5fdc3e5a98efbfbc4a874aa4  ksshaskpass-5.24.5.tar.xz
#54d583f14b4b40df4c8e322c143adbdd  plasma-sdk-5.24.5.tar.xz
c8c3287e326972154da67308375fd0e1  sddm-kcm-5.24.5.tar.xz
2fd1053fbd3ca2c6a64be171af7f665a  discover-5.24.5.tar.xz
#c4d0743364fc32708a7318f470beeeb9  breeze-grub-5.24.5.tar.xz
#ca6fada97e8026f78612ca19aec3482b  breeze-plymouth-5.24.5.tar.xz
3ccd98acb7b5ba78c6c474cb6904e5e6  kactivitymanagerd-5.24.5.tar.xz
e4707182dc0508c4fbbdf495067b7e80  plasma-integration-5.24.5.tar.xz
448e85a197a6ae9c49fa8d9a24a8abea  plasma-tests-5.24.5.tar.xz
#951d95f902aca5152a419afe920c628a  plymouth-kcm-5.24.5.tar.xz
b25ed347b50f472d2bba7b5b4e2e75a7  xdg-desktop-portal-kde-5.24.5.tar.xz
ec09f5df5604ea250afd4938b11cde47  drkonqi-5.24.5.tar.xz
0b761d3db81fd14e94e27b022209c62a  plasma-vault-5.24.5.tar.xz
e123ec241c17a9c726b79f372d736ce3  plasma-browser-integration-5.24.5.tar.xz
263e1a645e19b6daed9743540217da8f  kde-cli-tools-5.24.5.tar.xz
51314142bc96fd1864049f0727540e5f  systemsettings-5.24.5.tar.xz
e668b7a16a6702ff512bdfdfd9588b0e  plasma-thunderbolt-5.24.5.tar.xz
#335215fd402c5e886be13a7cdae746f5  plasma-nano-5.24.5.tar.xz
#708ffe8a2d7240ac125c92c266128ce9  plasma-mobile-5.24.5.tar.xz
8373a21b1d528acbd26e399d2e0d7fc9  plasma-firewall-5.24.5.tar.xz
8df48f0a22ce12e3dfb569b74b4cb549  plasma-systemmonitor-5.24.5.tar.xz
3213768a9b54727e062bea6480916193  qqc2-breeze-style-5.24.5.tar.xz
f145d63e307ef51eae8f6854005efe44  ksystemstats-5.24.5.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.11p3 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.24.5.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

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

rm -rf $KF5_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 Plasma5

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

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.