Building Plasma 5

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

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

The instructions below build all of the Plasma 5 packages in one step by using a bash script.

Package Information

Plasma 5 Dependencies

Required

GTK+-2.24.33, GTK+-3.24.38, KDE Frameworks-5.109.0, kuserfeedback-1.2.0, libpwquality-1.4.5, libqalculate-4.7.0, libxkbcommon-1.5.0, Mesa-23.1.6 built with Wayland-1.22.0, NetworkManager-1.44.0, pipewire-0.3.77, PulseAudio-16.1, qca-2.3.7, sassc-3.6.2, taglib-1.13.1, and xcb-util-cursor-0.1.4

Recommended

Recommended (runtime)

Optional

GLU-9.0.3, ibus-1.5.28, qtwebengine-5.15.15, Xorg Synaptics Driver-1.9.2, appstream-qt, KDevPlatform, libgps, libhybris, libraw1394, mockcpp, packagekit-qt, Qalculate, Qapt, SCIM, and socat (for pam_kwallet)

[Note]

Note

qtwebengine-5.15.15 is required for aura-browser. It is also optional for two other packages: libksysguard and kdeplasma-addons. If QtWebEngine is installed later, only these two packages need to be rebuilt. This allows a more complete display in the system monitor application.

Editor Notes: https://wiki.linuxfromscratch.org/blfs/wiki/kf5

Downloading KDE Plasma5

The easiest way to get the KDE Plasma5 packages is to use a single wget to fetch them all at once:

url=https://download.kde.org/stable/plasma/5.27.7/
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-5.27.7.md5 << "EOF"
f8e36636128efc0172b0664df372f350  kdecoration-5.27.7.tar.xz
0f40e7e4ef0675cf06afc828c6056821  libkscreen-5.27.7.tar.xz
fdbbd274867d8013631eb66f889da983  libksysguard-5.27.7.tar.xz
6d0358ed7bbb27557c073cfce675120f  breeze-5.27.7.tar.xz
7dac534103b595e861fb923e0a46af8a  breeze-gtk-5.27.7.tar.xz
27839d93e7bf42bd8e6e9d822572a3d3  layer-shell-qt-5.27.7.tar.xz
56e13a523dc2b27dd2fe7d17cf87c427  kscreenlocker-5.27.7.tar.xz
1806b24c107c30a0144be0c58361c391  oxygen-5.27.7.tar.xz
b3b25a757de32befe4c282ebc9b928c3  kinfocenter-5.27.7.tar.xz
f992f11ed7704e94809f4a609b444074  kwin-5.27.7.tar.xz
5aa3a8e2e8c97b182cb15090f9149831  plasma-workspace-5.27.7.tar.xz
2b3c139e30eaaf4cf42706c9e6212ca5  plasma-disks-5.27.7.tar.xz
a347a0848863114e96ca25868b1d2483  bluedevil-5.27.7.tar.xz
77731f7530552c096785e938554c5c0e  kde-gtk-config-5.27.7.tar.xz
19a17f02655872c827380bd1fc485b50  khotkeys-5.27.7.tar.xz
4777cae88cb32e1dc77d6765f3cf17e3  kmenuedit-5.27.7.tar.xz
a9618c0aa86cf8d0186e146aef644cd7  kscreen-5.27.7.tar.xz
d75c043ef114b2b590f8ede12bb86a24  kwallet-pam-5.27.7.tar.xz
9c4ebb3d608c08c83b87a880b731ef11  kwayland-integration-5.27.7.tar.xz
2d04936cfcdb3da0ecab6b9c7f83339e  kwrited-5.27.7.tar.xz
ea10ad5ac86ad2a1f1c0dfdb28918ad8  milou-5.27.7.tar.xz
1640a01420f5885d87e55a3fc3ca8410  plasma-nm-5.27.7.tar.xz
24cdd5610e2b02c774486cdeaf0074f5  plasma-pa-5.27.7.tar.xz
4d941372e2a0ba9fe4a42a668dfd6aeb  plasma-workspace-wallpapers-5.27.7.tar.xz
003d40545b13d58a2fa024236c92c18f  polkit-kde-agent-1-5.27.7.tar.xz
2708af1b47a164321111220f3e3fb5f8  powerdevil-5.27.7.tar.xz
7f7d2bea26b4d825c9a6e8d57e400a4a  plasma-desktop-5.27.7.1.tar.xz
#b8f2c72d4d0ffd37573c1f949e8604aa  plasma-desktop-5.27.7.tar.xz
f66aefab6b7b3115ead7cf3966d6e2c6  kgamma5-5.27.7.tar.xz
614a24e70dfdcbf225047951d1bb35af  ksshaskpass-5.27.7.tar.xz
#8e9460adae337baab8d80da3422f9e34  plasma-sdk-5.27.7.1.tar.xz
#69bcb008dc0c22bb9dad2f990778b46e  plasma-sdk-5.27.7.5.27.7.1.tar.xz
#cba2b18c587dff393bd232d61a35046d  plasma-sdk-5.27.7.tar.xz
293fa8cd57834e07c719a055e2b47fbe  sddm-kcm-5.27.7.tar.xz
#7857d8972a9cc45cc3b672a6d5ff2b12  discover-5.27.7.tar.xz
#9727481d29a7468420cb1a37a0b36e9e  breeze-grub-5.27.7.tar.xz
#157416774eb4bfc57a4e2caf4512f069  breeze-plymouth-5.27.7.tar.xz
cdda9f9d374615768d8a324dae92ad1d  kactivitymanagerd-5.27.7.tar.xz
3e8fd694b222d4d6c3d4e2b952099fb0  plasma-integration-5.27.7.tar.xz
#7bd722f2799f4b1c562be46c5b2d0da1  plymouth-kcm-5.27.7.tar.xz
26e40eaf358dc02d71ab5cb511a5b3a8  xdg-desktop-portal-kde-5.27.7.tar.xz
ce2a9be64095829d124d4f83c14a464c  drkonqi-5.27.7.tar.xz
410818deea59fc12aa3ed155e350e931  plasma-vault-5.27.7.tar.xz
4636852897f802e64501fbae5e3dfb24  plasma-browser-integration-5.27.7.tar.xz
3febab89d2fca2e67271d5e35723d7be  kde-cli-tools-5.27.7.tar.xz
799ec2ab0012e47d2b1660affe5f333e  systemsettings-5.27.7.tar.xz
fa9f2208c27d8a3e99c0cbb113087338  plasma-thunderbolt-5.27.7.tar.xz
#c4dbf6737cc9d8d3396214d4bed14abf  plasma-nano-5.27.7.tar.xz
#74a1ec9c76b979fb8a3906204c93add4  plasma-mobile-5.27.7.tar.xz
ca0a794b2d65c9c763d0f932b2bd9c1e  plasma-firewall-5.27.7.tar.xz
4f3a9803e3741521b1867303b179670a  plasma-systemmonitor-5.27.7.tar.xz
29fb63dc5c266b3fe0a2e849f1a1db28  qqc2-breeze-style-5.27.7.tar.xz
2e3689a958a72aa1a09aa6edf471ce11  ksystemstats-5.27.7.tar.xz
08434c4829aefd689c877fe84baa5ad6  oxygen-sounds-5.27.7.tar.xz
#2b1b01328d062d6d9c3d92daaa26d13c  aura-browser-5.27.7.tar.xz
a32fedd93e3ecef504ea28ec27cbfd55  kdeplasma-addons-5.27.7.tar.xz
1d759ab0bb02f630385e4dc267aaef6e  kpipewire-5.27.7.tar.xz
553afd4e952b601147ca868b7129303d  plank-player-5.27.7.tar.xz
51ad32e45ad4a0f5291d1a9ce4efa0f2  plasma-bigscreen-5.27.7.tar.xz
fb25df16ef388f7dbfc163911e7828be  plasma-remotecontrollers-5.27.7.tar.xz
#507a8d13920b160b4683b093e90f6088  flatpak-kcm-5.27.7.tar.xz
#9eadbc5ec19e2122f81742e0f38941f7  plasma-welcome-5.27.7.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 and plasma-mobile provides phone functionality for Plasma. The aura-browser package requires qtwebengine-5.15.15. The discover package requires the external package appstream-qt. The plasma-welcome package requires the external package kaccounts-integration. The flatpack-kcm package is for managing support of flatpack applications.

