compiling Syndicate content

warning: Creating default object from empty value in /www/htdocs/w0065fc9/milianw/modules/taxonomy/taxonomy.pages.inc on line 33.

» Building KDevplatform, KDevelop and the PHP plugin from Git

Fri, 03/06/2009 - 01:21

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.

  1. # I hope these are all, it's been a time since I did that the last time
  2. # please report if anything is missing
  3. aptitude install kdelibs5-dev kdebase-workspace-dev \
  4. libqt4-dev build-essential subversion kdesdk-scripts \
  5. 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:

  1. 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 kde4_setup_build_environment.sh and bash_setup_kde4_programming.

set the environment variables

Move the file kde4_setup_build_environment.sh to ~/.kde/env and make it executable. You might want to adapt the paths for the variables KDE_BUILD, KDE_SRC and 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:

  1. . ~/.bash_setup_kde4_programming

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 ~/.gitconfig file:

  1. [url "git://anongit.kde.org/"]
  2. insteadOf = kde:
  3. [url "git@git.kde.org:"]
  4. pushInsteadOf = kde:

Now checkout the sources:

  1. cs # cs is not a typo! see above
  2. git clone kde:kdevplatform
  3. git clone kde:kdevelop
  4. # if you only want KDevelop, you can stop here. The rest is for PHP
  5. git clone kde:kdevelop-pg-qt
  6. git clone kde:kdev-php
  7. 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.

Note: cmakekde is supposed to be run from inside your source folder (e.g. cs $FOLDER; cmakekde).

  1. for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do
  2. cs $p
  3. cmakekde
  4. done;
  5. 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:

  1. for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do
  2. cs $p
  3. git pull --rebase && make install
  4. done
The End

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 kdevelop-pg-qt, introduced 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