Getting Started/Build/Distributions/Debian/Source: Difference between revisions

From KDE TechBase
Line 7: Line 7:
== Getting started ==
== Getting started ==


First you need to add the source repositories to your installation. This is normally done by editing "/etc/apt/sources.list" and adding a line starting with "deb-src". The easy way is to copy your existing "deb" line onto a new line, and change "deb" to "deb-src". In most of the cases this will work. Then you must let this change know to the package manager, so do as root "aptitude update".
First you need to add the source repositories to your installation. This is normally done by editing {{Path | /etc/apt/sources.list}} as user root and adding a line starting with <tt>deb-src</tt>:
<code bash>
kdesudo kwrite /etc/apt/sources.list
</code>
 
The easy way is to copy your existing <tt>deb</tt> line onto a new line, and change <tt>deb</tt> to <tt>deb-src</tt>:
 
<code bash n>
deb http://ftp.belnet.be/debian testing main contrib non-free
deb-src http://ftp.belnet.be/debian testing main contrib non-free #almost a copy of line 1
</code>
In most(all?) of the cases this will work.  
 
Then you must let this change know to the package manager, so do as root:
 
<code bash>aptitude update</code>


== Setting up the dependencies ==
== Setting up the dependencies ==

Revision as of 18:26, 17 August 2010

Introduction

This tutorial is intented for people who are using Debian, and want to check out or test some idea on KDE code without much setting up to do.

This tutorial shows a way of easily downloading and compiling and running the necessary software.

Getting started

First you need to add the source repositories to your installation. This is normally done by editing /etc/apt/sources.list as user root and adding a line starting with deb-src: kdesudo kwrite /etc/apt/sources.list

The easy way is to copy your existing deb line onto a new line, and change deb to deb-src:

deb http://ftp.belnet.be/debian testing main contrib non-free deb-src http://ftp.belnet.be/debian testing main contrib non-free #almost a copy of line 1

In most(all?) of the cases this will work.

Then you must let this change know to the package manager, so do as root:

aptitude update

Setting up the dependencies

Now you want to be able to build a certain package, and in this example we will build kcontrol and systemsettings so we can fix some bug in the "Display" configuration module, which is called "randr". In debian the package is "systemsettings", so we get the build dependencies of that package, so do as root "aptitude build-dep systemsettings". This will download and install all needed dependencies which are mostly packages with "-dev" at the end of them, which are a bunch of header files most of the time.

Getting the source

Now in your home directory, make a new directory, and go into it:

karel@pc:/home/karel # mkdir kde4devel karel@pc:/home/karel # cd kde4devel

Now we get the sources in this directory, as root, do:

karel@pc:/home/karel/kde4devel # su root@pc:/home/karel/kde4devel # apt-get source systemsettings

This downloads the source and applies all the debian patches. In this case, it downloads "kdebase-workspace" because the systemsettings code is only a small part of the kdebase-workspace package. Now go into the newly extracted directory . This is now "kdebase-workspace-4.3.2" in my case.

Building the source

Now we go into the source directory, and let "cmake" generate the Makefiles, which are then used by the "make" command to build the code. But first we change the owner from root back to our user "karel". This is done like this:

root@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2 # chown -R karel.karel ../* root@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2 # exit karel@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2 # cmake . karel@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2 # cmake-gui .

Now select only the components starting with "BUILD_" you want. In my case it was rather the components I'm sure of that I don't want :). So I ended up with only BUILD_kcontrol and systemsettings. Then click on the "Configure" button and then on the "Generate" button. Close the program now. Now we have makefiles for everything we want to build. So now do the make command to build what we have selected:

karel@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2 # make

Now it is built!

Running the program

To run our module, we go to the directory of the randr module. There we tell it to do a "make install" as root. This will install the needed files to /usr/local.

root@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2/kcontrol/randr# make install

We need to tell our current session the additional KDE path where it needs to look for services and libraries and programs. This is done by filling in the KDEDIRS environment variable like this:

karel@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2/kcontrol/randr # export KDEDIRS=/usr/local

Then we start the randr module like this:

karel@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2/kcontrol/randr # ./krandrtray

This starts the tray icon which find the kcm module "randr" first in the KDEDIRS location, so this one is loaded. If you start the systemsettings program, it also loads in the same way the kcm config module in /usr/local. So this depends on the KDEDIRS variable, without it, the randr module found in the default debian location is used!

Testing

So now you can change something in the code, run "make" and then "make install" as root(or "sudo make install") in the correct directory, and you can test the program out.