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.2 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.34, KDE Frameworks-5.97.0, libpwquality-1.4.4, libqalculate-4.2.0, libxkbcommon-1.4.1, Mesa-22.1.7 built with Wayland-1.21.0, NetworkManager-1.38.4, pipewire-0.3.56, 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.27, 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.25.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.25.4.md5 << "EOF"
cc886e068156be2e3a38dd581ef5c7cd  kdecoration-5.25.4.tar.xz
dc335301006b1007714dc2af028856ef  libkscreen-5.25.4.tar.xz
38101d3a8fee3a6eef04370e29da3538  libksysguard-5.25.4.tar.xz
99b6204e0e782232de0caae00d8b08f9  breeze-5.25.4.tar.xz
9cff677a443097f0cd6ff997d75cd8d3  breeze-gtk-5.25.4.tar.xz
63f91c68af6cf236931455e3f2f7db8d  layer-shell-qt-5.25.4.tar.xz
f0390e8aa342f3b6f78383ffbd8e6245  kscreenlocker-5.25.4.tar.xz
173c0ff83e4677bd3d493882616f4821  oxygen-5.25.4.tar.xz
0eba490f93429cbae3274f5c80e8e4a4  kinfocenter-5.25.4.tar.xz
8c07df3083286b7fbf2fee061a9b8556  kwin-5.25.4.tar.xz
4322408dc35f32cfa25cde675ca4f950  plasma-workspace-5.25.4.tar.xz
847f15762403af3355dd9f8d313e3160  plasma-disks-5.25.4.tar.xz
a6c95ad969503a0c4f7fa61b457405c1  bluedevil-5.25.4.tar.xz
6b6cf6c6faa28d7593e3065befe8cf8d  kde-gtk-config-5.25.4.tar.xz
943b40a2a7e3738618ddb070233fe6f4  khotkeys-5.25.4.tar.xz
09c80647ed861aa94672fcb5d13fe382  kmenuedit-5.25.4.tar.xz
8671c090d885302d9553cecee3b87d65  kscreen-5.25.4.tar.xz
f0df854ad5288a369c3d38a393ad796c  kwallet-pam-5.25.4.tar.xz
b686e387222177d70f14652d03225fd9  kwayland-integration-5.25.4.tar.xz
7ad4e4512e2c03e351930e83dd2d5c9b  kwrited-5.25.4.tar.xz
7db4206e533f247b878241158f946552  milou-5.25.4.tar.xz
3e7cab69babe28ccafb1eb0df0c18757  plasma-nm-5.25.4.tar.xz
9813c33efcc84eb15d792aad2c096127  plasma-pa-5.25.4.tar.xz
54f0171cb296021b80437d2b5c5821e5  plasma-workspace-wallpapers-5.25.4.tar.xz
b29230b6615e1d4318e37d92940dd35b  polkit-kde-agent-1-5.25.4.tar.xz
207ef7369a9dbe242bb4be12856c9950  powerdevil-5.25.4.tar.xz
58f128569154007f74dd74b8fb1ce976  plasma-desktop-5.25.4.tar.xz
2218d15c9644268c8a001993ac2b75a3  kdeplasma-addons-5.25.4.tar.xz
78407d2ec45a8efbd94be4be4e458ec6  kgamma5-5.25.4.tar.xz
12f157a44265e888238e44567c49ffdd  ksshaskpass-5.25.4.tar.xz
#8f34f405bd2e81866f484c8fb2b3e4bf  plasma-sdk-5.25.4.tar.xz
5cf6a96fac52af822c28a5b414dfb05e  sddm-kcm-5.25.4.tar.xz
e5d1e81e741fcb94c6d3b7f0a460f0f2  discover-5.25.4.tar.xz
#7317d218fb9bcbd3bb52dcc2d0b45497  breeze-grub-5.25.4.tar.xz
#891882622ea5f8fc9e42aec7c349708a  breeze-plymouth-5.25.4.tar.xz
f8c1e906f17ce513113af47dadbf0222  kactivitymanagerd-5.25.4.tar.xz
4cbd66be9bfac48ff222c787652a0e1f  plasma-integration-5.25.4.tar.xz
ae0cc94583a0b6bd977a15b0ffba57d2  plasma-tests-5.25.4.tar.xz
#43096cf164e17176cc381d804823bac2  plymouth-kcm-5.25.4.tar.xz
53d0980ca27e7233ca24bae9eceb4e57  xdg-desktop-portal-kde-5.25.4.tar.xz
23b19b8d694ec98bc3e049cd628e8413  drkonqi-5.25.4.tar.xz
5a466c0da69b52836ddbf5524ddb14b9  plasma-vault-5.25.4.tar.xz
71c02fb4b8f3953a8548978b6309f7c8  plasma-browser-integration-5.25.4.tar.xz
5e0063ee3e50a7a336d80d17ed3c6651  kde-cli-tools-5.25.4.tar.xz
d0dcc4214861fc05328d5df46fe618f5  systemsettings-5.25.4.tar.xz
3a786aae80fa31643ace5b3c62e70254  plasma-thunderbolt-5.25.4.tar.xz
#74e38cc52ac71d74f0bce96ac6c2e288  plasma-nano-5.25.4.tar.xz
#86db281d990e794a0890b9b7933995fa  plasma-mobile-5.25.4.tar.xz
e08c0ad74f68666713c5891f73b6432b  plasma-firewall-5.25.4.tar.xz
030f1d0236b31407745300858f4f6db5  plasma-systemmonitor-5.25.4.tar.xz
005283e828b3ed1d1a9006dea23fd647  qqc2-breeze-style-5.25.4.tar.xz
5a8ef1866697cf5a660a59213d2f38e7  ksystemstats-5.25.4.tar.xz
ab1fd9c2a595b09925fc2f9ddfe18406  oxygen-sounds-5.25.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.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.25.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.