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, FFmpeg-7.1, GTK-3.24.48, KDE Frameworks-6.11.0, kirigami-addons-1.4.0, libdisplay-info-0.2.0, libpwquality-1.4.5, libqalculate-5.5.0, libnl-3.11.0, libxcvt-0.1.3, libxkbcommon-1.8.0, Mesa-24.3.4 built with Wayland-1.23.0, pipewire-1.2.7, pulseaudio-qt-1.7.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.2, Xorg Synaptics Driver-1.10.0, 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.3.1/
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.3.1.md5 << "EOF"
f457b6a25bb62ce4484f4fe6937e04b2  kdecoration-6.3.1.tar.xz
e36b1fe40265264b69e38d6da747e3fe  libkscreen-6.3.1.tar.xz
b6e7d97a2b8c09d5488f07eac0d56321  libksysguard-6.3.1.tar.xz
f61c91832bf663ac744bb3fa5b65770b  breeze-6.3.1.tar.xz
e9cf405630dfcaf7381c1eb6d680284a  breeze-gtk-6.3.1.tar.xz
7ac4451498b1512122e9c46f4aa2bcce  layer-shell-qt-6.3.1.tar.xz
90d3672a3dc690677bcc3fcda066a337  plasma-activities-6.3.1.tar.xz
7605cfffb92952473bb733adc91e7667  libplasma-6.3.1.tar.xz
38e975671178b73c3c3ed83cd0219bee  kscreenlocker-6.3.1.tar.xz
e742da872e4990e461fe44feb0de082f  kinfocenter-6.3.1.tar.xz
f9bbe103def746835e5735c878d6c585  kglobalacceld-6.3.1.tar.xz
920b07854eea746b98b6e9e3fe9f77fa  kwayland-6.3.1.tar.xz
f96a6108403d9aa4d53c340af4ac5351  kwin-6.3.1.tar.xz
603a146778ad1740fd4f501455a841da  plasma5support-6.3.1.tar.xz
c003c98ec0e7dc9be7eb755e83c2f810  plasma-activities-stats-6.3.1.tar.xz
da8576da2b91234d5e9dbabe91dcf13d  kpipewire-6.3.1.tar.xz
4be76b0953ba81434a40a87cd7a597e3  plasma-workspace-6.3.1.tar.xz
9cc99c1338c9e15c673a9a2d62332530  plasma-disks-6.3.1.tar.xz
4c200248ae382bceca14c759f0d8fed4  bluedevil-6.3.1.tar.xz
4d641ad97613c7b40655b0f1a95620d1  kde-gtk-config-6.3.1.tar.xz
b889f80a338d9f15ac2057e1152155f5  kmenuedit-6.3.1.tar.xz
3202752435aa046b3d4300e808af52a1  kscreen-6.3.1.tar.xz
2e781230ee8421db7737d46800eb7d6c  kwallet-pam-6.3.1.tar.xz
ba99fb62f638e9452ee68b0627f46d0b  kwrited-6.3.1.tar.xz
fe88abc8fab6435f8d1862b11d6f26df  milou-6.3.1.tar.xz
156dd0d85243bea20624bcd02362517b  plasma-nm-6.3.1.tar.xz
fefca5d29050cd17aa817786c3fbda45  plasma-pa-6.3.1.tar.xz
1908c07514fef650cba0d6cff55b35c5  plasma-workspace-wallpapers-6.3.1.tar.xz
d6aea3ae9c494a46c02ca531e67d42f9  polkit-kde-agent-1-6.3.1.tar.xz
5f8b1988ffb0020888a3c26bc8ca63d2  powerdevil-6.3.1.tar.xz
c6386020a228097ee78258a8d5fe5dab  plasma-desktop-6.3.1.tar.xz
3fd579e8b0c684a78fe0d3098d422865  kgamma-6.3.1.tar.xz
fda1a5f28d5ce691b09cbb790e7e2560  ksshaskpass-6.3.1.tar.xz
#25ac25faec816415682fba5d948a7320  plasma-sdk-6.3.1.tar.xz
1f376a296da2b784476eb5f8446cef40  sddm-kcm-6.3.1.tar.xz
#754ef5141d6fb170ae8418904db3d03a  discover-6.3.1.tar.xz
#d34eac4bf3480b7f39159f685a849dd5  breeze-grub-6.3.1.tar.xz
#7288423bb744c96df7a129551425ad89  breeze-plymouth-6.3.1.tar.xz
8c6a986211453246fc12c0a98c12caa4  kactivitymanagerd-6.3.1.tar.xz
f7521fd31ab491d208674d0156cc1557  plasma-integration-6.3.1.tar.xz
#f7552b59e8237e5b44ea589a8f54f5cc  plymouth-kcm-6.3.1.tar.xz
1aa7a0c424cb8406932ad0d497f2ffae  xdg-desktop-portal-kde-6.3.1.tar.xz
70506bb6259199e15b4b1476c5e79ba2  drkonqi-6.3.1.tar.xz
ae413ca5e76166653567cc6920a96629  plasma-vault-6.3.1.tar.xz
#a4b75ebf127844148e3ffab2411da591  plasma-browser-integration-6.3.1.tar.xz
71e83b1ed122a78f76f89417bf345697  kde-cli-tools-6.3.1.tar.xz
7a4863475ebcc248ccfe6cdded367f1f  systemsettings-6.3.1.tar.xz
e2c791092a2d9909640357b101b66183  plasma-thunderbolt-6.3.1.tar.xz
#a9008d2ca0da990b0e25fbad3fec372e  plasma-mobile-6.3.1.tar.xz
#4db44b13d684683a2d21a5be3ad53290  plasma-nano-6.3.1.tar.xz
0ee19ce7e8d6f35b38a83704ad48fcc8  plasma-firewall-6.3.1.tar.xz
716fb6178aa0ff9643fc3066d8a4529e  plasma-systemmonitor-6.3.1.tar.xz
d1c5e3afc8ec036afa33a907c7106e04  qqc2-breeze-style-6.3.1.tar.xz
8e6d8ef4c8eecbad2ae09fda0752399b  ksystemstats-6.3.1.tar.xz
1d53c89f6ec73d61e56deaf4ca378766  oxygen-sounds-6.3.1.tar.xz
9a0d78943b5362f0b05c844d6d9d5691  kdeplasma-addons-6.3.1.tar.xz
#303fa95a22217b0047357be11fcf5802  flatpak-kcm-6.3.1.tar.xz
256de866431e8e3de113a37187c797e6  plasma-welcome-6.3.1.tar.xz
5a2849ea3ea641429d34902ba6a97b93  ocean-sound-theme-6.3.1.tar.xz
2cb454377480e2b71e20c1b1e0a15d18  print-manager-6.3.1.tar.xz
f73600e5c197adce31367fa0e2b96d57  wacomtablet-6.3.1.tar.xz
#ae8f4e3a4ac994bb23ccd2a32b5c0339  kwayland-integration-6.3.1.tar.xz
#ee166c0d411fd1eda375ec12e11c7d5a  krdp-6.3.1.tar.xz
c2bd79b97cc93b09135a3ae16ea081c0  oxygen-6.3.1.tar.xz
#05269c38a62ee4b4e0915238b52e3aa5  plasma-dialer-6.3.1.tar.xz
#1371fd24c8d63a4f38154f4f3348f07c  spacebar-6.3.1.tar.xz
c49c92329109f5ac30209435e81a31bd  spectacle-6.3.1.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.3.1.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.3, or from runlevel 5, using a Display Manager, such as lightdm-1.32.0.

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