First off you'll need some stuff installed. I can't tell you exactly what 'cos I don't know. I don't know for 2 reasons. 1] I've forgotten what I had to install in the time between having first done the build to writing this. 2] I don't know what distro you are using. I know that on [K]Ubuntu you need the make, g++ and bzip2 packages. Apart from that you'll have to try and work it out based on any error messages you get I'm afraid.

Point your browser at
ftp://ftp.kde.org/pub/kde/unstable/snapshots/
Download the file kdebase.tar.bz2
That file is the latest daily snapshot of the source for kdebase of which kdesktop, the bit we're interested in, it a part. When I did my build it was version 552243. At time of writing it's 554749 so that's the version number that appears below.

Unzip the file -

$ bunzip2 kdebase.tar.bz2

This gives you a file called kdebase.tar. Unpack that -

$ tar xf kdebase.tar

That gives you a directory called kdebase-552243.

Change in to that dir and run configure -

$ cd kdebase-552243
$ ./configure


You may get errors about missing stuff here. If you can't work out what package install to get rid of an error copy and paste the error to me and it may jog my memory.

Compiling KDE takes a good while. So I tried compiling just the kdesktop stuff. I did this by going in to the kdesktop directory, typing make, waiting until the process bombed complaining it couldn't find something, building that something, then trying again, repeat. To save you that hassle I did it again and wrote down the order to compile stuff.

$ cd libkonq
$ make
$ cd ..

$ cd kcontrol
$ make


This will bomb out at some point with an error like this -

lookandfeeltab_impl.cpp: In member fu.libs/libkdeinit_kdesktop.sonction 'void
LookAndFeelTab::previewBackground(const QString&, bool)':
lookandfeeltab_impl.cpp:133: error: 'KickerSettings' has not been declared
lookandfeeltab_impl.cpp:133: error: 'backgroundTheme' was not declared in this scope
lookandfeeltab_impl.cpp:134: error: 'KickerSettings' has not been declared
lookandfeeltab_impl.cpp:134: error: 'setBackgroundTheme' was not declared in this scope
make[1]: *** [lookandfeeltab_impl.lo] Error 1
make[1]: Leaving directory `/home/mike/kdebase-554749/kcontrol/kicker'
make: *** [all-recursive] Error 1


ignore it.

$ cd ..
$ cd kdmlib
$ make
$ cd kdesktop
$ make


That should be it. You should now have the required file at .libs/libkdeinit_kdesktop.so (note the leading . )