Get Involved/development: Difference between revisions

From KDE Community Wiki
(Advice for getting started)
(53 intermediate revisions by 23 users not shown)
Line 1: Line 1:
__NOTOC__
[[File:Konqui dev close cropped.png|right|x200px|]]
== Becoming a KDE Developer ==
By joining the ranks of KDE developers, you will get to implement new features and defeat bugs both daunting and simple, all while collaborating to make coherent and stable releases. Developers collaborate in teams based on what area they are working in. These can be small teams working on a single application, up to large teams working on a group of related pieces of software. Many developers are in more than one team.


[[Image:development.png|Development|left]]By joining the ranks of KDE developers, you will get to implement new features and defeat daunting bugs, all while collaborating to make coherent and stable releases. Developers collaborate in teams based on what area they are working in, such as [http://edu.kde.org/ Education], [http://pim.kde.org/ Productivity], or [http://games.kde.org/ Games].
KDE runs or participates in several mentoring programs to help new developers, including an informal list of people who are willing to help newcomers get started. See the [[Mentoring]] page for more details.


Frank Osterfeld advises "start small and scratch your own itch, at least that's what kept me motivated in the beginning."


As a result of a [http://dot.kde.org/2012/02/05/kde-development-%E2%80%93-beginners-guide/ Sprint] held in October 2011 we now have a [http://flossmanuals.net/kde-guide/ Beginner's Guide to KDE Development] available to ease the new contributors way into KDE development.
== Choosing what to do ==
A good place to start is with a small bug or feature in an existing piece of software that affects you personally ("scratch your own itch"). Get in touch with the existing developers (see [[#Communicating with the team|Communicating with the team]], below) and they can help you out, by pointing you to the right place in the code and giving advice about how to tackle the problem


== Communicating with the team ==
Try not to start by proposing or working on major features or significant design changes. These can be controversial, and the smoothest way to get going is by working on relatively non-controversial bug-fixes.
 
Other ideas for starting points are:
 
* [https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&keywords=junior-jobs&list_id=1340815 Junior Jobs] are small tasks that are suitable for beginners (both bugs and features)
* [https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&keywords=usability&keywords_type=allwords&list_id=1493316&order=product%2Cchangeddate%20DESC%2Cbug_status%20DESC%2Cresolution%2Cpriority%2Cassigned_to%2Cbug_id&query_format=advanced Bugs related to] KDE's [https://phabricator.kde.org/T6831 Usability & Productivity initiative], many of which are small and easy
* [http://www.englishbreakfastnetwork.org/ The English Breakfast Network] searches out simple, common issues in code that should be fixed, and going through the problems on there can provide a good overview of the code
 
== New to (C++/Qt) software development? ==
Most KDE software is written in C++ using the [https://www.qt.io Qt framework]. There are many guides to C++ online, and which one works for you will depend on how you learn best and what previous programming experience you have.
 
For learning Qt, you can find [https://wiki.qt.io/Books a list of books for learning Qt] on the Qt wiki. Qt also provides [http://doc.qt.io/qt-5/qtexamplesandtutorials.html lots of examples] you can look at.
 
Most KDE software is also built on other KDE software, particularly the KDE Frameworks. The [https://techbase.kde.org TechBase wiki] has documentation about using these libraries, and a [[Books | book]] is available. See also [[Guidelines and HOWTOs/Development]].
 
== Get the code ==
First you will need to use your distro's package manager to install some basic tools:
* Debian/Ubuntu/KDE Neon: <pre>sudo apt install git cmake</pre>
* Fedora: <pre>sudo dnf install git cmake</pre>
* openSUSE: <pre>sudo zypper install git cmake</pre>
* Arch/Antergos/Manjaro: <pre>sudo pacman -S git cmake</pre>
 
Next, create a folder to hold all the source code repositories you're going to be downloading!
<pre>
mkdir ~/repos
cd ~/repos
</pre>
 
Now download the source code for the project you would like to work on. All the KDE git repositories can be found at [https://cgit.kde.org/ here]. If you are not familiar with [https://git-scm.com/ Git], the [https://git-scm.com/book Git Book] is a good introduction, but you will learn what you need here if you're new to <tt>git</tt>.
 
Now find the official project/repository name of the software you want to work on. most are identical to the software's name; e.g. the repository name for Okular is okular. You can find the full list at https://cgit.kde.org/. Then clone the repo:
<pre>
git clone git://anongit.kde.org/<project/repository name>.git
</pre>
 
== Set up your development environment ==
First of all, don't worry about this process destabilizing your machine. Your existing software is installed to <tt>/usr</tt>, and when you produce own patched software, it will be installed to <tt>/opt/kde</tt> leaving the original software untouched.
 
In order to compile a piece of KDE software, you will first need to use your distro's package manager to download the dependencies for the project you would like to patch, so that it will compile.
 
The way to do this varies according to your distro (If you don't see it listed below, it is not a recommended development platform):
=== KDE Neon ===
<pre>
sudo apt build-dep <repo/package name>
</pre>
 
=== Kubuntu ===
First add the [https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/backports Kubuntu Backports PPA], which will upgrade your system to use newer KDE software:
{{Warning|Due to the nature of package dependencies, this will upgrade the entire KDE software stack. Do not proceed unless you are okay with this.}}
<pre>
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt update
sudo apt full-upgrade
</pre>
Then install the dependencies for the software you want to work on:
<pre>
sudo apt build-dep <repo/package name>
</pre>
 
=== Fedora ===
First add the <insert thing here> Copr, which will upgrade your system to use newer KDE software:
{{Warning|Due to the nature of package dependencies, this will upgrade the entire KDE software stack. Do not proceed unless you are okay with this.}}
<pre>
[Insert method of updating KDE packages in Fedora here]
</pre>
Then install the dependencies for the software you want to work on:
<pre>
sudo dnf builddep <repo/package name>
</pre>
 
=== openSUSE Tumbleweed ===
First enable the source repository:
<pre>
sudo zypper mr -e repo-source
</pre>
Then install the dependencies for the software you want to work on:
<pre>
sudo zypper si -d <repo/package name>
</pre>
 
=== Arch/Antergos/Manjaro ===
<pre>
sudo pacman -S git <repo/package name>
</pre>
<br/><br/>
 
== Compile the software ==
 
Before you work on your patch, try to compile the software to make sure that your development environment is set up properly:
 
<pre>
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde/ ..
make
</pre>
(Notice how we are telling CMake to install to <tt>/opt/kde/</tt> instead of <tt>/usr/</tt> (which is the normal location). This is because we don't want to overwrite the software provided by your distro, which could destabilize the system.
 
Did the project compile? Great! Move onto the next section. If you run into problems, see this page for what to do about it.
 
== Make your patch ==
Now you can open your editor and get hacking! As before, make sure it compiles:
<pre>
make
</pre>
 
 
== Test your patch ==
At this point, you have a patch, and the project still compiles. Now it's time to run the project's unit tests:
<pre>
make test
</pre>
 
If any test fails, that needs to be investigated before you can proceed. If the tests pass, then it's time to install your patched software:
<pre>
sudo make install
</pre>


There are many ways to get in touch with KDE developers, and developers for a specific project:<br /> Start at [irc://irc.kde.org/kde-devel <nowiki>#kde-devel</nowiki>] on irc.freenode.net, or [http://kde.org/support/#irc learn more about IRC].<br /> The central mailinglist for development is the [https://mail.kde.org/mailman/listinfo/kde-devel kde-devel mailing list], [http://kde.org/support/#mailinglists learn about mailing lists]. However each team has its own messaging channels, both on IRC and on the mailinglists, you can find a list [http://www.kde.org/mailinglists/ here].
This will install the software to <tt>/opt/kde/</tt>. To actually run it, you will need to set some environment variables to account for the non-standard location. First, create a file with the environment variables ('''this only needs to be done once'''):


== Getting and building the code ==
<pre>
cat > ~/.kderc << "EOF"
export KF5=/opt/kde
export QTDIR=/usr
export CMAKE_PREFIX_PATH=$KF5:$CMAKE_PREFIX_PATH
export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share
export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg
export PATH=$KF5/bin:$QTDIR/bin:$PATH
export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
export QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml
export QML_IMPORT_PATH=$QML2_IMPORT_PATH
export KDE_SESSION_VERSION=5
export KDE_FULL_SESSION=true
export SASL_PATH=/usr/lib/sasl2:$KF5/lib/sasl2
EOF
</pre>


In most cases, you will want to download, compile and install KDE trunk (our development tree) to start developing. Read the [http://techbase.kde.org/Getting_Started/Build/Unstable_Version unstable building guide]. If you get stuck or get errors, that's OK. You might not need to compile the whole set of applications, but getting started is a good step.
Now <tt>source</tt> it to pick up the new environment variables:
<pre>
source ~/.kderc
</pre>


== Platform and Documentation ==
Now you're ready to run your patched program!
<pre>
/opt/kde/bin/<the program>
</pre>


KDE is written in C++ and uses the Qt framework. If you've never used Qt before, that's not a problem. Before you get started, you'll want to brush up on C++/Qt and our coding guidelines:
Does it behave as you expect? Great! If not, go back and work on your patch some more, then re-compile and re-deploy, and test again, until the program does what you'd like it to do.


* [http://www.parashift.com/c++-faq-lite/ C++ FAQ lite] - at some point, you'll have a question that is answered here.
== Submitting your first patch ==
* [http://original.jamesthornton.com/eckel/TICPP-2nd-ed-Vol-one/Frames.html Thinking in C++ (volume 1)], [http://original.jamesthornton.com/eckel/TICPP-2nd-ed-Vol-two/Frames.html Thinking in C++ (volume 2)] - an online book that goes into some of the technical details of C++
Once you're happy with your patch and have verified that it does what you want, you need to send it to other KDE developers for review. KDE uses [https://phabricator.kde.org Phabricator] for this. [[Infrastructure/Phabricator | Learn how to submit a patch with Phabricator]]
* [http://www.beginning-kdevelop-programming.co.uk/ Beginning KDevelop Programming] - a great guide from start to finish
* [http://doc.trolltech.com/4.7/all-examples.html Qt Examples] - If you're doing any serious coding in KDE you will need to understand Qt. These examples explain what's up but it will take a couple hours. You can do that later.
* [http://techbase.kde.org/Development/Tutorials Basic KDE development tutorials]
* [http://techbase.kde.org/Development KDE coding HOWTO's] - good coding documentation for beginners
* [http://techbase.kde.org/Contribute/Send_Patches Patches HOWTO] - until you earn an account in SVN, your contributions will be made as patches
* [http://techbase.kde.org/Schedules The KDE Development Plans] - This is the bigger picture for the development efforts of the KDE project, everyone should understand these before going forward
* [http://en.flossmanuals.net/kde-guide/ The definite KDE dev book] - a comprehensive guide for KDE developers to be.


== Tasks ==


Now you have the code on your computer and maybe got some of it to compile. Here are some tasks for you to get started. You can get your first contribution committed into the project within 1 hour!
== Communicating with the team ==
There are several ways to get in touch with KDE developers, and developers for a specific project. The two most important are:
* the IRC channel [irc://irc.kde.org/kde-devel <nowiki>#kde-devel</nowiki>] on [http://freenode.net/ the freenode network] ([http://kde.org/support/#irc learn more about IRC]) is the core channel for developers
* The primary development mailing list is the [https://mail.kde.org/mailman/listinfo/kde-devel kde-devel list] ([http://kde.org/support/#mailinglists learn more about mailing lists])


* [http://techbase.kde.org/Contribute/Bugsquad/Howto The Bugs Howto] - explains how to use and triage bugs. Why's it useful? It makes bug hunting and fixing easier for developers, so more bugs get fixed. Why choose bug triage instead of ...? It doesn't take much time to look over a bug, so it comes in nice small chunks. What skills do I need to do it? Not much, just a bit of patience and sometimes some perseverance. (quote from [http://accentgrave.blogspot.com/2006/03/ive-got-little-bit-of-free-time-so.html Phil's Triage Guide])
Both of these are general KDE development communication channels, and you may get directed to a more appropriate place for the project you are interested in. There is a [http://www.kde.org/mailinglists/ list of mailing lists] if you want to find a mailing list for a specific team directly. Many teams have their own [[Telegram]] rooms, too.
* [http://www.englishbreakfastnetwork.org/ English Breakfast Network] - provides a list of functions that need to be documented. Try one of these for practice with svn and doxygen.
* [http://wiki.koffice.org/index.php?title=Junior_Jobs KOffice Junior Jobs] - simple programming jobs for KOffice
* [https://bugs.kde.org/buglist.cgi?keywords=junior-jobs&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&cmdtype=doit Junior Jobs on bugzilla] - a place where people mark jobs that might be easy for beginners to fix
* [https://bugs.kde.org/ KDE Bugzilla] - keeps track of all the bugs in KDE, you will want to bash them all


== Mentor program ==
You can also try looking for the team's section on the [[Main Page]] of this wiki. Many teams have information there for new contributors.


Getting started in a big project like KDE can be hard. Below are people with experience in KDE that are happy to help you get involved:


* Trever Fischer (<span class="mailme"> tdfischer at fedoraproject dot org </span>)<br /> Developer on the Phonon project
== Next steps ==
* Eike Hein (<span class="mailme">hein at kde dot org</span>)<br /> application developer; Konversation maintainer
After you have had several patches accepted, a KDE developer is likely to suggest you get a [[Infrastructure/Get a Developer Account|Developer account]], which will allow you to commit directly to KDE projects. With very few limits on where you can commit, you will be expected to act responsibly. At this point, congratulations! You are officially a KDE developer!
* Albert Astals Cid (<span class="mailme">aacid at kde dot org</span>)<br /> available to hand out junior tasks
* Peter Simonsson (<span class="mailme">peter dot simonsson at gmail dot com</span>)<br /> application developer; KOffice devel/Kivio maintainer
* Will Entriken (<span class="mailme">kde dot org at phor dot net</span>)<br /> Google Summer of Code KDE developer
* Anne-Marie Mahfouf (<span class="mailme">annemarie dot mahfouf at free dot fr</span>)<br /> KDE-Edu development, KDE4 development, and tutorial writing
* Jeremy Whiting (<span class="mailme">jpwhiting at kde dot org</span>)<br /> Developer
* Teo Mrnjavac (<span class="mailme">teo at kde dot org</span>)<br /> Developer, Amarok
* Elio Joly Botogoske  (<span class="mailme">teo at kde dot org</span>)<br /> Developer
* Your name here!<br /> Volunteer to be a mentor -&gt; <span class="mailme">kde dot org at phor dot net</span>
<!-- BUMP YOURSELF WHENEVER YOU WANT! -->


If you are a student you might be interested in the Google Summer of Code program. KDE has been a mentoring organization for many years, we have a separate wiki page  with information on participating in [[GSoC|Google Summer of Code with KDE]].
You may also want to set up a more permanent or advanced development environment, which will be very handy to start working on KDE Frameworks or Plasma itself. See [[Guidelines and HOWTOs/Build from source]]

Revision as of 18:05, 4 June 2018

By joining the ranks of KDE developers, you will get to implement new features and defeat bugs both daunting and simple, all while collaborating to make coherent and stable releases. Developers collaborate in teams based on what area they are working in. These can be small teams working on a single application, up to large teams working on a group of related pieces of software. Many developers are in more than one team.

KDE runs or participates in several mentoring programs to help new developers, including an informal list of people who are willing to help newcomers get started. See the Mentoring page for more details.


Choosing what to do

A good place to start is with a small bug or feature in an existing piece of software that affects you personally ("scratch your own itch"). Get in touch with the existing developers (see Communicating with the team, below) and they can help you out, by pointing you to the right place in the code and giving advice about how to tackle the problem

Try not to start by proposing or working on major features or significant design changes. These can be controversial, and the smoothest way to get going is by working on relatively non-controversial bug-fixes.

Other ideas for starting points are:

New to (C++/Qt) software development?

Most KDE software is written in C++ using the Qt framework. There are many guides to C++ online, and which one works for you will depend on how you learn best and what previous programming experience you have.

For learning Qt, you can find a list of books for learning Qt on the Qt wiki. Qt also provides lots of examples you can look at.

Most KDE software is also built on other KDE software, particularly the KDE Frameworks. The TechBase wiki has documentation about using these libraries, and a book is available. See also Guidelines and HOWTOs/Development.

Get the code

First you will need to use your distro's package manager to install some basic tools:

  • Debian/Ubuntu/KDE Neon:
    sudo apt install git cmake
  • Fedora:
    sudo dnf install git cmake
  • openSUSE:
    sudo zypper install git cmake
  • Arch/Antergos/Manjaro:
    sudo pacman -S git cmake

Next, create a folder to hold all the source code repositories you're going to be downloading!

mkdir ~/repos
cd ~/repos

Now download the source code for the project you would like to work on. All the KDE git repositories can be found at here. If you are not familiar with Git, the Git Book is a good introduction, but you will learn what you need here if you're new to git.

Now find the official project/repository name of the software you want to work on. most are identical to the software's name; e.g. the repository name for Okular is okular. You can find the full list at https://cgit.kde.org/. Then clone the repo:

git clone git://anongit.kde.org/<project/repository name>.git

Set up your development environment

First of all, don't worry about this process destabilizing your machine. Your existing software is installed to /usr, and when you produce own patched software, it will be installed to /opt/kde leaving the original software untouched.

In order to compile a piece of KDE software, you will first need to use your distro's package manager to download the dependencies for the project you would like to patch, so that it will compile.

The way to do this varies according to your distro (If you don't see it listed below, it is not a recommended development platform):

KDE Neon

sudo apt build-dep <repo/package name>

Kubuntu

First add the Kubuntu Backports PPA, which will upgrade your system to use newer KDE software:

Warning

Due to the nature of package dependencies, this will upgrade the entire KDE software stack. Do not proceed unless you are okay with this.
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt update
sudo apt full-upgrade

Then install the dependencies for the software you want to work on:

sudo apt build-dep <repo/package name>

Fedora

First add the <insert thing here> Copr, which will upgrade your system to use newer KDE software:

Warning

Due to the nature of package dependencies, this will upgrade the entire KDE software stack. Do not proceed unless you are okay with this.
[Insert method of updating KDE packages in Fedora here]

Then install the dependencies for the software you want to work on:

sudo dnf builddep <repo/package name>

openSUSE Tumbleweed

First enable the source repository:

sudo zypper mr -e repo-source

Then install the dependencies for the software you want to work on:

sudo zypper si -d <repo/package name>

Arch/Antergos/Manjaro

sudo pacman -S git <repo/package name>



Compile the software

Before you work on your patch, try to compile the software to make sure that your development environment is set up properly:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde/ ..
make

(Notice how we are telling CMake to install to /opt/kde/ instead of /usr/ (which is the normal location). This is because we don't want to overwrite the software provided by your distro, which could destabilize the system.

Did the project compile? Great! Move onto the next section. If you run into problems, see this page for what to do about it.

Make your patch

Now you can open your editor and get hacking! As before, make sure it compiles:

make


Test your patch

At this point, you have a patch, and the project still compiles. Now it's time to run the project's unit tests:

make test

If any test fails, that needs to be investigated before you can proceed. If the tests pass, then it's time to install your patched software:

sudo make install

This will install the software to /opt/kde/. To actually run it, you will need to set some environment variables to account for the non-standard location. First, create a file with the environment variables (this only needs to be done once):

cat > ~/.kderc << "EOF"
export KF5=/opt/kde
export QTDIR=/usr
export CMAKE_PREFIX_PATH=$KF5:$CMAKE_PREFIX_PATH
export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share
export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg
export PATH=$KF5/bin:$QTDIR/bin:$PATH
export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
export QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml
export QML_IMPORT_PATH=$QML2_IMPORT_PATH
export KDE_SESSION_VERSION=5
export KDE_FULL_SESSION=true
export SASL_PATH=/usr/lib/sasl2:$KF5/lib/sasl2
EOF

Now source it to pick up the new environment variables:

source ~/.kderc

Now you're ready to run your patched program!

/opt/kde/bin/<the program>

Does it behave as you expect? Great! If not, go back and work on your patch some more, then re-compile and re-deploy, and test again, until the program does what you'd like it to do.

Submitting your first patch

Once you're happy with your patch and have verified that it does what you want, you need to send it to other KDE developers for review. KDE uses Phabricator for this. Learn how to submit a patch with Phabricator


Communicating with the team

There are several ways to get in touch with KDE developers, and developers for a specific project. The two most important are:

Both of these are general KDE development communication channels, and you may get directed to a more appropriate place for the project you are interested in. There is a list of mailing lists if you want to find a mailing list for a specific team directly. Many teams have their own Telegram rooms, too.

You can also try looking for the team's section on the Main Page of this wiki. Many teams have information there for new contributors.


Next steps

After you have had several patches accepted, a KDE developer is likely to suggest you get a Developer account, which will allow you to commit directly to KDE projects. With very few limits on where you can commit, you will be expected to act responsibly. At this point, congratulations! You are officially a KDE developer!

You may also want to set up a more permanent or advanced development environment, which will be very handy to start working on KDE Frameworks or Plasma itself. See Guidelines and HOWTOs/Build from source