Building Plasma

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

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

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

Package Information

Plasma Dependencies

Required

Boost-1.89.0, FFmpeg-7.1.1, GTK-3.24.50, KDE Frameworks-6.17.0, kirigami-addons-1.9.0, libdisplay-info-0.3.0, libpwquality-1.4.5, libqalculate-5.7.0, libnl-3.11.0, libxcvt-0.1.3, libxkbcommon-1.11.0, Mesa-25.1.8 built with Wayland-1.24.0, opencv-4.12.0, phonon-4.12.0, pipewire-1.4.7, pulseaudio-qt-1.7.0, qca-2.3.10, qcoro-0.12.0, sassc-3.6.2, taglib-2.1.1, xdotool-3.20211022.1, and Xorg Evdev Driver-2.11.0

Recommended

Recommended (runtime)

Optional

AppStream-1.0.6 (build with -qt=true), GLU-9.0.3, ibus-1.5.32, qtwebengine-6.9.1, 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.4.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-6.4.4.md5 << "EOF"
1e80c73ad404ff95a607f46ec453ac07  kdecoration-6.4.4.tar.xz
6788dae93c3fb8d3790651c3cc13a459  libkscreen-6.4.4.tar.xz
f7075d4472969968507a72cb35168dbc  libksysguard-6.4.4.tar.xz
e45d3b003a98b53f93b027b26038a4d2  breeze-6.4.4.tar.xz
2d8a7936962ae30177c14f9cad0917ff  breeze-gtk-6.4.4.tar.xz
57485b21e575b632223946b936a11d35  layer-shell-qt-6.4.4.tar.xz
1294ad60e08e3d14263c316c5f2123c3  plasma-activities-6.4.4.tar.xz
69892c484106a65edc8669f9ff07f1de  libplasma-6.4.4.tar.xz
d2660f748364304a38534ad9f8302f65  kscreenlocker-6.4.4.tar.xz
5b2aa8e2f826a5537ce018645094bc06  kinfocenter-6.4.4.tar.xz
2a3cb2bc67a700808ee4de996fbcf7e1  kglobalacceld-6.4.4.tar.xz
5f2f27d10a309f87a7fcc7abe3f33c7a  kwayland-6.4.4.tar.xz
b5ce13deed26c030e80078997bcd3f59  aurorae-6.4.4.tar.xz
29aa486a4c9c03623f06019c4c6f4a6f  kwin-x11-6.4.4.tar.xz
38bd47faac424693d15e6cbec7bb4f8c  kwin-6.4.4.tar.xz
c89eed60be47c41acdaab7f7738474d9  plasma5support-6.4.4.tar.xz
e19f331b7233dfa00c1f9a4dc282aa6d  plasma-activities-stats-6.4.4.tar.xz
1234acb0cf42bb51fa1e44de15300daf  kpipewire-6.4.4.tar.xz
e387fc191c75643adf8647115e5b8135  plasma-workspace-6.4.4.tar.xz
f7955fe53dcfce1d3ee28385fb0460c5  plasma-disks-6.4.4.tar.xz
359c9fcedc3ee2660a7414c96f6a0888  bluedevil-6.4.4.tar.xz
8dd8c635342894da4a61dabc5820fce4  kde-gtk-config-6.4.4.tar.xz
123d1734729b0f6d66c45017d810ff10  kmenuedit-6.4.4.tar.xz
81cfc86c317b76e66c8fa69bd211580e  kscreen-6.4.4.tar.xz
2c7b043f2ec05c4b03f210dcedc0b502  kwallet-pam-6.4.4.tar.xz
5695632187671ca756c4e7185a71195e  kwrited-6.4.4.tar.xz
1a6dd6488b0125451102045aa8efdc1a  milou-6.4.4.tar.xz
2bf7e0444338ae3a792ccaf1049466ed  plasma-nm-6.4.4.tar.xz
00cbf448523569d1ecf799ffe8097961  plasma-pa-6.4.4.tar.xz
44bcf4f669bfa5dfd9b4a54f6016ba7b  plasma-workspace-wallpapers-6.4.4.tar.xz
cf1fe247a40af3e6dd5ca2ad53b327d0  polkit-kde-agent-1-6.4.4.tar.xz
96158610825e79a419a28f45bb809eb9  powerdevil-6.4.4.tar.xz
714b58e169c5d2e8c80d65ca8e284cff  plasma-desktop-6.4.4.tar.xz
35d2e17964ddda121f50098c29d4c30d  kgamma-6.4.4.tar.xz
27a3515f9ae4184b4987c83892d6b74a  ksshaskpass-6.4.4.tar.xz
#070839c487e9d8229ce8298d77480c8b  plasma-sdk-6.4.4.tar.xz
b19b0189993f7ebc509d3e24cc1e8aa0  sddm-kcm-6.4.4.tar.xz
#328b5f55fd21129c9184b7d1b672a0bf  discover-6.4.4.tar.xz
#3094f57a829def773d0f6ebb8b08f1f6  breeze-grub-6.4.4.tar.xz
#b3469dba2137b484b193a99fc064be67  breeze-plymouth-6.4.4.tar.xz
6e15c7a2bb5788b93acebde0318fae83  kactivitymanagerd-6.4.4.tar.xz
902966727cc9a5ebb4761df12e142c32  plasma-integration-6.4.4.tar.xz
#53cde99837265125361385ddf6246070  plymouth-kcm-6.4.4.tar.xz
eaeb0a047ac662cef2ecaf03a336ce91  xdg-desktop-portal-kde-6.4.4.tar.xz
b2b868b09d36cdbd77d086c3e215947e  drkonqi-6.4.4.tar.xz
2d2c9bcc3d499fadff6ba8c78e0a78d6  plasma-vault-6.4.4.tar.xz
#5c043fbaf5c84975c469472cc5880a59  plasma-browser-integration-6.4.4.tar.xz
7b9720ff5aaccfff5a9dddc2a71e4eb6  kde-cli-tools-6.4.4.tar.xz
88cf35de0ee8ca3b45474ffaf0d54432  systemsettings-6.4.4.tar.xz
5e2c2591807a58cf6cdf4e884c3dd4be  plasma-thunderbolt-6.4.4.tar.xz
#6a9b80fa6e10454556c4528c2510b2f7  plasma-mobile-6.4.4.tar.xz
#257173def078b51674cd27601828d732  plasma-nano-6.4.4.tar.xz
3c58fb9253970cb7a651088f423e0d9c  plasma-firewall-6.4.4.tar.xz
ff6d636282233f101ec9349321cc4e70  plasma-systemmonitor-6.4.4.tar.xz
3e2a5476e578a309854f7a965bd627a8  qqc2-breeze-style-6.4.4.tar.xz
9d4579bd5ce554f5d21bfe41a0fe64e6  ksystemstats-6.4.4.tar.xz
3fcde8974282d0ae737f38a2d5cc4c7e  oxygen-sounds-6.4.4.tar.xz
88e1e9c59db958a326c8e59769334eae  kdeplasma-addons-6.4.4.tar.xz
#e2af8aad6f916339a20d79b70434adde  flatpak-kcm-6.4.4.tar.xz
d6849ab3c3d626217e71ac5c571a0e56  plasma-welcome-6.4.4.tar.xz
67e934afb009c0cc85b6b5a7818dfc21  ocean-sound-theme-6.4.4.tar.xz
6a4cc6c6068851e488a85f94efe40959  print-manager-6.4.4.tar.xz
d66d7c32a5811a172ede92e86d0b050b  wacomtablet-6.4.4.tar.xz
#6df9d0417921b08811b3b37640f81ae7  kwayland-integration-6.4.4.tar.xz
#e377c170815f38c88d04fbacc6c2ba46  krdp-6.4.4.tar.xz
8bcecf5327af741a21af37a93901fd35  oxygen-6.4.4.tar.xz
#079df59ec207b0c7d9e83fd544c34af9  plasma-dialer-6.4.4.tar.xz
#2425c5d7af8b994b9b2a7b78db8a5bb3  spacebar-6.4.4.tar.xz
51b35f64a4e47bb39d1c27f1e6171ab9  spectacle-6.4.4.tar.xz
EOF
[Note]

