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.87.0, GTK+-3.24.43, KDE Frameworks-6.9.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.3, libxkbcommon-1.7.0, Mesa-24.3.2 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.4 (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.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.2.4.md5 << "EOF"
d45182d9750cdd4a44dea312340aa44d  kdecoration-6.2.4.tar.xz
d6138bd3fee9280035140b13dd412b34  libkscreen-6.2.4.tar.xz
74e01a9cca86c37c3123f6ff5dfcda90  libksysguard-6.2.4.tar.xz
abf45c8785d3b0d424c3adbaaaa232d3  breeze-6.2.4.tar.xz
9ebbb0dcb0429259b70e277fbb2ad863  breeze-gtk-6.2.4.tar.xz
616e6ff8ac36fcb83034b4323c0a0042  layer-shell-qt-6.2.4.tar.xz
e5f30475eedf219b7b2018ea47f82789  plasma-activities-6.2.4.tar.xz
572785ac1859e74e3ce73f7ce72c117b  libplasma-6.2.4.tar.xz
42e05149b6ff48c972fa25212fddc146  kscreenlocker-6.2.4.tar.xz
4c2a4cf2f9331d6e077dbd049af1bf20  kinfocenter-6.2.4.tar.xz
5e57d4f3cc9f6c53de892c9ced82517e  kglobalacceld-6.2.4.tar.xz
76e7a22a26b48b85aed88b9df0d9f9ad  kwayland-6.2.4.tar.xz
1114b7215ba1196c5f5c3f2ae5bbef52  kwin-6.2.4.tar.xz
885b799c6b42e33d0784f5f0d3932bdb  plasma5support-6.2.4.tar.xz
adf34da687444af8e1b2816887fd0249  plasma-activities-stats-6.2.4.tar.xz
e61e926038b6cb2c2b8bb97a7693022a  kpipewire-6.2.4.tar.xz
10b196bd84ff8e3d71811e96d1040b91  plasma-workspace-6.2.4.tar.xz
f30e9c5962ea5c7df0a8e239bdad97d8  plasma-disks-6.2.4.tar.xz
20805abd1814da27991cd31e1a5e4d40  bluedevil-6.2.4.tar.xz
5d4f1b5b90fc531ef3015a9b85b867ca  kde-gtk-config-6.2.4.tar.xz
2737e30338a08ebec8b3a77eacd08dcf  kmenuedit-6.2.4.tar.xz
3a2f8554367848ba8d92e4d22a7038b3  kscreen-6.2.4.tar.xz
9cba151ec1093380e18d344cb59621f8  kwallet-pam-6.2.4.tar.xz
d81760474bc88de769affb0dcf5396d5  kwrited-6.2.4.tar.xz
ad82b1814d1342015d3fe5c7fa6d9038  milou-6.2.4.tar.xz
9f982db1280c9f6cd2f04db3ff37e67c  plasma-nm-6.2.4.tar.xz
73037a46ad7c06f1f98365f49fc3844d  plasma-pa-6.2.4.tar.xz
7c6f211d396b1442dc1d04569c915c1c  plasma-workspace-wallpapers-6.2.4.tar.xz
30dc7fce2c3eca48f36180f67dcb016b  polkit-kde-agent-1-6.2.4.tar.xz
7f6ee12b0e24ac327a77e4f4a1cdddc4  powerdevil-6.2.4.tar.xz
8cad5a2963eb7875961bb6ca6bdaf492  plasma-desktop-6.2.4.tar.xz
ea36155e721421ea2713d656079626dd  kgamma-6.2.4.tar.xz
a26edf04d2305053e3ef8ce418cb845f  ksshaskpass-6.2.4.tar.xz
#0b6652f78f37aeb130e068a690c27b12  plasma-sdk-6.2.4.tar.xz
31d57c1044de454b81b292bae3e245d8  sddm-kcm-6.2.4.tar.xz
#7d9728fa0e849504a394454657846067  discover-6.2.4.tar.xz
#b73b03b1a76cfa4b2158be6c3ce57c8b  breeze-grub-6.2.4.tar.xz
#09b9de495bb0d059903fe48c81492c40  breeze-plymouth-6.2.4.tar.xz
1b9cbac512b186ac913683c10fe62a77  kactivitymanagerd-6.2.4.tar.xz
12665b88d77efbfc55e38c62c1cd3710  plasma-integration-6.2.4.tar.xz
#234a0b42df3f62e139fd75bf0e685a5b  plymouth-kcm-6.2.4.tar.xz
dbb281caa803293cb24f2e52771d993a  xdg-desktop-portal-kde-6.2.4.tar.xz
8584f329202ec2860d24f24d2804fd55  drkonqi-6.2.4.tar.xz
077041dc6084e5a95e2ec519515a65dd  plasma-vault-6.2.4.tar.xz
#c5d0db08dfa4515a0ccef2f37bb58bb3  plasma-browser-integration-6.2.4.tar.xz
b8acc57a3dd34bd8fe8363e38c5f9060  kde-cli-tools-6.2.4.tar.xz
9e13f2bfe53dd1055229571db60538c2  systemsettings-6.2.4.tar.xz
fd80c0d75ebbf28ea9528b89116f4516  plasma-thunderbolt-6.2.4.tar.xz
#6e627c0b40c10f11fccabeef27de1e65  plasma-mobile-6.2.4.tar.xz
#a85167e03ff9bf13646a30d8377a0fec  plasma-nano-6.2.4.tar.xz
20d9d1d56e7a237c8caa85a2e1a6a42f  plasma-firewall-6.2.4.tar.xz
3209490a3e7d83ecdf9b99015730c8ad  plasma-systemmonitor-6.2.4.tar.xz
c569742ea3773a1974b49916fa0e7758  qqc2-breeze-style-6.2.4.tar.xz
31d65c9369168e894da260fdb7458fc9  ksystemstats-6.2.4.tar.xz
cc00b06ec43a532d1ba328f66f551d4f  oxygen-sounds-6.2.4.tar.xz
1c8ab0e36d6949b24561ecfa9397cac5  kdeplasma-addons-6.2.4.tar.xz
#493b2674a3c428241cb3de5ff31041fe  flatpak-kcm-6.2.4.tar.xz
7567ac573a47b814a4fa5b26f5f0a608  plasma-welcome-6.2.4.tar.xz
bcfe9b83adbc1fa180708980ba562a6f  ocean-sound-theme-6.2.4.tar.xz
19fe729b51a24a023dd179b9552d6ac5  print-manager-6.2.4.tar.xz
d8c405fc84f9868d6801ca819eb139ed  wacomtablet-6.2.4.tar.xz
#41204323446f19ec0f6e44cc83e281ae  kwayland-integration-6.2.4.tar.xz
#6ef4cf89fbfff92f1716c05b4afad6b9  krdp-6.2.4.tar.xz
b3408c1d938697feb688249ab5d52f2d  oxygen-6.2.4.tar.xz
#e7765045675048862ae8c130b2d09ed9  plasma-dialer-6.2.4.tar.xz
#57e7381b8c0bb1cef8a705451b63977f  spacebar-6.2.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.4 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.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.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.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.