Installation of Plasma5

[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.14p3 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 -DCMAKE_INSTALL_PREFIX=$KF5_PREFIX \
             -DCMAKE_BUILD_TYPE=Release         \
             -DBUILD_TESTING=OFF                \
             -Wno-dev ..  &&

        make
        as_root make install
    popd


    as_root rm -rf $packagedir
    as_root /sbin/ldconfig

done < plasma-5.27.7.md5

exit

If you did not set $KF5_PREFIX to /usr, create symlinks to allow display managers to find Plasma:

as_root install -dvm 755 /usr/share/xsessions              &&
cd /usr/share/xsessions/                                   &&
[ -e plasma.desktop ]                                      ||
as_root ln -sfv $KF5_PREFIX/share/xsessions/plasma.desktop &&
as_root install -dvm 755 /usr/share/wayland-sessions       &&
cd /usr/share/wayland-sessions/                            &&
[ -e plasmawayland.desktop ]                               ||
as_root ln -sfv $KF5_PREFIX/share/wayland-sessions/plasmawayland.desktop

Useless systemd units have been installed in $KF5_PREFIX/lib. Remove them now (as root):

rm -rf $KF5_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 Plasma5

You can start Plasma5 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 5 using xinit-1.4.2, run the following commands:

cat > ~/.xinitrc << "EOF"
dbus-launch --exit-with-x11 $KF5_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 (63 in /opt/kf5/bin) to list separately here.
Installed Libraries: There are too many plasma libraries (40 in /opt/kf5/lib) to list separately here.
Installed Directories: There are too many plasma directories (over 1000 in /opt/kf5) to list separately here.