Building Plasma

KDE Plasma is a collection of packages based on top of KDE Frameworks and QML. They implement the KDE Display Environment (Plasma).

This package is known to build and work properly using an LFS 12.2 platform.

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.5.0, kirigami-addons-1.4.0, libdisplay-info-0.2.0, libpwquality-1.4.5, libqalculate-5.2.0, libnl-3.10.0, libxcvt-0.1.2, libxkbcommon-1.7.0, Mesa-24.1.5 built with Wayland-1.23.0, pipewire-1.2.3, pulseaudio-qt-1.5.0, qca-2.3.9, 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.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.1.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.1.4.md5 << "EOF"
be3516c192fcdbed07454de4b379f5db  kdecoration-6.1.4.tar.xz
dfd2bd982b5ab4daa5a3545e54cf9cb3  libkscreen-6.1.4.tar.xz
c05c1623be161c149a61ac3db0ce5382  libksysguard-6.1.4.tar.xz
7035691a6f63b28f389d76002afc3da8  breeze-6.1.4.tar.xz
9d82aff77358f55069020a408987c111  breeze-gtk-6.1.4.tar.xz
2e3a5220acf76e2c0edf9701978e802b  layer-shell-qt-6.1.4.tar.xz
250385889199481e81b979bd0dd51669  plasma-activities-6.1.4.tar.xz
d6686b711c1e52c0de7c75b66c9dc6e3  libplasma-6.1.4.tar.xz
98101a610670cfae5779bc9940d8561f  kscreenlocker-6.1.4.tar.xz
ca7bf1418903745c65dcbf7583299ceb  kinfocenter-6.1.4.tar.xz
4c4b58890f3bf7bf1b1d99e89f9271a8  kglobalacceld-6.1.4.tar.xz
d297f096ac9492262b8274a024618bd3  kwayland-6.1.4.tar.xz
2d4516080f370a6cf40351266277b010  kwin-6.1.4.tar.xz
131d3250d9124c8f21751f5e5255a7d6  plasma5support-6.1.4.tar.xz
fc8fe31088cad9f1a904554956df708b  plasma-activities-stats-6.1.4.tar.xz
85a3ff80ec16299dc8aa12190ce2bc24  kpipewire-6.1.4.tar.xz
575c902a134bb24214f76c500460df39  plasma-workspace-6.1.4.tar.xz
d000e0ee0f0e530c9dc64ab9252bc17a  plasma-disks-6.1.4.tar.xz
180136a6b20736c359b999cbd3509afc  bluedevil-6.1.4.tar.xz
3f065b337807c2a37d27a90bbcf1d8d1  kde-gtk-config-6.1.4.tar.xz
bcfa7f92df7c2f1a6c7718a12f81734c  kmenuedit-6.1.4.tar.xz
08590284bc4613804563db94a68c7cd2  kscreen-6.1.4.tar.xz
801318aea037e3d64f0aa7c9ca4fef8b  kwallet-pam-6.1.4.tar.xz
aa6bc381778b4e10c9798c3abeeb5692  kwrited-6.1.4.tar.xz
9c4f88ca9936252f62705f27687af764  milou-6.1.4.tar.xz
cbeb7b6b0094e9ec19af07ea458c8eb3  plasma-nm-6.1.4.tar.xz
aa32529c005706d2253333c93faa45de  plasma-pa-6.1.4.tar.xz
4c7484c0d5e4352372d32a340656abec  plasma-workspace-wallpapers-6.1.4.tar.xz
f904e90a9db900551d228f20dac06a45  polkit-kde-agent-1-6.1.4.tar.xz
312fe34839a8d0861cc676766a4317e4  powerdevil-6.1.4.tar.xz
adc8dad07c1157e79aed7476025b6925  plasma-desktop-6.1.4.tar.xz
cfbc61347436b9ff7ff43b7130d7955a  kgamma-6.1.4.tar.xz
41d6254b23061c4b4067b0d2db150cbf  ksshaskpass-6.1.4.tar.xz
#7bf7fd0d3a4a381148885cd058872212  plasma-sdk-6.1.4.tar.xz
ce1bbaf7df576f6ddccd1adda545657a  sddm-kcm-6.1.4.tar.xz
#5482b86089286d9b0153f09752d57574  discover-6.1.4.tar.xz
#d33ef85fb879f3073f1f26f1695e72f3  breeze-grub-6.1.4.tar.xz
#42bb6940246062b24ee80ac6e3b40e2d  breeze-plymouth-6.1.4.tar.xz
e458fddb447b0c76e8e49bb772b423a9  kactivitymanagerd-6.1.4.tar.xz
e0b3c21962456a5f9f79a739c477c22c  plasma-integration-6.1.4.tar.xz
#bebea20d8972e4052690877455aea645  plymouth-kcm-6.1.4.tar.xz
6bf11a27e32cc81e689867ddf59080c6  xdg-desktop-portal-kde-6.1.4.tar.xz
96d1d51407b85d22f01e6438e8e492cb  drkonqi-6.1.4.tar.xz
34627cfef9b00bc58bc853790e978dfd  plasma-vault-6.1.4.tar.xz
#d7984e9a5d3c4ac7a6e36b656cc16f3a  plasma-browser-integration-6.1.4.tar.xz
626f7f2e373085f948d0809413b0d49f  kde-cli-tools-6.1.4.tar.xz
5ba8376be2db662750ef48f582f22352  systemsettings-6.1.4.tar.xz
db8923a9b87e95dd5ec82a20da4ae95b  plasma-thunderbolt-6.1.4.tar.xz
#0106b72c6a46c966d31b7a4afdb456b3  plasma-mobile-6.1.4.tar.xz
#8a7de2aa288ae50190fcd86a7d72cbcb  plasma-nano-6.1.4.tar.xz
3bc5c58b1d06e4f4f1667799219ae887  plasma-firewall-6.1.4.tar.xz
bf76a58afb8def0a0d07ea65429154fc  plasma-systemmonitor-6.1.4.tar.xz
e6e3a3bc681b7044b5219ed6417f0310  qqc2-breeze-style-6.1.4.tar.xz
d3096345a478a821fa16620dadf95fb4  ksystemstats-6.1.4.tar.xz
03a717ac104f6f44ab9dffafdc37710b  oxygen-sounds-6.1.4.tar.xz
a2f8684825ee231fefad28589f321ce7  kdeplasma-addons-6.1.4.tar.xz
#4691fcec4a83314e82c8d1b64bf23c8e  flatpak-kcm-6.1.4.tar.xz
8175024493047e4e98cd12f4d52bc24b  plasma-welcome-6.1.4.tar.xz
8431d1bf294e2ba3cacd9c455678d118  ocean-sound-theme-6.1.4.tar.xz
ed8102ad60b2c8ae9ce12dcaf1ff3cd5  print-manager-6.1.4.tar.xz
#523c82bcf113168b2113612d7b20e544  wacomtablet-6.1.4.tar.xz
#ebb06249b835ea73743c9cf6e91df4df  kwayland-integration-6.1.4.tar.xz
#87332ae4b1c87a6921651ae9211a7e86  krdp-6.1.4.tar.xz
7ca2419cbdb9e4e9b2822b930ac5ec18  oxygen-6.1.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.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 and krdp-6.1.4.tar.xz packages are 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 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.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.1.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.