Jump to content

Get Involved/development: Difference between revisions

From KDE Community Wiki
Ngraham (talk | contribs)
No edit summary
Ngraham (talk | contribs)
No edit summary
Line 7: Line 7:
Most KDE software is written in C++ using the [https://www.qt.io Qt toolkit] and [[Frameworks | KDE Frameworks]]. Though prior experience with these technologies or other programming languages is helpful, you don't need to be a C++ programmer to get started!
Most KDE software is written in C++ using the [https://www.qt.io Qt toolkit] and [[Frameworks | KDE Frameworks]]. Though prior experience with these technologies or other programming languages is helpful, you don't need to be a C++ programmer to get started!


{{Note|The Qt wiki contains [https://wiki.qt.io/Books a list of online books for learning Qt] programming. Qt also provides [http://doc.qt.io/qt-5/qtexamplesandtutorials.html lots of examples] you can look at. Information about KDE Frameworks can be found on 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]]}}
{{Note|The Qt wiki contains [https://wiki.qt.io/Books a list of online books] for learning Qt programming. Qt also provides [http://doc.qt.io/qt-5/qtexamplesandtutorials.html lots of examples] you can look at. Information about KDE Frameworks can be found on the [https://techbase.kde.org TechBase wiki], and a [[Books | book]] is available. See also [[Guidelines and HOWTOs/Development]]}}




Line 13: Line 13:
First you will need to use your distro's package manager to install some basic tools:
First you will need to use your distro's package manager to install some basic tools:
* Arch/Antergos/Manjaro: <code>sudo pacman -S git cmake dialog</code>
* Arch/Antergos/Manjaro: <code>sudo pacman -S git cmake dialog</code>
* Debian/Ubuntu/KDE Neon: <code>sudo apt install git cmake dialog</code>
* Fedora: <code>sudo dnf install git cmake dialog</code>
* Fedora: <code>sudo dnf install git cmake dialog</code>
* openSUSE: <code>sudo zypper install git cmake dialog</code>
* KDE Neon/Kubuntu/Ubuntu/Debian: <code>sudo apt install git cmake dialog</code>
 
* openSUSE Leap & Tumbleweed: <code>sudo zypper install git cmake dialog</code>
{{Note|The online [https://git-scm.com/book Git Book] is a good introduction to the  [https://git-scm.com/ Git] source control system if you're not familiar with it, but you will learn what you need here if you're new to it. No special CMake knowledge is required.}}


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


Did that work? Great! Now let's build Dolphin. To do this, we will first need to get some external dependencies...
Did that work? Great! Now let's build Dolphin. To do this, we will first need to get some external dependencies...


== Get external dependencies ==
== Get external dependencies ==
We will use <code>kdesrc-build</code> to manage KDE dependencies, but most pieces of KDE software also depend on system libraries that are not owned or controlled by KDE. We will use the distro's package manager to get these:
We will use <code>kdesrc-build</code> to manage KDE dependencies, but most pieces of KDE software also depend on system libraries that are not owned or controlled by KDE. We will use the distro's package manager to get these:
* Arch/Antergos/Manjaro: <code>sudo pacman -S git <repo/package name></code>
* Arch/Antergos/Manjaro: <code>sudo pacman -S git dolphin</code>
* Fedora: <code>sudo dnf builddep <repo/package name></code>
* Fedora: <code>sudo dnf builddep dolphin</code>
* KDE Neon/Kubuntu/Ubuntu/Debian <code>sudo apt build-dep <repo/package name></code>
* KDE Neon/Kubuntu/Ubuntu/Debian <code>sudo apt build-dep dolphin</code>
* openSUSE Leap & Tumbleweed: <code>sudo zypper si -d <repo/package name></code>
* openSUSE Leap & Tumbleweed: <code>sudo zypper si -d dolphin</code>




Line 94: Line 93:
<pre>
<pre>
source ~/kde/.setup-env
source ~/kde/.setup-env
~/kde/usr/dolphin
~/kde/usr/bin/dolphin
</pre>
</pre>


Did it run? If so, then '''congratulations, you just compiled your own version of Dolphin from source code!'''
Did it run? If so, then '''congratulations, you just compiled your own version of Dolphin from source code!'''


== Choosing what to do ==
Now that you can compile and deploy custom versions of KDE software, you can open your editor and get hacking! 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


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.
== Choose what to do ==
Now that you can compile and deploy custom versions of KDE software, you can open your editor and get hacking! The code for the version of Dolphin hat you just built is located at <tt>cd ~/kde/build/kde/applications/dolphin/</tt>; other projects you use <code>kdesrc-build</code> to download will be in similar locations.
 
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
 
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. Start slowly and build trust!


Other ideas for starting points are:
Other ideas for starting points are:
Line 112: Line 114:


== Test your patch ==
== Test your patch ==
At this point, you have a patch, and the project still compiles and installs. Now it's time to run the project's unit tests:
At this point, you have a patch. Make sure the project still compiles and installs, and make sure the patch has the desired effect when you run the software. Now it's time to run the project's unit tests:
<pre>
<pre>
source ~/kde/.setup-env
source ~/kde/.setup-env
cd ~/kde/<project>
cd ~/kde/build/kde/applications/dolphin/<project>
make test
make test
</pre>
</pre>
Line 122: Line 124:




== Submitting your first patch ==
== Submit your 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 [https://phabricator.kde.org Phabricator] for this. [[Infrastructure/Phabricator | Learn how to submit a patch with Phabricator]]
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]]




== Communicating with the team ==
== Communicate 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:
There are several ways to get in touch with KDE developers, either generally or for a specific project. The two most important communications channels 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 [http://webchat.freenode.net/?channels=kde-vdg #kde-devel] freenode [[Internet Relay Chat | IRC channel]], which is where KDE developers chat in real time about their work
* 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])
* The [https://mail.kde.org/mailman/listinfo/kde-devel kde-devel mailing list] is the primary development mailing list. [http://kde.org/support/#mailinglists learn more about mailing lists].


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

Revision as of 05:57, 3 November 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.

New to C++/Qt software development?

Most KDE software is written in C++ using the Qt toolkit and KDE Frameworks. Though prior experience with these technologies or other programming languages is helpful, you don't need to be a C++ programmer to get started!

Note

The Qt wiki contains a list of online books for learning Qt programming. Qt also provides lots of examples you can look at. Information about KDE Frameworks can be found on the TechBase wiki, and a book is available. See also Guidelines and HOWTOs/Development


Set up the development environment

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

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

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

mkdir ~/kde
cd ~/kde

Most Linux distros do not provide development packages that are up-to-date enough for working on KDE software, so we will compile all the KDE dependencies ourselves. To do this, we use a command-line tool called kdesrc-build to download, manage, and build KDE source code repositories. Let's set it up now:

git clone git://anongit.kde.org/kdesrc-build.git
cd kdesrc-build

We want to add kdesrc-build to your system's $PATH variable so you can access it from anywhere. Use a text editor to open ~/.bashrc file and add export PATH=~/kde/kdesrc-build:$PATH. Then save the file and close it.

Next, set up kdesrc-build using its built-in wizard. The default options should be ok, but feel free to customize anything:

./kdesrc-build-setup

Note

Do not quote or escape any file paths entered in the wizard


Set up the runtime environment

Copy the following text to a new file called ~/kde/.setup-env:

export KF5=$HOME/kde/usr
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  
# (lib64 instead of lib on some systems, like openSUSE)
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
# (lib64 instead of lib on some systems, like openSUSE)
PS1="(kdesrc) $PS1"

This only needs to be done once.


Compile and install a test project

Now let's use kdesrc-build to download, compile, and install a simple KDE project with no dependencies so we can be sure it's working properly.

cd ~/kde
kdesrc-build extra-cmake-modules

Did that work? Great! Now let's build Dolphin. To do this, we will first need to get some external dependencies...


Get external dependencies

We will use kdesrc-build to manage KDE dependencies, but most pieces of KDE software also depend on system libraries that are not owned or controlled by KDE. We will use the distro's package manager to get these:

  • Arch/Antergos/Manjaro: sudo pacman -S git dolphin
  • Fedora: sudo dnf builddep dolphin
  • KDE Neon/Kubuntu/Ubuntu/Debian sudo apt build-dep dolphin
  • openSUSE Leap & Tumbleweed: sudo zypper si -d dolphin


Compile and install Dolphin

Now that we have the dependencies, we can use kdesrc-build to compile and install Dolphin:

cd ~/kde
kdesrc-build dolphin


Run your custom-compiled software

Now source the ~/kde/.setup-env file every time you want to run your custom-compiled KDE software:

source ~/kde/.setup-env
~/kde/usr/bin/dolphin

Did it run? If so, then congratulations, you just compiled your own version of Dolphin from source code!


Choose what to do

Now that you can compile and deploy custom versions of KDE software, you can open your editor and get hacking! The code for the version of Dolphin hat you just built is located at cd ~/kde/build/kde/applications/dolphin/; other projects you use kdesrc-build to download will be in similar locations.

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. Start slowly and build trust!

Other ideas for starting points are:


Test your patch

At this point, you have a patch. Make sure the project still compiles and installs, and make sure the patch has the desired effect when you run the software. Now it's time to run the project's unit tests:

source ~/kde/.setup-env
cd ~/kde/build/kde/applications/dolphin/<project>
make test

If any test fails, that needs to be investigated and fixed before you can proceed. Once the tests pass, then run the software again to make sure it still behaves properly. If it doesn't, then 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 and all tests pass.


Submit your 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


Communicate with the team

There are several ways to get in touch with KDE developers, either generally or for a specific project. The two most important communications channels 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