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.86.0, GTK+-3.24.43, KDE Frameworks-6.8.0, kirigami-addons-1.4.0, libdisplay-info-0.2.0, libpwquality-1.4.5, libqalculate-5.4.0, libnl-3.11.0, libxcvt-0.1.2, libxkbcommon-1.7.0, Mesa-24.3.1 built with Wayland-1.23.0, pipewire-1.2.7, pulseaudio-qt-1.6.0, qca-2.3.9, qcoro-0.11.0, sassc-3.6.2, taglib-2.0.2, xdotool-3.20211022.1, and Xorg Evdev Driver-2.11.0

Recommended

Recommended (runtime)

Optional

AppStream-1.0.3 (build with -qt=true), GLU-9.0.3, ibus-1.5.31, qtwebengine-6.8.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.2.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.2.3.md5 << "EOF"
2ff46f54fa0ed2984aa634ab8ed92f8c  kdecoration-6.2.3.tar.xz
d673a0d084abd008f1b56c4a2479a7f2  libkscreen-6.2.3.tar.xz
0caba5f7a6ebfbef8adc2be63933cd48  libksysguard-6.2.3.tar.xz
a8564513b84247f088c7e75b41d2a8c7  breeze-6.2.3.tar.xz
24b589121e783a426c74b8dc7c6f8214  breeze-gtk-6.2.3.tar.xz
800123309cc8d13124e58d7c500a3a8f  layer-shell-qt-6.2.3.tar.xz
fb06ef191171a9604cbc047a35aababf  plasma-activities-6.2.3.tar.xz
2120432a72864a558bbc124294ce2ce1  libplasma-6.2.3.tar.xz
888ef82d656558bb3304bea88c9c0ce6  kscreenlocker-6.2.3.tar.xz
611d671fd49017b965cf3974a2cd5b8e  kinfocenter-6.2.3.tar.xz
d982c89b0acce4b7f043e20bcfbd7036  kglobalacceld-6.2.3.tar.xz
080ee5a3a656ba26065df377cc81aded  kwayland-6.2.3.tar.xz
019589ac9cb5c62c92b6deb12bbfce61  kwin-6.2.3.tar.xz
32c23ff1e45f1afa01643f2c90fbb74e  plasma5support-6.2.3.tar.xz
4334541dcd6c6a6b825e94cf2d4ed273  plasma-activities-stats-6.2.3.tar.xz
f2a70f77f66d1c4fb14f384217f0ce09  kpipewire-6.2.3.tar.xz
2ee9b479ba7a93b6084e23fa92e11db2  plasma-workspace-6.2.3.tar.xz
29e3fcd5c49f5594e5877e02b04a1605  plasma-disks-6.2.3.tar.xz
48542e331ccab756b513c00c123d283d  bluedevil-6.2.3.tar.xz
db57c0c1d0fcefe472ba9812cf34f239  kde-gtk-config-6.2.3.tar.xz
34ebd64804d8893545a581ee96a97923  kmenuedit-6.2.3.tar.xz
bba08b76c7a2f772a231f18903b6be12  kscreen-6.2.3.tar.xz
e50d03eb4d441df8757ccbbe58dc7c94  kwallet-pam-6.2.3.tar.xz
12a80fec3f6fe7c1925a19f8eec11c04  kwrited-6.2.3.tar.xz
0e4eaf0cf4ffb933be0d2a7e2fb22240  milou-6.2.3.tar.xz
ab6c9776d0786f12a94b463b3a9d8d51  plasma-nm-6.2.3.tar.xz
ddb1affae30b0b2e1c63ccad15cdc177  plasma-pa-6.2.3.tar.xz
3446af3b74b524bc3f78e9ba7fa2c02d  plasma-workspace-wallpapers-6.2.3.tar.xz
028409d3047f4165b9a08fa08d3862ba  polkit-kde-agent-1-6.2.3.tar.xz
bee8f1f66d58bfc8d598bc7226675da7  powerdevil-6.2.3.tar.xz
8be259b550487f7c7ae0feb426d3ab28  plasma-desktop-6.2.3.tar.xz
bdd6b9594a84c6e340a14c5a8934b0d9  kgamma-6.2.3.tar.xz
7ed2630122af143355ef9078f6040cf8  ksshaskpass-6.2.3.tar.xz
#b3718f5169a8d0f85c006f4805c6c16d  plasma-sdk-6.2.3.tar.xz
0c322a9cc0fd81f05cde6334f091774d  sddm-kcm-6.2.3.tar.xz
#9ad8746a959401eb5a74fb29870c91d3  discover-6.2.3.tar.xz
#dda2a050c14b9516024d167353b9e7f1  breeze-grub-6.2.3.tar.xz
#32852747cbeed189160902d651c95d13  breeze-plymouth-6.2.3.tar.xz
a8ab17c1bbcf578171219f9f4b54604b  kactivitymanagerd-6.2.3.tar.xz
f7aecc20a94b44752361526ae03aea52  plasma-integration-6.2.3.tar.xz
#80b6397d3e154f00266baefeb17967af  plymouth-kcm-6.2.3.tar.xz
d2be45993ca6a6599a48a8b735c55678  xdg-desktop-portal-kde-6.2.3.tar.xz
6583c822bcb6706045ebc1f311319265  drkonqi-6.2.3.tar.xz
2d95e1a177c560870fd1526f887941ea  plasma-vault-6.2.3.tar.xz
#29d6f2e4d5f6bac6c09f6fdf9899f04f  plasma-browser-integration-6.2.3.tar.xz
599d20509fdfd9ddb19bd29c96f50864  kde-cli-tools-6.2.3.tar.xz
d3666adee8e1f40c7d14c1614da29ac5  systemsettings-6.2.3.tar.xz
2d9aeb85c8d1e785a6f5a77b9a06ae93  plasma-thunderbolt-6.2.3.tar.xz
#8c71739b1a81c0cc2671cb7788d96e8b  plasma-mobile-6.2.3.tar.xz
#b812a62332fba386ebcb55e7e5e74ba5  plasma-nano-6.2.3.tar.xz
460e9a295071ab61dd0edcd5bf6d6a73  plasma-firewall-6.2.3.tar.xz
cbbcd79945028a2e39e7ebcd91b694c2  plasma-systemmonitor-6.2.3.tar.xz
41dc8992289b773b477bccd80e786af0  qqc2-breeze-style-6.2.3.tar.xz
e8c39d26e3784b83bd21cfa2b480f7ca  ksystemstats-6.2.3.tar.xz
dc548c81d9e3f2cad96391f790950a5c  oxygen-sounds-6.2.3.tar.xz
13b47b5f1233ddb94ed0a813635398c0  kdeplasma-addons-6.2.3.tar.xz
#c3d42d9371adecca58eeff6409001954  flatpak-kcm-6.2.3.tar.xz
166d2f5513667eaeb1f115bcccfbe20d  plasma-welcome-6.2.3.tar.xz
a444d387e8a5f60d1539f3469a08ead6  ocean-sound-theme-6.2.3.tar.xz
edb63b916fd2c60b58cfb78cee174ef4  print-manager-6.2.3.tar.xz
#d063c75f86ba6e08301417c92658b16e  wacomtablet-6.2.3.tar.xz
#b685048d3fa905b9236e8072bba52a71  kwayland-integration-6.2.3.tar.xz
#347d06cf599e522a21cb0dbb4db543fb  krdp-6.2.3.tar.xz
94675901de34a1f68c03c85a81f5f761  oxygen-6.2.3.tar.xz
#0b5b18fba0f3ea88020e941671fb278f  plasma-dialer-6.2.3.tar.xz
#d469683d867b471c31e859a378579a0c  spacebar-6.2.3.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.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 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 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.16p2 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
    srcdir=$(echo $pkg |sed 's|\.tar.*||')    # Source directory

    tar -xf $file
    pushd $srcdir

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

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 a TTY, using xinit-1.4.2.

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.