KDE Frameworks 5 Pre-installation Configuration

KF5 can be installed in /usr or /opt/kf5. The BLFS editors recommend the latter in the BLFS environment.

Installing in /usr

One option is to install KDE Frameworks 5 into the /usr hierarchy. This creates a simpler setup but makes it more difficult to try multiple versions of KDE Frameworks.

export KF5_PREFIX=/usr

It is a good idea to add the following variables to your system or personal profiles:

cat >> /etc/profile.d/qt5.sh << "EOF"
# Begin kf5 extension for /etc/profile.d/qt5.sh

pathappend /usr/lib/qt5/plugins    QT_PLUGIN_PATH
pathappend $QT5DIR/lib/plugins     QT_PLUGIN_PATH

pathappend /usr/lib/qt5/qml        QML2_IMPORT_PATH
pathappend $QT5DIR/lib/qml         QML2_IMPORT_PATH

# End extension for /etc/profile.d/qt5.sh
EOF

cat > /etc/profile.d/kf5.sh << "EOF"
# Begin /etc/profile.d/kf5.sh

export KF5_PREFIX=/usr

# End /etc/profile.d/kf5.sh
EOF
[Note]

Note

If qt5 was installed in /usr, the $QT5DIR/lib/ portions of the above paths may need to be changed to $QT5DIR/lib/qt5/.

[Warning]

Warning

If KDE4 is installed in /usr, some packages from this chapter might overwrite some programs installed by KDE4 packages.

Installing in /opt

A method of building multiple versions installs KDE Frameworks 5 in the /opt hierarchy:

export KF5_PREFIX=/opt/kf5

If you are not installing KDE Frameworks 5 in /usr, you will need to make some additional configuration changes. Best practice is to add those to your system or personal profile:

cat > /etc/profile.d/kf5.sh << "EOF"
# Begin /etc/profile.d/kf5.sh

export KF5_PREFIX=/opt/kf5

pathappend $KF5_PREFIX/bin             PATH
pathappend $KF5_PREFIX/lib/pkgconfig   PKG_CONFIG_PATH

pathappend /etc/xdg                    XDG_CONFIG_DIRS
pathappend $KF5_PREFIX/etc/xdg         XDG_CONFIG_DIRS
pathappend /usr/share                  XDG_DATA_DIRS
pathappend $KF5_PREFIX/share           XDG_DATA_DIRS

pathappend $KF5_PREFIX/lib/plugins     QT_PLUGIN_PATH

pathappend $KF5_PREFIX/lib/qml         QML2_IMPORT_PATH

pathappend $KF5_PREFIX/lib/python2.7/site-packages PYTHONPATH

pathappend $KF5_PREFIX/share/man       MANPATH
# End /etc/profile.d/kf5.sh
EOF

cat >> /etc/profile.d/qt5.sh << "EOF"
# Begin Qt5 changes for KF5

pathappend $QT5DIR/plugins             QT_PLUGIN_PATH
pathappend $QT5DIR/qml                 QML2_IMPORT_PATH

# End Qt5 changes for KF5
EOF

Expand your /etc/ld.so.conf file:

cat >> /etc/ld.so.conf << "EOF"
# Begin KF5 addition

/opt/kf5/lib

# End KF5 addition
EOF

Several KDE Frameworks 5 packages install files into D-Bus directories. When installing KDE Frameworks 5 in a location other than /usr, D-Bus needs to be able to find these files. The easiest way to achieve this is to create the following symlinks (as the root user):

install -v -dm755           $KF5_PREFIX/{etc,share} &&
ln -sfv /etc/dbus-1         $KF5_PREFIX/etc         &&
ln -sfv /usr/share/dbus-1   $KF5_PREFIX/share

Some packages may also install icons from the "hicolor" icon set. Since that icon set is used by many packages, it is a good idea to create a symlink to the one in /usr/share to avoid having multiple installations of hicolor-icon-theme-0.15. Run the following commands as the root user:

install -v -dm755                $KF5_PREFIX/share/icons &&
ln -sfv /usr/share/icons/hicolor $KF5_PREFIX/share/icons
[Tip]

Tip

Sometimes, the installation paths are hardcoded into installed files. This is the reason why /opt/kf5 is used as installation prefix instead of /opt/kf5-5.37.0. After installing KDE Frameworks, you may rename the directory and create a symlink:

mv /opt/kf5{,-5.37.0}
ln -sfv kf5-5.37.0 /opt/kf5

Later on, you may want to install other versions of KDE Frameworks 5. To do that, just remove the symlink and use /opt/kf5 as the prefix again. Which version of KDE Frameworks 5 you use depends only on where the symlink points. No other reconfiguration will be needed.

Last updated on 2017-08-26 15:17:25 -0700