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-10.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

GConf-3.2.6, GTK+-2.24.32, GTK+-3.24.22, KDE Frameworks-5.73.0, libpwquality-1.4.2, libxkbcommon-0.10.0, Mesa-20.1.5 built with Wayland-1.18.0, NetworkManager-1.26.0, pipewire-0.3.9, PulseAudio-13.0, qca-2.3.1, sassc-3.6.1, taglib-1.11.1, and xcb-util-cursor-0.1.3

Recommended

Optional

GLU-9.0.1, ibus-1.5.22, Xorg Synaptics Driver-1.9.1, appstream-qt, KDevPlatform, libgps, libhybris, libraw1394, mockcpp, packagekit-qt, Qalculate, Qapt, SCIM, and socat (for pam_kwallet)

User Notes: http://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=http://download.kde.org/stable/plasma/5.19.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-5.19.4.md5 << "EOF"
018aa45f5cf8e43e7a20618928affebe  kdecoration-5.19.4.tar.xz
3f371e5e60fb8e884af6c6ee247b0e8d  libkscreen-5.19.4.tar.xz
5cafda895bbfa0c06e93c53616b89700  libksysguard-5.19.4.tar.xz
108b5e62a2abca19fcfa3b4ff8f131f3  breeze-5.19.4.tar.xz
2cb9cf02aa9e3c2b8e676165b99f8774  breeze-gtk-5.19.4.tar.xz
67ac644f6ef96bf5b83066022345b4e0  kscreenlocker-5.19.4.tar.xz
0df5f8e9868151a2899ba81f5dec567b  oxygen-5.19.4.tar.xz
d1ce45d4d530d1257416ad1c0ff0286f  kinfocenter-5.19.4.tar.xz
79a948dbf0bb8c83f1f2ee17efd61385  ksysguard-5.19.4.tar.xz
4be1ba7337efe304d0b41a899edc5dc5  kwayland-server-5.19.4.tar.xz
197cadd24436310957258d2b40244ae8  kwin-5.19.4.tar.xz
15d58fbcfcf42d86629af7a77860e5a3  plasma-workspace-5.19.4.tar.xz
6a6d4347ea08f7dbce275fec3931bf26  bluedevil-5.19.4.tar.xz
972626bf6107585561f9f6335d3f8e16  kde-gtk-config-5.19.4.tar.xz
b73b47db04afcb39c6a5547fc4b715dc  khotkeys-5.19.4.tar.xz
0b8fa3d76cb2b6f87d3d76884773d5b5  kmenuedit-5.19.4.tar.xz
60223cfe9581d0913a421877a1946dab  kscreen-5.19.4.tar.xz
a89d3e90f4595b2acb7d911584f1883d  kwallet-pam-5.19.4.tar.xz
b471f4de79180257d05baebb6b9b587e  kwayland-integration-5.19.4.tar.xz
96faee06be1d88890c421b4d6334b783  kwrited-5.19.4.tar.xz
edcdefa304ed8df4d89e2bb48cb1cdd2  milou-5.19.4.tar.xz
a5af79f15adec8b2dd19ce286e575691  plasma-nm-5.19.4.tar.xz
f6eff79bb6a683e66208228ff566c116  plasma-pa-5.19.4.tar.xz
569c55902960eda4658634bac40dd22e  plasma-workspace-wallpapers-5.19.4.tar.xz
0a3f401968a27c3ae5caec07064c2343  polkit-kde-agent-1-5.19.4.tar.xz
9a2c2cbd8df0d5ce5133b842fa5ed636  powerdevil-5.19.4.tar.xz
1f1ea5c20ef9b90f106a2d25a7128a35  plasma-desktop-5.19.4.tar.xz
a8fefae0ae99a25f31c798b921d42564  kdeplasma-addons-5.19.4.tar.xz
3344cda599e9a33c510c9113f9da3948  kgamma5-5.19.4.tar.xz
e490ae9cef3e092124047dbbbcf0a3e5  ksshaskpass-5.19.4.tar.xz
#e211c0b303736f2c913f7eee4b112792  plasma-sdk-5.19.4.tar.xz
da829188c6b8c5116cb156b388adf1b8  sddm-kcm-5.19.4.tar.xz
0787296981e74adb829df253e6cd8a82  user-manager-5.19.4.tar.xz
99e3c88039d905aeee25984807d04f22  discover-5.19.4.tar.xz
#70f67b313e08ff3735c5dabcc4d34d2f  breeze-grub-5.19.4.tar.xz
#a38f1c99c6f43ce767a978319f87a011  breeze-plymouth-5.19.4.tar.xz
c2340132ae128347a83fa8748a46ed9d  kactivitymanagerd-5.19.4.tar.xz
10fea9aa0c4a74dce276bd006f56fdc0  plasma-integration-5.19.4.tar.xz
7645d39b27be8f378b2fe66a9e7a4734  plasma-tests-5.19.4.tar.xz
#74b4d61d44f5181e06fb5ae467f84d2d  plymouth-kcm-5.19.4.tar.xz
a4831d1a9f75b378e690daa07a543a88  xdg-desktop-portal-kde-5.19.4.tar.xz
39c97b134ab62d432187b2fadccacc11  drkonqi-5.19.4.tar.xz
b74993d79c92e8e39cf4910b2401c8f2  plasma-vault-5.19.4.tar.xz
b43af2c7267fcfd591c9b3d1b94dfa80  plasma-browser-integration-5.19.4.tar.xz
d0aa151e8dfe37bc412bf4a9fdfa027d  kde-cli-tools-5.19.4.tar.xz
5d0d2934a79dcd46e10165812ea69cc9  systemsettings-5.19.4.tar.xz
3e05594393cba476cf41c9001fe152f5  plasma-thunderbolt-5.19.4.tar.xz
#6fcb468827748d81a3d79a862e80ee52  plasma-nano-5.19.4.tar.xz
#13d0a1017e9a44fc91b27147866ff36b  plasma-phone-components-5.19.4.tar.xz
EOF
[Note]

Note

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-phone-components provides phone functionality for Plasma.

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.2 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

       # Fix some build issues when generating some configuration files
       case $name in
         plasma-workspace)
           sed -i '/set.HAVE_X11/a set(X11_FOUND 1)' CMakeLists.txt
         ;;
      
         khotkeys)
           sed -i '/X11Extras/a set(X11_FOUND 1)' CMakeLists.txt
         ;;
      
         plasma-desktop)
           sed -i '/X11.h)/i set(X11_FOUND 1)' CMakeLists.txt
         ;;
       esac

       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.19.4.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

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 a TTY, using xinit-1.4.1.

To start Plasma 5 using xinit-1.4.1, run the following commands:

cat > ~/.xinitrc << "EOF"
dbus-launch --exit-with-session $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).

If you intend to start Plasma using a display manager such as lightdm-1.30.0, there will be two entries for Plasma, one for use with Xorg, and another for Wayland. Modify the Xorg entry with the following command, as the root user, so that you can differentiate between the two:

sed '/^Name=/s/Plasma/Plasma on Xorg/' -i /usr/share/xsessions/plasma.desktop

Contents

Installed Programs: There are too many plasma programs (50 in /opt/kf5/bin) to list separately here.
Installed Libraries: There are too many plasma libraries (39 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.

Last updated on 2015-09-24 16:44:04 -0500