Jump to content

Guidelines and HOWTOs/Build from source/Test plasma: Difference between revisions

From KDE Community Wiki
Meven (talk | contribs)
add a command line block
Ngraham (talk | contribs)
Rewrite to reflect new code improvement: https://cgit.kde.org/plasma-workspace.git/commit/?id=9d9c1fc3b3783de73812e23ae5822e8f43852b93
Line 1: Line 1:
= Prepare the testing environment =
= Get it into SDDM =
Save the following script as /opt/kde/runPlasma5.sh
You will need your newly built-from-source version of Plasma appear to in the SDDM login screen's Sessions menu, allowing you to log into it. To do this, run the following command:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#!/bin/bash
sudo ~/kde/build/plasma-workspace/login-sessions/install-sessions.sh
</syntaxhighlight>
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`
After that, you can log out and select your new plasma session in SDDM's session chooser menu (which is located in the bottom-left corner of the screen if you're using the Breeze SDDM theme)
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
= Quirks =
if [ $DISTRO == "debian" ]
== KAuth & Polkit applications ==
then
{{Note|This step is optional, but you will need to do it if you want to develop or use apps that display password dialogs.}}
    export QT_PLUGIN_PATH=$KF5/lib/`uname -m`-linux-gnu/plugins:$QTDIR/plugins
Because we installed Plasma to a custom path, KAuth and Polkit need to be made aware of your new Plasma installation. Run the following commands:
    export QML2_IMPORT_PATH=$KF5/lib/`uname -m`-linux-gnu/qml:$QTDIR/qml
<syntaxhighlight lang="bash">
fi
sudo ln -s /home/$USER/kde/usr/etc/dbus-1/system.d//etc/dbus-1/system.d/.
 
sudo ln -s /home/$USER/kde/usr/etc/polkit-1/rules.d*  /etc/polkit-1/rules.d/.
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
</syntaxhighlight>
</syntaxhighlight>


For what works on Debian Sid alongside with packaged KF5 nicely see:
== DBus ==
[https://wiki.debian.org/KdeBuildingFromSource Using (parts of) self-built KF 5, Plasma 5 and/or KDE Applications on Debian]
{{Note|This step is optional, but your Plasma session may experience quirky behavior without it.}}
 
Just like KAuth and PolKit, DBus is not aware of your new Plasma installation and needs to be informed. Unfortunately, unlike Kauth and PolKit, DBus can only be given one path at a time, so you will need to change the path that DBus looks at whenever you use your new Plasma session. Create a file <tt>/etc/dbus-1/session-local.conf.bak</tt> with the following contents:
= 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:
<pre>
<pre>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<busconfig>
<servicedir>/opt/kde/install/share/dbus-1/services</servicedir>
<servicedir>/home/$USER/kde/usr/share/dbus-1/services</servicedir>
</busconfig>
</busconfig>
</pre>
</pre>


Create another file /etc/dbus-1/system-local.conf with the following contents:
Create another file <tt>/etc/dbus-1/system-local.conf.bak</tt> with the following contents:
<pre>
<pre>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<busconfig>
<servicedir>/opt/kde/install/share/dbus-1/system-services</servicedir>
<servicedir>/home/$USER/kde/usr/share/dbus-1/system-services</servicedir>
<includedir>/opt/kde/install/etc/dbus-1/system.d</includedir>
<includedir>/home/$USER/kde/usr/etc/dbus-1/system.d</includedir>
</busconfig>
</busconfig>
</pre>
</pre>


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.
Before logging into your new compiled-from-source Plasma session, rename the files like so:
 
= 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.
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo cp /opt/kde/runPlasma5.sh /usr/share/xsessions
sudo mv /etc/dbus-1/session-local.conf.bak /etc/dbus-1/session-local.conf
sudo chmod +x /usr/share/xsessions/runPlasma5.sh
sudo mv /etc/dbus-1/system-local.conf.bak /etc/dbus-1/system-local.conf
sudo cp /opt/kde/install/share/xsessions/plasma.desktop  /usr/share/xsessions/plasmaGit.desktop
</syntaxhighlight>
</syntaxhighlight>
Edit /usr/share/xsessions/plasmaGit.desktop and change the paths as:
<pre>
Exec=/usr/share/xsessions/runPlasma5.sh
TryExec=/usr/share/xsessions/runPlasma5.sh
Name=Plasma Git
</pre>
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 :
<syntaxhighlight lang="bash">
mv ~/.xinitrc ~/.xinitrc.bk                # Backup any existing xinitrc file
ln -s /opt/kde/runPlasma5.sh ~/.xinitrc
</syntaxhighlight>
Log out of your current session, login to a tty (eg tty2 by pressing <code>Ctrl+Alt+F2</code>) and run <code>startx</code>. 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 <code>startx /opt/kde/runPlasma5.sh</code>.
== 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:
Then before you log out and return to your normal distro-provided Plasma session, rename them like so:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo ln -s /opt/kde5/etc/dbus-1/system.d/*  /etc/dbus-1/system.d/.
sudo mv /etc/dbus-1/session-local.conf /etc/dbus-1/session-local.conf.bak
sudo ln -s /opt/kde5/etc/polkit-1/rules.d*  /etc/polkit-1/rules.d.
sudo mv /etc/dbus-1/system-local.conf /etc/dbus-1/system-local.conf.bak
</syntaxhighlight>
</syntaxhighlight>

Revision as of 15:04, 22 June 2019

Get it into SDDM

You will need your newly built-from-source version of Plasma appear to in the SDDM login screen's Sessions menu, allowing you to log into it. To do this, run the following command:

sudo ~/kde/build/plasma-workspace/login-sessions/install-sessions.sh

After that, you can log out and select your new plasma session in SDDM's session chooser menu (which is located in the bottom-left corner of the screen if you're using the Breeze SDDM theme)

Quirks

KAuth & Polkit applications

Note

This step is optional, but you will need to do it if you want to develop or use apps that display password dialogs.

Because we installed Plasma to a custom path, KAuth and Polkit need to be made aware of your new Plasma installation. Run the following commands:

sudo ln -s /home/$USER/kde/usr/etc/dbus-1/system.d/*  /etc/dbus-1/system.d/.
sudo ln -s /home/$USER/kde/usr/etc/polkit-1/rules.d*  /etc/polkit-1/rules.d/.

DBus

Note

This step is optional, but your Plasma session may experience quirky behavior without it.

Just like KAuth and PolKit, DBus is not aware of your new Plasma installation and needs to be informed. Unfortunately, unlike Kauth and PolKit, DBus can only be given one path at a time, so you will need to change the path that DBus looks at whenever you use your new Plasma session. Create a file /etc/dbus-1/session-local.conf.bak 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>/home/$USER/kde/usr/share/dbus-1/services</servicedir>
</busconfig>

Create another file /etc/dbus-1/system-local.conf.bak 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>/home/$USER/kde/usr/share/dbus-1/system-services</servicedir>
<includedir>/home/$USER/kde/usr/etc/dbus-1/system.d</includedir>
</busconfig>

Before logging into your new compiled-from-source Plasma session, rename the files like so:

sudo mv /etc/dbus-1/session-local.conf.bak /etc/dbus-1/session-local.conf
sudo mv /etc/dbus-1/system-local.conf.bak /etc/dbus-1/system-local.conf

Then before you log out and return to your normal distro-provided Plasma session, rename them like so:

sudo mv /etc/dbus-1/session-local.conf /etc/dbus-1/session-local.conf.bak
sudo mv /etc/dbus-1/system-local.conf /etc/dbus-1/system-local.conf.bak