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 12.1 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+-3.24.41, KDE Frameworks-5.115.0, kuserfeedback-1.3.0, libpwquality-1.4.5, libqalculate-4.9.0, libxcvt-0.1.2, libxkbcommon-1.6.0, Mesa-24.0.1 built with Wayland-1.22.0, NetworkManager-1.44.2, pipewire-1.0.3, PulseAudio-17.0, qca-2.3.8, sassc-3.6.2, taglib-2.0, and xcb-util-cursor-0.1.4

Recommended

Recommended (runtime)

Optional

AppStream-1.0.1 (build with -qt=true), GLU-9.0.3, ibus-1.5.29, qtwebengine-5.15.17, Xorg Synaptics Driver-1.9.2, KDevPlatform, libgps, libhybris, libraw1394, packagekit-qt, Qalculate, Qapt, SCIM, and socat (for pam_kwallet)

[Note]

Note

qtwebengine-5.15.17 is required for aura-browser. It is also optional for two other packages: libksysguard and kdeplasma-addons. If QtWebEngine is installed later, only these two packages need to be rebuilt. This allows a more complete display in the system monitor application.

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.27.10/
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.27.10.md5 << "EOF"
a1361a811dc93389d0ce771d1ff82c3a  kdecoration-5.27.10.tar.xz
1f491e823bc83df650d04d5d9948da45  libkscreen-5.27.10.tar.xz
571aa0c18a14ee74f3081f96f73a7f9d  libksysguard-5.27.10.tar.xz
541d1b06db3b707a7a73df1526f37b44  breeze-5.27.10.tar.xz
9acdc232ea675b761e7386837f25f420  breeze-gtk-5.27.10.tar.xz
54562594af547614648cded522c3e747  layer-shell-qt-5.27.10.tar.xz
c44cfe3ba7fb03fc30b2ae305f16ed79  kscreenlocker-5.27.10.tar.xz
171949dd2dfc3b2325c959389694860a  oxygen-5.27.10.tar.xz
0ef8d9f18707712fc4bcccf59138f2c7  kinfocenter-5.27.10.tar.xz
e4e4409af71c4f5a67aa35c04f6b2bc7  kwin-5.27.10.tar.xz
5c2ff5158503e983207e700ce513e929  plasma-workspace-5.27.10.tar.xz
46001c7671f7ff2f08ca0dd9c3cdbf3f  plasma-disks-5.27.10.tar.xz
820566ae6effedbdd208a78e0031bf67  bluedevil-5.27.10.tar.xz
490bd81c915f332b65631b87b6eaa49d  kde-gtk-config-5.27.10.tar.xz
7cade9cfce3ef14f14f55cd7a50fd7cf  khotkeys-5.27.10.tar.xz
e98c999e6ee7f9bbe775d4e512368420  kmenuedit-5.27.10.tar.xz
24bc4ed3ad5587bd05591aafd758df2c  kscreen-5.27.10.tar.xz
3ab1c88cf91f0fb46ae3395d57709e12  kwallet-pam-5.27.10.tar.xz
53d59d76b3dfac5f755d607798b08f85  kwayland-integration-5.27.10.tar.xz
d7a9f2999352e91d504d52ad65336d9b  kwrited-5.27.10.tar.xz
8a51e19d58acebb89a919b7377d8bc83  milou-5.27.10.tar.xz
0e11c62c2a23d161b5b8cbe6e87517bc  plasma-nm-5.27.10.tar.xz
02657d8fd46384f75ffe9c504f7c97b4  plasma-pa-5.27.10.tar.xz
5c1cbd459e786deb16d5615748114bfa  plasma-workspace-wallpapers-5.27.10.tar.xz
17302ca60f68e13e85bc24a4ec873622  polkit-kde-agent-1-5.27.10.tar.xz
cc39dc5777614bd89ae96d38008dc7c9  powerdevil-5.27.10.tar.xz
2417bb974152d4f2274ebe3b7b524ca8  plasma-desktop-5.27.10.tar.xz
f51521902f0665349c0fa012590a1eec  kgamma-5.27.10.tar.xz
e95d6813c180b078be4bf40550791e26  ksshaskpass-5.27.10.tar.xz
#8c52fad441ffe43969458ae71b6a2f26  plasma-sdk-5.27.10.tar.xz
1af573d08dd99879f27c5a2b55b02bc9  sddm-kcm-5.27.10.tar.xz
#560ac5c60112e18bb44c46eec3563d7d  discover-5.27.10.tar.xz
#3af40cfe47213087d2a8c89132ff004d  discover-5.27.10.1.tar.xz
#2cd0a4e1e3e89197e18f48d893c0f2d6  breeze-grub-5.27.10.tar.xz
#fe7bb4efec17206a9faceb9cfe35fbf5  breeze-plymouth-5.27.10.tar.xz
5bbb5c7a2985f8d7b8816a35d517d333  kactivitymanagerd-5.27.10.tar.xz
c1810c7d54842028fb5968097add5538  plasma-integration-5.27.10.tar.xz
#75bedf5da4b7497a18238011d12bec26  plymouth-kcm-5.27.10.tar.xz
440dd7cb1f43d7d86862a1165b48c4f2  xdg-desktop-portal-kde-5.27.10.tar.xz
657984f8356578253e1911c8d35041f6  drkonqi-5.27.10.tar.xz
912db896afe71a8283e36037b4bba79e  plasma-vault-5.27.10.tar.xz
e03d33ca8a9905df3c2901cef5512a14  plasma-browser-integration-5.27.10.tar.xz
30797f3809675e61542518f9b15be2c3  kde-cli-tools-5.27.10.tar.xz
1319f82a4043456a4cb99cfcc2ba90fe  systemsettings-5.27.10.tar.xz
2861104cf1e31393d9cd87701042d3aa  plasma-thunderbolt-5.27.10.tar.xz
#79ffc86387c7024bd834b349fba9b79f  plasma-nano-5.27.10.tar.xz
#802d5a3cd34f5ec3825c21905f0ed9db  plasma-mobile-5.27.10.tar.xz
1f4875f2cf9c0d949961aa9ad6635e6f  plasma-firewall-5.27.10.tar.xz
b6648b45d9824b565dda1f100e7d83a6  plasma-systemmonitor-5.27.10.tar.xz
8e46e5afde739a6361b1838f71eb182d  qqc2-breeze-style-5.27.10.tar.xz
fd93592f9895c5c09f4c0db771c1710a  ksystemstats-5.27.10.tar.xz
4f55bb4490751abb23046165d68e8ca7  oxygen-sounds-5.27.10.tar.xz
#6300c88c07debeb60760dede52a791ee  aura-browser-5.27.10.tar.xz
00afc45528267a5e2ec11b47b8a7779b  kdeplasma-addons-5.27.10.tar.xz
7f432fbb0d205d6e30714e731f91a459  kpipewire-5.27.10.tar.xz
5f37a2e3acf00a0616e13d86ed225d7f  plank-player-5.27.10.tar.xz
f3a08cefe61643273a9e06cfd6b2746a  plasma-bigscreen-5.27.10.tar.xz
a69142a27ab62c583fa5d4d4577427ff  plasma-remotecontrollers-5.27.10.tar.xz
#16e67ca215d44ec59130214ca6e13e80  flatpak-kcm-5.27.10.tar.xz
#4ef3e1d988e5edfa8ee20f9373a82680  plasma-welcome-5.27.10.tar.xz
EOF
[Note]

