Guidelines and HOWTOs/Build from source/Test plasma

From KDE Community Wiki
Revision as of 07:37, 13 April 2019 by Meven (talk | contribs) (add a command line block)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Prepare the testing environment

Save the following script as /opt/kde/runPlasma5.sh

#!/bin/bash
 
if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

DISTRO=`source /etc/os-release 2>/dev/null; echo $ID_LIKE`
 
export KF5=/opt/kde/install
export QTDIR=/opt/qt5      # Change if you have your own qt build
 
export PATH=$KF5/bin:$QTDIR/bin:$PATH
 
export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
#On some distros, this is $KF5/lib64/qml:$QTDIR/qml or something similar. After the installation, choose the directory/directories which contains the "qt/qml" folder.
export QML2_IMPORT_PATH=$KF5/lib/qml:$QTDIR/qml

#Fixes for Debian's "look at me, I'm so important" setups
if [ $DISTRO == "debian" ] 
then
    export QT_PLUGIN_PATH=$KF5/lib/`uname -m`-linux-gnu/plugins:$QTDIR/plugins
    export QML2_IMPORT_PATH=$KF5/lib/`uname -m`-linux-gnu/qml:$QTDIR/qml
fi

export QML_IMPORT_PATH=$QML2_IMPORT_PATH
 
export XDG_DATA_DIRS=$KF5/share:/usr/share
export XDG_CONFIG_DIRS=$KF5/etc/xdg:/etc/xdg
  
# Uncomment to change default home paths
#export XDG_DATA_HOME=$HOME/.kde5/local
#export XDG_CONFIG_HOME=$HOME/.kde5/config
#export XDG_CACHE_HOME=$HOME/.kde5/cache
 
exec startkde

For what works on Debian Sid alongside with packaged KF5 nicely see: Using (parts of) self-built KF 5, Plasma 5 and/or KDE Applications on Debian

Configure dbus

Because we installed Plasma 5 to a custom path, we need to make dbus aware of these new locations.

Create a file /etc/dbus-1/session-local.conf with the following contents:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<servicedir>/opt/kde/install/share/dbus-1/services</servicedir>
</busconfig>

Create another file /etc/dbus-1/system-local.conf with the following contents:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<servicedir>/opt/kde/install/share/dbus-1/system-services</servicedir>
<includedir>/opt/kde/install/etc/dbus-1/system.d</includedir>
</busconfig>

Because dbus will load all these new paths each time you login, you should rename these files (to eg system-local.conf.bk and session-local.conf.bk) before starting your default Plasma 4 or other distro sessions.

Running Plasma

Finally, there are several ways of running Plasma 5. Choose the one which suits you best.

Using a login manager

The recommended login manager is SDDM. But this method should work with any login manager.

sudo cp /opt/kde/runPlasma5.sh /usr/share/xsessions
sudo chmod +x /usr/share/xsessions/runPlasma5.sh
sudo cp /opt/kde/install/share/xsessions/plasma.desktop  /usr/share/xsessions/plasmaGit.desktop

Edit /usr/share/xsessions/plasmaGit.desktop and change the paths as:

Exec=/usr/share/xsessions/runPlasma5.sh
TryExec=/usr/share/xsessions/runPlasma5.sh
Name=Plasma Git

After this logout of your current session, select Plasma Git in the options and login. You should now have the last Plasma 5 running.

Using ~/.config/plasma-workspace/env

This is what I found works on Debian Sid nicely. Put the script which sets up the environment into ~/.config/plasma-workspace/env, chmod +x it and be done. Aside from the "Using a login manager" approach probably – I didn´t test it –, this is the only thing that worked on Debian. Additionally to that it does not need any changes to system wide configuration files. This directory replaced ~/.kde/env from KDE SC 4 and older times.

Specifically none of the put it into some user wide or system wide shell profile files worked. Also putting it at start of /usr/bin/startkde worked, as environment still got reset to the default.

From the command line

- Edit your xinitrc file :

mv ~/.xinitrc ~/.xinitrc.bk                # Backup any existing xinitrc file
ln -s /opt/kde/runPlasma5.sh ~/.xinitrc

Log out of your current session, login to a tty (eg tty2 by pressing Ctrl+Alt+F2) and run startx. This should read your ~/.xinitrc and log you into a Plasma 5 desktop.

- Instead of editing your xinitrc, you can simply override it by running startx /opt/kde/runPlasma5.sh.

KAuth/Polkit applications

Due to system security DBus activation on the system bus which can switch users as well as all polkit policy files are only read from /etc/

If you have a working system, generally this step is optional and only needed when working on those components

If installing to a non-default prefix you will need to:

sudo ln -s /opt/kde5/etc/dbus-1/system.d/*  /etc/dbus-1/system.d/.
sudo ln -s /opt/kde5/etc/polkit-1/rules.d*  /etc/polkit-1/rules.d.