Difference between revisions of "Getting Started/Build/Distributions/Debian/Source"

Jump to: navigation, search
(Building the source)
Line 71: Line 71:
  
 
Now it is building!
 
Now it is building!
 +
 +
== Changing the source ==
 +
 +
We will now go to the directory of the randr module we want to develop on:
 +
 +
<code bash>
 +
cd kcontrol/randr
 +
</code>
 +
 +
Edit some file, and then rebuild simply by running <tt>make</tt> again in this directory:
 +
 +
<code bash>
 +
make
 +
</code>
 +
 +
The module is now being rebuilt.
 +
Likewise we can change something in a source file the <tt>systemsettings</tt> source directory, and rebuild it using <tt>make</tt>
 +
 +
<code bash>
 +
cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings
 +
make
 +
</code>
 +
 +
To have a full rebuild of the code, first do <tt>make clean</tt> before the <tt>make</tt> command.
  
 
== Running the program ==
 
== 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.
+
This may be somewhat difficult, but we start easy ;)
 +
 +
You go into the {{Path|systemsettings/app}} directory, and there start that self-compiled code like this:
 +
<code bash>
 +
cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings/app
 +
./systemsettings
 +
</code>
 +
 
 +
This will indeed run your new code. But it is better to first install it into your {{path|/usr/local}} directory so everything is setup correctly, because the systemsettings program might need to find or access other files to function properly. You do this with this simple command, executed in the main directory of the app or module you just built:
 +
 
 +
<code bash>
 +
cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings
 +
make install
 +
</code>
 +
 
 +
However! The app asks the system certain services, and therefore it is looking into the {{path|/usr}} directory.
 +
To run our module, we need to install it. This is done by doing as root:
 +
 
 +
<code bash>
 +
make install
 +
</code>
  
 +
This will install the files used by the randr module to /usr/local.
 +
We only have
 
root@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2/kcontrol/randr# make install
 
root@pc:/home/karel/kde4devel/kdebase-workspace-4.3.2/kcontrol/randr# make install
  

Revision as of 20:32, 17 August 2010

Contents

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 the kcontrol configuration modules(aka KCM modules) and the application containing them called systemsettings. Let's say we want to see if we can maybe fix some bug in the Display configuration module, which is called randr actually. In debian the package is systemsettings, so first we will 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 some build tools and otherwise mostly packages with -dev at the end of them, which are in most cases a bunch of header files.

Getting the source

Now in your home directory, as a regular user, make a new directory, and go into it: mkdir kde4devel cd kde4devel

Now change to user root using su. Now we will get the sources in this directory. Here are the commands su #give root password apt-get source systemsettings #downloads the source chown karel.karel -R * #subsitute "karel" with your own username! exit #exit the "su" and return to your user

This downloads the source and applies all the debian patches for you. 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 kdebase-workspace-4.3.2 in my case.

cd kdebase-workspace-4.3.2

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. This is done like this:

cmake . # don't forget the extra space+point! cmake-gui . # don't forget the extra space+point!

Now select only the components starting with BUILD_ you want. In my case it was rather the components I'm sure of that I didn't want :). So I ended up with only BUILD_kcontrol and systemsettings and didn't touch any of the other settings below(because I was very afraid of them weird looking ones!). Then click on the Configure button and then on the Generate button. Close the program now. Now we have makefiles that will only build what we chose to build in the cmake-gui program. So now you can execute the make command to start:

make

Now it is building!

Changing the source

We will now go to the directory of the randr module we want to develop on:

cd kcontrol/randr

Edit some file, and then rebuild simply by running make again in this directory:

make

The module is now being rebuilt. Likewise we can change something in a source file the systemsettings source directory, and rebuild it using make

cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings make

To have a full rebuild of the code, first do make clean before the make command.

Running the program

This may be somewhat difficult, but we start easy ;)

You go into the systemsettings/app directory, and there start that self-compiled code like this: cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings/app ./systemsettings

This will indeed run your new code. But it is better to first install it into your /usr/local directory so everything is setup correctly, because the systemsettings program might need to find or access other files to function properly. You do this with this simple command, executed in the main directory of the app or module you just built:

cd /home/karel/kde4devel/kdebase-workspace-4.3.2/systemsettings make install

However! The app asks the system certain services, and therefore it is looking into the /usr directory. To run our module, we need to install it. This is done by doing as root:

make install

This will install the files used by the randr module to /usr/local. We only have 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.


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal