This HOWTO describes step by step what to do to have a basic KDE4 environment.
In the end, there will be a KDE4 installation which runs parallel to KDE3 as the same user.
Contents |
Make sure the following packages are NOT installed in your distribution:
Required software
Lots of free disk space
Create a basic directory structure:
mkdir -p ~/kde/src
As a preview, this is how the directory structure looks like later
~/kde base directory for scripts, source and build ~/kde/src base directory for all svn checkouts ~/kde/src/qt-copy source of qt-copy ~/kde/src/kdesupport source of kdesupport ~/kde/src/kdelibs source of kdelibs ~/kde/src/<kde-module> source of <kde-module> .... ~/kde/build build directory ~/kde/build/kdesupport build files for kdesupport ... ~/kde/kde4 install path of KDE4 ~/kde/kde4/bin ... ~/.kde4 local kde configuration directory
In order to make life easy, save the following files. Make them executable by calling afterwards
chmod 755 ~/kde/*.sh
Script to build qt-copy
#!/bin/bash # compile qt-copy export QTDIR=$HOME/kde/src/qt-copy export PATH=$QTDIR/bin:$PATH cd $QTDIR ./configure -qt-gif -no-exceptions -debug -fast -prefix $QTDIR -qdbus -pch -nomake examples -nomake demos #./configure -qt-gif -no-exceptions -release -fast -prefix $QTDIR -qdbus -pch -nomake examples -nomake demos make # Note: no make install !!
Build KDE-module
#!/bin/bash
if [ -z "$*" ]
then
echo "usage: ./build-module.sh module [module, ...]"
exit 1
fi
# set ENV variables
export BUILDDIR=$HOME/kde/build
export SRCDIR=$HOME/kde/src
export QTDIR=$SRCDIR/qt-copy
export KDEDIRS=$HOME/kde/kde4
export KDEDIR=$KDEDIRS
export PATH=$QTDIR/bin:$KDEDIR/bin:$PATH
export CMAKE_INCLUDE_PATH=$QTDIR/include:$KDEDIR/include
export CMAKE_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib
export LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib
export PKG_CONFIG_PATH=$QTDIR/lib:$KDEDIR/lib/pkgconfig
# language of compiler output: english
export LC_ALL=C
# export QTTELEPATHY_LIBRARIES=$KDEDIR/lib
box() {
echo "#######################################################"
echo "# building module: $1, `date`"
echo "#######################################################"
}
for module in $@
do
[ -d "$SRCDIR/$module" ] || continue
box $module
[ -d "$BUILDDIR/$module" ] || mkdir -p "$BUILDDIR/$module"
cd "$BUILDDIR/$module"
# bootstrap
cmake -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=$KDEDIR "$SRCDIR/$module"
make -j 2 -k
make install
cd -
done
Run KDE4-app in KDE4-environment.
#!/bin/bash export KDEDIR=$HOME/kde/kde4 export KDEDIRS=$KDEDIR export QTDIR=$HOME/kde/src/qt-copy export KDEHOME=$HOME/.kde4 export KDETMP=/tmp/kde4-$USER export KDEVARTMP=/var/tmp/kde4-$USER export KDESYCOCA=$KDEVARTMP/ksycoca export QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins:$QT_PLUGIN_PATH export PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH export LD_LIBRARY_PATH=$KDEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH export PATH=$KDEDIR/bin:$QTDIR/bin:/usr/bin:/bin unset XDG_DATA_DIRS # unset XDG_DATA_DIRS, to avoid seeing kde3 files from /usr unset XDG_CONFIG_DIRS [ -d "$KDETMP/kde-$USER" ] || mkdir -p $KDETMP/kde-$USER [ -d "$KDEVARTMP" ] || mkdir $KDEVARTMP # start app $@
List all running KDE4 processes.
#!/bin/sh
ls /proc/*/exe 2>/dev/null | while read f; do
link=`readlink $f`
if echo "$link" | grep -q kde4; then
pid=`echo $f | sed -e 's/[^0-9]//g'`
echo "$link, pid $pid"
fi
if echo "$link" | grep -q valgrind; then
echo "$link - WARNING, valgrind running"
fi
done
Kill all running KDE4 processes.
#!/bin/sh
ls /proc/*/exe 2>/dev/null | while read f; do
link=`readlink $f`
if echo "$link" | grep -q kde4; then
pid=`echo $f | sed -e 's/[^0-9]//g'`
echo "Killing $link, pid $pid"
kill $pid
fi
done
If you add the following functions to the ~/.bashrc file, you can later switch with a simple cs and cb between source and build directory.
Example:
cd ~/kde/src/kdelibs/kate cb # now we are in ~/kde/build/kdelibs/kate make install cs # now we are back in ~/kde/src/kdelibs/kate
Code for ~/.bashrc:
# substitue src dir with build dir
function cb {
dest=`pwd | sed -e s,$HOME/kde/src,$HOME/kde/build,`
cd $dest
}
# substitue build dir with src dir
function cs {
dest=`pwd | sed -e s,$HOME/kde/build,$HOME/kde/src,`
cd $dest
}
Checkout the sources from KDE's subversion repository:
cd ~/kde/src svn checkout svn://anonsvn.kde.org/home/kde/trunk/qt-copy svn checkout svn://anonsvn.kde.org/home/kde/trunk/kdesupport svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
To update a module, simply change into the module-directory and execute svn update:
cd ~/kde/src/kdelibs svn update
Compile qt-copy and all the KDE-modules kdesupport, kdelibs, kdepimlibs and kdebase. If compilation fails, look at the error and fix it. Then restart with the module that had the error.
This takes roughly 3-4 hours.
cd ~/kde # build Qt4 snapshot ./build-qt-copy.sh # wait until finished successfully # build kde-module: ./build-module.sh module [module ...] ./build-module.sh kdesupport kdelibs kdepimlibs kdebase # wait until finished successfully
If kdebase was compiled and installed successfully, you can start a kde4 app as follows:
cd ~/kde ./run-kde4-app.sh dolphin
Running a full KDE4-desktop:
# start X server in failsafe mode. cd ~/kde ./run-kde4-app.sh startkde
Now the splashscreen should appear, along with the desktop (plasma) and the windowmanager (kwin).
KDE4 is compiled and installed. Now you can modify the sources, then change into the build directory and compile and install again. Example:
cd ~/kde/src/kdelibs/kate # assume we have changed code in kdelibs/kate cb # change to build directory make install # recompile and install cs
Now you can test your changes with the run-kde4-app.sh script.
Tested with