Building KDevplatform, KDevelop and the PHP plugin from Git
In a follow up to my last post about the PHP plugin for KDevelop and Quanta I want to detail how I setup my build environment. Since I’m only working on KDevelop I only want to compile that. For all other applications, I use the packages my distribution makes available. Below you this is possible.
Note: I use Kubuntu and hence some commands like
aptitude and the package names etc. will have to be adapted to your specific distribution. But the general idea should be the same and the packages should be called at least somewhat similar. You could always take a look at the techbase article on compilation of KDE 4 to get a more general HowTo.
It is generally a very good idea to read some articles on the techbase. Especially in the Getting Started section.
getting the dependencies
First, you’ll need to install some packages to satisfy dependencies and to get a working compile chain (think cmake, gcc and stuff). The following command only lists very few packages but they have a huge list of dependencies which your package manager will take into account automatically. Don’t be suprised by a possibly huge list of packages ;-) So some disk space will be required (though I doubt it’s more than 250MB in total).
Note: You’ll need the KDE 4.2.x versions of the KDE libraries and development packages. When you use Kubuntu, you can follow this article to get up to date packages for the 8.10 release.
# I hope these are all, it's been a time since I did that the last time # please report if anything is missing aptitude install kdelibs5-dev kdebase-workspace-dev \ libqt4-dev build-essential subversion kdesdk-scripts \ bison flex
removing old cruft
To prevent binary compatibility issues that will result in crashes, you have to remove all KDevelop & KDevplatform packages provided by your package maintainer. In karmic it should be enough to remove kdevplatform, and it will remove all dependent packages:
aptitude purge kdevplatform libsublime
setting up your environment
Inspired by the techbase article on improved productivity in KDE4, particularly the bashrc listed there, I’ve come up with the following way to configure my system:
First visit my shell helper git repo on GitHub and download the two files
set the environment variables
Move the file
~/.kde/env and make it executable. You might want to adapt the paths for the variables
KDEDIR inside that file to your likings.
This part is required to make sure that compiled programs will act just like normal programs installed globally (e.g. with your package manager) right from the start of your KDE session. I.e. KRunner works fine and custom plugins are found etc.
make your life easier with some bash magic
Now alter your
~/.bashrc and to the bottom of that file add the following line:
NOTE: This assumes that you saved the afore mentioned
bash_setup_kde4_programming file to
~/.bash_setup_kde4_programming. You might have to change the path.
NOTE: That file also sources the above script to set the environment variables. I’m not sure it’s required, but it doesn’t hurt. So make sure the path is correct there.
Now to the fun part
Once all that’s done, you have to log out of your bash session to get the environments. Maybe even logout of your KDE session to make it aware of the new paths as well.
checking out KDevplatform, KDevelop and the PHP plugin
Get the latest and greatest directly from Git Master (see also git.kde.org Manual on techbase). But first make sure you setup the Git URL prefixes, by putting the following into your
[url "git://anongit.kde.org/"] insteadOf = kde: [url "email@example.com:"] pushInsteadOf = kde:
Now checkout the sources:
cs # cs is not a typo! see above git clone kde:kdevplatform git clone kde:kdevelop # if you only want KDevelop, you can stop here. The rest is for PHP git clone kde:kdevelop-pg-qt git clone kde:kdev-php git clone kde:kdev-php-docs
compiling and installing
Now it’s time to compile all that code you just checked out. Hopefully you got all required dependencies. If you need all bells and whistles, you’ll have to install some more packages I’m sure. If you run the code below, take a good look at the output of the
cmakekde command (especially at the beginning). It lists not-found dependencies.
cmakekde is supposed to be run from inside your source folder (e.g.
cs $FOLDER; cmakekde).
for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do cs $p cmakekde done; kbuildsycoca4 # make sure new plugins etc. are found
Pretty easy, hum? Let’s hope everything worked fine :)
staying up to date
That above command is only required once. Everytime after that, you can simply do the following which will make sure you are running the latest and greatest:
for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do cs $p git pull --rebase && make install done
Hope I have not forgotten anything and that this (rather lengthy…) HowTo is of some help to a few of you out there. Looking forward to feature requests, bug reports etc.
UPDATE 30/03/11: updated to git.kde.org location
UPDATE 18/05/10: updated to include
for loops in setup snippets
UPDATE 07/05/10: updated to git locations
UPDATE 08/01/10: updated to extragear location of php & php-docs
UPDATE 01/12/09: added php-docs, updated to extragear location of kdevplatform & kdevelop.
UPDATE 17/12/09: updated to kdereview location of php & php-docs