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.85.0, GTK+-3.24.42, KDE Frameworks-6.2.0, kirigami-addons-1.2.1, libdisplay-info-0.1.1, libpwquality-1.4.5, libqalculate-5.1.1, libnl-3.9.0, libxcvt-0.1.2, libxkbcommon-1.7.0, Mesa-24.0.8 built with Wayland-1.23.0, pipewire-1.0.7, 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.3 (build with -qt=true), GLU-9.0.3, ibus-1.5.30, qtwebengine-6.7.1, 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.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-6.0.5.md5 << "EOF"
fb602565447d49747a7dda2aa40c4d4f  kdecoration-6.0.5.tar.xz
130f277cd002be34fad025dc78222db9  libkscreen-6.0.5.tar.xz
be08ef0ddb460588ab2ac89d9a537956  libksysguard-6.0.5.tar.xz
c819c48d6ad6ea4c0ef25cb8bf7f9a57  breeze-6.0.5.tar.xz
851d8b1ed70a24b83d1ee34cabffbd6c  breeze-gtk-6.0.5.tar.xz
7e901330dfc754378f1f88fae0a9941a  layer-shell-qt-6.0.5.tar.xz
4bced972e9db7eac8a0fa8ce22dcac6b  plasma-activities-6.0.5.tar.xz
8c4ce38506ec355a77d3c2cef61d6b5b  libplasma-6.0.5.tar.xz
ca79da353a27361afab76e6a6d09f364  kscreenlocker-6.0.5.tar.xz
f97e0e893d49df544614350db71adbd4  kinfocenter-6.0.5.tar.xz
26fe1aacf9d4d415d1853e113618b66b  kglobalacceld-6.0.5.tar.xz
83985c22ca89897cf17b803a9b50f15e  kwayland-6.0.5.tar.xz
889a0c874a93a9892c70a6cd9969abb7  kwin-6.0.5.tar.xz
453a34c77f28ad6d8422d79b88bf7b9f  plasma5support-6.0.5.tar.xz
3dcad1de3a6866f615597576b305ebce  plasma-activities-stats-6.0.5.tar.xz
84caae7612832d683c373f5415788747  kpipewire-6.0.5.tar.xz
#7697ef8eedbc90c06e160507775f9e3b  plasma-workspace-6.0.5.tar.xz
518d71251d583c3ad13803779f03c2ff  plasma-workspace-6.0.5.1.tar.xz
325d6807259349e4a4a9e9740c752e62  plasma-disks-6.0.5.tar.xz
327b7df00c4a2bed328348a843cd10f6  bluedevil-6.0.5.1.tar.xz
#b7c69ea25e4e401b78aab4bd59488190  bluedevil-6.0.5.tar.xz
ea1982dd90db2730b0f2c590aead7fce  kde-gtk-config-6.0.5.tar.xz
5cdef6d17824b2a9bfde05e217497a7b  kmenuedit-6.0.5.tar.xz
b5c9406a29aa68a3f6b1d4a48efa9f91  kscreen-6.0.5.tar.xz
b0a25bc01b7f65e0207d5ebfc307ed8b  kwallet-pam-6.0.5.tar.xz
42290d2c2cf87fc1b835332414b9d047  kwrited-6.0.5.tar.xz
cf120d99e7d14964fef5de4e1cfcb7a3  milou-6.0.5.tar.xz
949b249d147e2b3213d7e4c1b5bb8590  plasma-nm-6.0.5.tar.xz
e4274d2a91d96e3f0774aa94a57eba58  plasma-pa-6.0.5.tar.xz
a6d4f30dbb3eaa9147cb5ccd788472d8  plasma-workspace-wallpapers-6.0.5.tar.xz
fb2f392f7370bd665b918f10ec1fbe38  polkit-kde-agent-1-6.0.5.tar.xz
deef232b4ceb90980818fa4358a37d52  powerdevil-6.0.5.tar.xz
4ac4551e1afb524155a1c5fd1028158e  plasma-desktop-6.0.5.tar.xz
47460a8289c726a2a69c4511a3bdc007  kgamma-6.0.5.tar.xz
2f52416fb211ab956d430759a864c382  ksshaskpass-6.0.5.tar.xz
#6edf6bb59da445ff7868670503714ec7  plasma-sdk-6.0.5.tar.xz
8852a3f7ee9cf2c1b2cdce4da79e1709  sddm-kcm-6.0.5.tar.xz
#f84b8a4b729850cc05ef7e06f7526fec  discover-6.0.5.tar.xz
#6e17a1954b2a58f220036e630fd40f64  breeze-grub-6.0.5.tar.xz
#387c3ff10618dcd37b5b4c1a42902c86  breeze-plymouth-6.0.5.tar.xz
5456b489df70cd0729f105327f5f71ff  kactivitymanagerd-6.0.5.tar.xz
0af72c4d39d434137a5f36eb8a67efe3  plasma-integration-6.0.5.tar.xz
#5dbfe960bf77156fb55e1a0134448655  plymouth-kcm-6.0.5.tar.xz
3225b3c5d71e0d24c13392137a472be1  xdg-desktop-portal-kde-6.0.5.tar.xz
f700792dae0709d39e0eff83127c2165  drkonqi-6.0.5.tar.xz
bb84a93d616e451b24ed0b8fe3baf24d  plasma-vault-6.0.5.tar.xz
#0623a32f1d444dfa77c668e8f12fa329  plasma-browser-integration-6.0.5.tar.xz
ef739ab228cb266108ccdc43f7ecb153  kde-cli-tools-6.0.5.tar.xz
f56788b6b76f847df6463f4d5aaa4c49  systemsettings-6.0.5.tar.xz
97f0fa5b27e91b5dc502e73fb96c616e  plasma-thunderbolt-6.0.5.tar.xz
#6bc6da7089cf4c526d0ed9744a9629d5  plasma-nano-6.0.5.tar.xz
#a3588aad3c6c7baaa77f6343bfa9f734  plasma-mobile-6.0.5.tar.xz
778a0e478764fa02fbadbc5a54087323  plasma-firewall-6.0.5.tar.xz
ba5c4c7cb7ab13d33ff3b5b5b8cb8b9b  plasma-systemmonitor-6.0.5.tar.xz
f07d41d35c675e2c3a1fe1e51dbe7f75  qqc2-breeze-style-6.0.5.tar.xz
771bd96d6818f05b5e22dc3a9c2f4871  ksystemstats-6.0.5.tar.xz
c0ee6a9eff0c53ba7db72a2f7ea18944  oxygen-sounds-6.0.5.tar.xz
f166678fa85a8d7fbdb04bac7e7efcb7  kdeplasma-addons-6.0.5.tar.xz
#5727a82e55ba8ce755b4b12a17f39efe  flatpak-kcm-6.0.5.tar.xz
102cfff8c5dd75ffe6a607f97a905e4d  plasma-welcome-6.0.5.tar.xz
058f66a6f172200eb73ae0fc93efec75  ocean-sound-theme-6.0.5.tar.xz
ddc3643fadbf754c2ef3181bfde93400  print-manager-6.0.5.tar.xz
#0fc72159968efc1798af78716b42c2f9  wacomtablet-6.0.5.tar.xz
#b5e7dc5cb908c0a8f8b95b4059152585  kwayland-integration-6.0.5.tar.xz
EOF
[Note]

About Commented Out Packages

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

  • Two packages, bluedevil and plasma-workspace, have been replaced by a 6.0.5.1 version.

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

  • The discover package requires AppStream-1.0.3 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 only used by plasma-meta which is not installed by BLFS.

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

  • The plasma-mobile package provides phone functionality for Plasma.

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

  • The wacomtablet and kwayland-integration applications require 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.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.5.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.