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]

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

Plasma Dependencies

Required

Boost-1.84.0, GTK+-3.24.41, KDE Frameworks-6.1.0, kirigami-addons-1.1.0, libdisplay-info-0.1.1, libpwquality-1.4.5, libqalculate-5.0.0, libnl-3.9.0, libxcvt-0.1.2, libxkbcommon-1.7.0, Mesa-24.0.4 built with Wayland-1.22.0, pipewire-1.0.4, PulseAudio-17.0, qca-2.3.8, qcoro-0.10.0, sassc-3.6.2, taglib-2.0.1, xdotool-3.20211022.1, and Xorg Evdev Driver-2.10.6

Recommended

Recommended (runtime)

Optional

AppStream-1.0.2 (build with -qt=true), GLU-9.0.3, ibus-1.5.29, qtwebengine-6.7.0, Xorg Synaptics Driver-1.9.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.0.3/
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.0.3.md5 << "EOF"
186e3608e5a9b4695db6f215b042b262  kdecoration-6.0.3.tar.xz
1f1d12d08bcf9309ab1c49641bb8eaf3  libkscreen-6.0.3.tar.xz
48b300ca4490da873f652596ef7f1444  libksysguard-6.0.3.tar.xz
68307af2cbd738f8222d4899c44e95f3  breeze-6.0.3.tar.xz
ceab9d1b168592840f12ab7b301cee85  breeze-gtk-6.0.3.tar.xz
c1206b4c182b3a01614d0a6ade96e76c  layer-shell-qt-6.0.3.tar.xz
eac6aebafbb8c2cbef5a121d5c0afb10  plasma-activities-6.0.3.tar.xz
2e71b9fb2f41bf2d63dcef0dc5da8fcd  libplasma-6.0.3.tar.xz
209a5df56d6adf25edc58737e7c77ea7  kscreenlocker-6.0.3.tar.xz
109d6dcb1b0fab015bda4c3d508baf1f  oxygen-6.0.3.tar.xz
637e400d06550a3ef3b872f8011470cd  kinfocenter-6.0.3.tar.xz
021e8ab1bca725301425f946db4b74c6  kglobalacceld-6.0.3.tar.xz
7c2273b104ff7f83930d3e6d92b6c458  kwayland-6.0.3.tar.xz
d04c8ab91d6befe8d51bf1f4b90eb733  kwin-6.0.3.1.tar.xz
#5e6e0275809aabbd05bf703f0e1dfd91  kwin-6.0.3.tar.xz
28cb89b0a2c79e65b49a7396d2e156e7  plasma5support-6.0.3.tar.xz
329a0134a743d45a9f85c0f09763fa3f  plasma-activities-stats-6.0.3.tar.xz
c64d5a3b3a2a38e1efaaa18ec0ed0f15  kpipewire-6.0.3.tar.xz
635c8a687f95b77da538dfa67b64cf11  plasma-workspace-6.0.3.tar.xz
fc1f1dbff3071fb70fde8f2b402f2cad  plasma-disks-6.0.3.tar.xz
be2620c0ce9947023c6fda97f9336a2b  bluedevil-6.0.3.tar.xz
e3fffb113826cddf572f1a63a4803285  kde-gtk-config-6.0.3.tar.xz
d3b5bab22961eb000ffca29ed31e853b  kmenuedit-6.0.3.tar.xz
8e1c31ac47e3f5751fa0415c77ffdb93  kscreen-6.0.3.tar.xz
0918f152f0049c8d2f3f96252d40b5d4  kwallet-pam-6.0.3.tar.xz
96a0755c99e66a0f5cc53d6f4c384493  kwrited-6.0.3.tar.xz
9ba1923b7fec42694d930e973894542f  milou-6.0.3.tar.xz
ed40c562d6b4a1b97271bb7d0cfc9710  plasma-nm-6.0.3.tar.xz
7ebe34a38f77fe3547b1f2614803f8ce  plasma-pa-6.0.3.tar.xz
ce37763cc6b1763cdf6c24cd5decd0d9  plasma-workspace-wallpapers-6.0.3.tar.xz
63b3ff934d9eb5fcccca27166dec78af  polkit-kde-agent-1-6.0.3.tar.xz
9ea75163cc91e7e952285fc212745f4f  powerdevil-6.0.3.tar.xz
12923d808bf6f6d9b3a807e72e1941ba  plasma-desktop-6.0.3.tar.xz
41e74069e7487d72feb91b33de0a0c13  kgamma-6.0.3.tar.xz
38b6bf5620962febb86dd526aa1c4788  ksshaskpass-6.0.3.tar.xz
#6c4ceff65c64495bbefdac1f163a2ca9  plasma-sdk-6.0.3.tar.xz
d8ff0a33561736bd81d2f0cf26b80eb9  sddm-kcm-6.0.3.tar.xz
#2f8485cee3dc80bb07fead85571ba8ad  discover-6.0.3.tar.xz
#68daa2b8dbb2e9f3ace51bcbaa2632c1  breeze-grub-6.0.3.tar.xz
#83885a3eba356552f094874192c31c28  breeze-plymouth-6.0.3.tar.xz
52d84e5435c807851e91b31e724b0c2a  kactivitymanagerd-6.0.3.tar.xz
4698864e111f4ca549364fe4fdf09ad3  plasma-integration-6.0.3.tar.xz
#f8a08001b7a6f5865bceda7a28515308  plymouth-kcm-6.0.3.tar.xz
699405b00fd157de30a3a0cbd93703a0  xdg-desktop-portal-kde-6.0.3.tar.xz
497e9cd3c74e79c1401fbacdb5b71513  drkonqi-6.0.3.tar.xz
9b8d1a55ea8bbddb952bd9736155fbaa  plasma-vault-6.0.3.tar.xz
#069994af9dfd7b42c9408a8cd0fc49b3  plasma-browser-integration-6.0.3.tar.xz
c2f06a0b32bc4e17441876c2c6bfa6ad  kde-cli-tools-6.0.3.tar.xz
4af7e9b64eaf7e6055a94988bfe0b0e7  systemsettings-6.0.3.tar.xz
ed18f319cd1e8abc7b6a220983e89dfd  plasma-thunderbolt-6.0.3.tar.xz
#6653173b1b429bd95b9a23a5d9821d5a  plasma-nano-6.0.3.tar.xz
#3e9ad4e8cd7f17c9ec9c27343be81669  plasma-mobile-6.0.3.tar.xz
#1138655f05d7ad84edf55683c5b6359b  plasma-mobile-6.0.3.1.tar.xz
13f3bd14874ddccbf19a454be09df781  plasma-firewall-6.0.3.tar.xz
8ae9665bb844ab84a6cbaa3059c64f50  plasma-systemmonitor-6.0.3.tar.xz
ae65db4bac3bac3cf58ad4198c0b522a  qqc2-breeze-style-6.0.3.tar.xz
3449bff47dd931b1da6e182512034fbc  ksystemstats-6.0.3.tar.xz
787f7051bcc2e1f66dca37bd2326d75e  oxygen-sounds-6.0.3.tar.xz
761ce4d784b8800bb8a51f0b3f8b042d  kdeplasma-addons-6.0.3.tar.xz
#d1513338480b042380a58aed49c1fac9  flatpak-kcm-6.0.3.tar.xz
512b5cc6ef9cbf22784d97b97dd45632  plasma-welcome-6.0.3.tar.xz
62c2fa68a55dc36ac182837a8accc892  ocean-sound-theme-6.0.3.tar.xz
d407dff0646743d613d862d92c118005  print-manager-6.0.3.tar.xz
#2766783e2a2f2e966bab54eddaf1ce59  wacomtablet-6.0.3.tar.xz
#d3c59bcf64a487b17e89fbc9ec34a150  kwayland-integration-6.0.3.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 discover package requires AppStream-1.0.2 to be built with the -Dqt=true switch. The flatpack-kcm package is for managing support of flatpack applications. The plasma-browser-integration package is only used by plasma-meta which is not installed by BLFS. The wacomtablet application requires plasma5 support. Two packages, kwayland-integration-6.0.3 and kwin-6.0.3. have been replaces by 6.0.3.1 versions.

Installation of Plasma

[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 -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-dev ..  &&

        make
        as_root make install
    popd


    as_root rm -rf $packagedir
    as_root /sbin/ldconfig

done < plasma-6.0.3.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.2, or from runlevel 5, using a Display Manager, such as lightdm-1.32.0.

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