Jump to content

Get Involved/development: Difference between revisions

From KDE Community Wiki
Rominf (talk | contribs)
Ngraham (talk | contribs)
No edit summary
Line 37: Line 37:
</pre>
</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. For now, just clone the repo:
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>
<pre>
git clone https://anongit.kde.org/<repository-name>.git
git clone https://cgit.kde.org/<project/repository name>.git
</pre>
</pre>


Line 48: Line 50:
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.  
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.  


First find the official project name of the software you want to work on. most are identical to the software's name; e.g. the project name for Okular is okular.
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):
 
Go to http://cgit.kde.org/ and find
 
For example, let's say you want to work on Okular. You find https://cgit.kde.org/okular.git
 
The way to do this varies according to your distro:
=== KDE Neon ===
=== KDE Neon ===
<pre>
<pre>
Line 61: Line 57:


=== Kubuntu ===
=== Kubuntu ===
First add the KDE 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.}}
{{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>
<pre>
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt update
sudo apt update
</pre>
Then install the dependencies for the software you want to work on:
<pre>
sudo apt build-dep <repo/package name>
sudo apt build-dep <repo/package name>
</pre>
</pre>


=== Fedora ===
=== 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>
<pre>
Fedora: [Insert method of updating KDE packages here]
sudo dnf builddep <repo/package name>
sudo dnf builddep <repo/package name>
</pre>
</pre>


=== openSUSE ===
=== openSUSE Tumbleweed ===
openSUSE has source repository disabled by default. To enable it use:
First enable the source repository:
<pre>
<pre>
sudo zypper mr -e repo-source
sudo zypper mr -e repo-source
</pre>
</pre>
Then use following command to install dependencies:
Then install the dependencies for the software you want to work on:
<pre>
<pre>
sudo zypper si -d <repo/package name>
sudo zypper si -d <repo/package name>

Revision as of 18:22, 20 February 2018

Becoming a KDE Developer

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. 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.

Other 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 https://cgit.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 KDE 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

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>



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:

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? 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