About Commented Out Packages

In the above list, several files are commented out with a hash (#) character.

  • The plasma-sdk package is optional and used for software development.

  • The discover package requires AppStream-1.0.6 to be built with the -D qt=true switch.

  • 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-browser-integration package is designed to implement browser integration for Plasma into Mozilla Firefox and Google Chrome. The package does build, but is only useful if you want these browsers to be integrated into the shell in a way that lets you see (and control) downloads from Plasma's notifications area, as well as allowing you to search browser history in the KDE Runner. Note that you must also install a browser extension for this to work. For more details, see the KDE Plasma wiki page about browser integration.

  • The krdp package is used to allow an RDP server to be run while using Plasma. This feature requires the 2.x version of FreeRDP, which is not in BLFS.

  • The plasma-nano package is used for embedded systems.

  • The plasma-mobile, plasma-dialer, and spacebar packages provide phone functionality for Plasma.

  • The flatpak-kcm package is for managing support of flatpak applications.

  • The kwayland-integration application requires plasma5 support.

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.17p2 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
    name=$(      echo $pkg |sed 's|-6.*$||')   # Isolate package name
    packagedir=$(echo $pkg |sed 's|\.tar.*||') # Source 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.4.4.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.4, or from runlevel 5, using a Display Manager, such as lightdm-1.32.0.

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