About Commented out Packages

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. The plasma-mobile package provides phone functionality for Plasma. The aura-browser package requires qtwebengine-5.15.17. The discover package requires AppStream-1.0.1 to be built with the -Dqt=true switch. The discover-5.27.10.1 version of the package is an update to the previous version. The plasma-welcome package requires the external package kaccounts-integration. The flatpack-kcm package is for managing support of flatpack applications.

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.15p5 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.27.10.md5

exit

If you did not set $KF5_PREFIX to /usr, create symlinks to allow display managers to find Plasma, and to allow the XDG Desktop Portal to be detected:

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
as_root install -dvm 755 /usr/share/xdg-desktop-portal     &&
cd /usr/share/xdg-desktop-portal/                          &&
[ -e kde-portals.conf ]                                    ||
as_root ln -sfv $KF5_PREFIX/share/xdg-desktop-portal/kde-portals.conf
as_root install -dvm 755 /usr/share/xdg-desktop-portal/portals &&
cd /usr/share/xdg-desktop-portal/portals                       &&
[ -e kde.portal ]                                              ||
as_root ln -sfv $KF5_PREFIX/share/xdg-desktop-portal/portals/kde.portal

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

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

cat > ~/.xinitrc << "EOF"
dbus-launch --exit-with-x11 $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.