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.0.0, kirigami-addons-1.0.1, libdisplay-info-0.1.1, libpwquality-1.4.5, libqalculate-4.9.0, libxcvt-0.1.2, libxkbcommon-1.6.0, Mesa-24.0.3 built with Wayland-1.22.0, NetworkManager-1.46.0, pipewire-1.0.3, PulseAudio-17.0, qca-2.3.8, qcoro-0.10.0, sassc-3.6.2, taglib-2.0, and xdotool-3.20211022.1

Recommended

Recommended (runtime)

Optional

AppStream-1.0.2 (build with -qt=true), GLU-9.0.3, ibus-1.5.29, qtwebengine-6.6.2, 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.0/
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.0.md5 << "EOF"
599e79f2908879ed7f7ffda3637c54a6  kdecoration-6.0.0.tar.xz
96f956b40d929ddecb208101564aa269  libkscreen-6.0.0.tar.xz
e09b5326dea0c32c64745a0ab3bb17fd  libksysguard-6.0.0.tar.xz
6546c71b2707637fb0c8ffd90abfc981  breeze-6.0.0.tar.xz
6ec29676f896546f9fab485142fff113  breeze-gtk-6.0.0.tar.xz
5d02ead00aa69e96d71fb892aa941fa3  layer-shell-qt-6.0.0.tar.xz
c91f8689b5386ce42d8a270ba669dfc3  plasma-activities-6.0.0.tar.xz
125c3e7cf3bb32d3103bb769c584660f  libplasma-6.0.0.tar.xz
9dbfb8774a5acead43b3a0afb90a893f  kscreenlocker-6.0.0.tar.xz
b37312379616a7c2309c834005ada178  oxygen-6.0.0.tar.xz
643d13b69ffddf133f4067bd25e33034  kinfocenter-6.0.0.tar.xz
4bc12254229c9762e29f2f75d2f44e1a  kglobalacceld-6.0.0.tar.xz
97c448777e08ea7fe53aaef2cb35d17a  kwayland-6.0.0.tar.xz
b5b1a531a62ba3b778c793c63b262509  kwin-6.0.0.tar.xz
5ac7afff15ac496b580526cf5c017db7  plasma5support-6.0.0.tar.xz
d931aa7909d574c0a5b26a4d5af1f4eb  plasma-activities-stats-6.0.0.tar.xz
1ce2e4da8cf65347f6fc5099b418ecc6  kpipewire-6.0.0.tar.xz
4a155013537b80009cc1e7d1582fda33  plasma-workspace-6.0.0.tar.xz
e32c8a5eac1ac01a763bbcc70b3f6945  plasma-disks-6.0.0.tar.xz
4d18ce97c23bbf35d87b73efec71420c  bluedevil-6.0.0.tar.xz
bfc8028a6f0888965a3a555663ba893b  kde-gtk-config-6.0.0.tar.xz
83dffdc80445bbc617f0c0dcef04ca4a  kmenuedit-6.0.0.tar.xz
57acadb3a31ff06cad411269de2ea700  kscreen-6.0.0.tar.xz
7fad253ac68778bf4046b72a892ade92  kwallet-pam-6.0.0.tar.xz
115cb1253c7a903070ff76630370d97d  kwrited-6.0.0.tar.xz
90eb8b277e475f1447472ba467336547  milou-6.0.0.tar.xz
7dcf751acdb6fc66b50734948831731a  plasma-nm-6.0.0.tar.xz
ca57d6c816ae40b595bf3e3e1a2617ff  plasma-pa-6.0.0.tar.xz
f4445ecabf52a5777fa405f36c791d72  plasma-workspace-wallpapers-6.0.0.tar.xz
ae7b1d18a20699124d924b126335aaed  polkit-kde-agent-1-6.0.0.tar.xz
93aacc0af152b6d2e28a694bd211f29d  powerdevil-6.0.0.tar.xz
46d9dee5d8abfc12bd8c3ca8811327e7  plasma-desktop-6.0.0.tar.xz
2b522f3fd18ed563c9fab882b83193eb  kgamma-6.0.0.tar.xz
a832617c17070ec2dce5cf019ab7ab1c  ksshaskpass-6.0.0.tar.xz
#65ceae0e87f6b11ec924d57d764913f4  plasma-sdk-6.0.0.tar.xz
973e99f506a6fdad96a8b43d04a0b510  sddm-kcm-6.0.0.tar.xz
#a7ab65d4a36e402df4b42c91cd2a16da  discover-6.0.0.tar.xz
#bc42922097f6964252a5f56e759c3844  breeze-grub-6.0.0.tar.xz
#f399364375591938bdfb2d235f13923b  breeze-plymouth-6.0.0.tar.xz
c0248379f3df970fa19fe6d341dd00a4  kactivitymanagerd-6.0.0.tar.xz
ad6dee45c10e415a92d76745e5901842  plasma-integration-6.0.0.tar.xz
#e377ca58ca8089ce4e4c26c03e85b4f1  plymouth-kcm-6.0.0.tar.xz
b0a1e9952e09e35f90d8131faed98882  xdg-desktop-portal-kde-6.0.0.tar.xz
53864beb8ca2de75a8e4c1f52b0f4ea5  drkonqi-6.0.0.tar.xz
e6c9b78fd0022d37dc4913e3dbe5205e  plasma-vault-6.0.0.tar.xz
#a5b70716031e98843e8fa1088f2eb0bc  plasma-browser-integration-6.0.0.tar.xz
91f1b7dbde5fcd508f3eab9cdf5f0681  kde-cli-tools-6.0.0.tar.xz
876c57804ef1daadfcce81bb0d7e82a4  systemsettings-6.0.0.tar.xz
29588e3f9d64d092060890a5a438cdb6  plasma-thunderbolt-6.0.0.tar.xz
#cc307526ac2f02e7547cacea0eeccda6  plasma-nano-6.0.0.tar.xz
#5e2effe947e2edf89cce35ef5c2527f6  plasma-mobile-6.0.0.tar.xz
f791645b191b9f2e6cc9e6cf0037af00  plasma-firewall-6.0.0.tar.xz
a4d558a30b2ae93dc680010867e10abc  plasma-systemmonitor-6.0.0.tar.xz
f250350b7fa2ff6f28f88233955c5638  qqc2-breeze-style-6.0.0.tar.xz
28f4d1841cecffaf76462ba20e45c45b  ksystemstats-6.0.0.tar.xz
8aad48fd0f58f08ea197aa6d8e4dfab3  oxygen-sounds-6.0.0.tar.xz
4d7c36f9ada95960ec0619547c716f81  kdeplasma-addons-6.0.0.tar.xz
#df582e99c5288d1c0b8dcd1b34a31d08  flatpak-kcm-6.0.0.tar.xz
#eebf65971b0066c707eef50742a9c49e  plasma-welcome-6.0.0.tar.xz
8f0c51c160819c170dcc77722b6153e3  ocean-sound-theme-6.0.0.tar.xz
b8963fb1790449d4a905cf85f017d1e9  print-manager-6.0.0.tar.xz
#a05c7d650e44cd046fbc090fcbb69ae4  wacomtablet-6.0.0.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 plasma-welcome package requires the external package kaccounts-integration. 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.

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_TESTING=OFF                \
             -W no-dev ..  &&

        make
        as_root make install
    popd


    as_root rm -rf $packagedir
    as_root /sbin/ldconfig

done < plasma-6.0.0.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 partal
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.