Get Involved/development/Set up a development environment: Difference between revisions
→Disable indexing for your development environment: System Settings path |
Clean up and simplify; there was wayyyyy too much unnecessary trivia in here |
||
Line 29: | Line 29: | ||
== Set up kdesrc-build == | == Set up kdesrc-build == | ||
<code>kdesrc-build</code> is the official KDE meta-build-system tool. It is used to manage the building of many software repositories in an automated fashion. Its primary purpose is to '''manage dependencies'''. Every software has dependencies: other pieces of software that provide lower-level functionality they rely on. In order to compile any piece of software, its dependencies must be available. KDE software has two types of dependencies: dependencies on other pieces of KDE software, and dependencies on 3rd-party software. E.g. the KDE application KCalc depends on more than 20 other KDE git repositories as well as the Qt toolkit. | |||
Because most Linux operating systems do not provide development packages of the KDE Frameworks 5 and of other KDE libraries that are up-to-date enough for us to build from the "master" branch of the KDE git repositories, we use <code>kdesrc-build</code> compile them ourselves. The goal is to avoid using KDE binaries, libraries and other files from the OS (i.e. the /usr directory). | |||
Let's set it up now! First, create a new directory for all the KDE source code. You will need many gigabytes of free disk space. Budget 50 GB for KDE Frameworks + KDE Plasma, and 10-30 GB more for some apps as well. Then clone the <code>kdesrc-build</code> git repository in that directory: | |||
First, | |||
{{Input|1=<nowiki> | {{Input|1=<nowiki> | ||
mkdir -p ~/kde/src | mkdir -p ~/kde/src | ||
cd ~/kde/src/ | cd ~/kde/src/ | ||
Line 44: | Line 41: | ||
</nowiki>}} | </nowiki>}} | ||
Next, it's time to | Next, it's time to run the initial setup program, which will make some changes to your <code>~/.bashrc</code> (or <code>~/.zshrc</code> for zsh users) and install necessary 3rd-party packages: | ||
{{Input|1=<nowiki> | {{Input|1=<nowiki> | ||
./kdesrc-build --initial-setup | ./kdesrc-build --initial-setup | ||
source ~/.bashrc | source ~/.bashrc | ||
{{Note|If you use zsh and selected yes for auto-completions during the initial setup for <code>kdesrc-build</code>, add the following to <code>~/.zshrc</code> if it is not already there. | {{Note|If you use zsh and selected yes for auto-completions during the initial setup for <code>kdesrc-build</code>, add the following to <code>~/.zshrc</code> if it is not already there. | ||
{{Input|1=<nowiki> | {{Input|1=<nowiki> | ||
Line 61: | Line 52: | ||
autoload -U +X bashcompinit && bashcompinit | autoload -U +X bashcompinit && bashcompinit | ||
</nowiki>}} | </nowiki>}} | ||
For more details about 3rd-party dependencies, see [[Get_Involved/development/Install_the_dependencies]] | |||
{{Note|This process installs 3rd-party dependencies once, but they can change over time, and <code>kdesrc-build</code> is currently not smart enough to track those changes and apply them later; see https://invent.kde.org/sdk/kdesrc-build/-/issues/9 for more details. So if in the future, you happen to find any external dependencies needed to build KDE software that were not installed with <code>kdesrc-build --initial-setup</code>, then once you finish this tutorial, please send a merge request to https://invent.kde.org/sdk/kdesrc-build/-/blob/master/modules/ksb/FirstRun.pm in order to include the needed packages to the list.}} | |||
== Set up Qt == | == Set up Qt == | ||
Qt is the fundamental framework that is needed for pretty much all KDE development. | Qt is the fundamental framework that is needed for pretty much all KDE development. A recent enough version of Qt is required to proceed. | ||
You can look up the version of the Qt framework installed on your operating system by opening the application "Info Center" (KInfoCenter) > Basic Information > About this System > "Qt Version:" | You can look up the version of the Qt framework installed on your operating system by opening the application "Info Center" (KInfoCenter) > Basic Information > About this System > "Qt Version:" | ||
Line 72: | Line 64: | ||
If Qt 5.15 or later is installed, you're already done done with this step and can proceed to the next section! 🎉 | If Qt 5.15 or later is installed, you're already done done with this step and can proceed to the next section! 🎉 | ||
... | ...Otherwise it's time to compile a more recent version of Qt using <code>kdesrc-build</code>. See [[Get_Involved/development/More#Build_Qt_using_kdesrc-build|Building Qt using kdesrc-build]] to learn how. If you're just getting started with development, it may be a good time to switch distros to something [[Get_Involved/development#Operating_system|better suited for building KDE software from source code]] either as the primary operating system or in a virtual machine. But if you are an advanced user, feel free to compile your own Qt. | ||
== Disable indexing for your development environment == | == Disable indexing for your development environment == | ||
Line 78: | Line 70: | ||
[[File:Getting involved development file index options.png|center|600px|]] | [[File:Getting involved development file index options.png|center|600px|]] | ||
== Next Steps == | == Next Steps == | ||
'''Reboot your computer''' and log back in so the package changes, and the <code>~/.bashrc</code> changes take effect on your user account. Once that's done, your development environment is set up and ready to build software. Time to learn how to use <code>kdesrc-build</code> tool to [[Get_Involved/development/Build_software_with_kdesrc-build|manage and build software from source code]]! |
Revision as of 21:31, 27 June 2023
Source code for KDE software lives on KDE Invent. But before you can work on it, you'll need to set up a development environment: a set of tools that allows you to access and edit the source code, compile it into a form that the computer can run, and deploy it to a safe location. We will now go through the process of setting one up. To accomplish these tasks, you will need to enter commands using a terminal program, such as KDE's Konsole.
If you're not familiar with the command line interface, you can find tutorials here. However, advanced command-line skills are not required, and you will learn what you need along the way!
If you're a visual learner, video tutorials can be found here.
Install basic tools
First you will need to use your operating system's package manager to install some basic tools:
- KDE Neon/Kubuntu/Ubuntu/Debian:
sudo apt install git cmake dialog
- Arch/Manjaro:
sudo pacman -S git cmake dialog extra-cmake-modules
- Fedora:
sudo dnf install git cmake dialog perl perl-IPC-Cmd perl-MD5 perl-FindBin bzip2
- openSUSE Leap & Tumbleweed:
sudo zypper install git breezy cmake dialog
Configure Git
We need to set your authorship information properly so that any changes you make can be properly attributed to you:
git config --global user.name "Your Name" git config --global user.email "[email protected]"
The name you provide should be your actual name, not your KDE Identity username or a pseudonym. And the email address must be the same as the email address used for your https://bugs.kde.org account. If they don't match, then the BUG:
and FEATURE:
keywords won't work (see this page for more information).}}
Next, in order to authenticate yourself when pushing code changes, you need to add an ssh key to your GitLab profile as described here.
Set up kdesrc-build
kdesrc-build
is the official KDE meta-build-system tool. It is used to manage the building of many software repositories in an automated fashion. Its primary purpose is to manage dependencies. Every software has dependencies: other pieces of software that provide lower-level functionality they rely on. In order to compile any piece of software, its dependencies must be available. KDE software has two types of dependencies: dependencies on other pieces of KDE software, and dependencies on 3rd-party software. E.g. the KDE application KCalc depends on more than 20 other KDE git repositories as well as the Qt toolkit.
Because most Linux operating systems do not provide development packages of the KDE Frameworks 5 and of other KDE libraries that are up-to-date enough for us to build from the "master" branch of the KDE git repositories, we use kdesrc-build
compile them ourselves. The goal is to avoid using KDE binaries, libraries and other files from the OS (i.e. the /usr directory).
Let's set it up now! First, create a new directory for all the KDE source code. You will need many gigabytes of free disk space. Budget 50 GB for KDE Frameworks + KDE Plasma, and 10-30 GB more for some apps as well. Then clone the kdesrc-build
git repository in that directory:
mkdir -p ~/kde/src cd ~/kde/src/ git clone https://invent.kde.org/sdk/kdesrc-build.git && cd kdesrc-build
Next, it's time to run the initial setup program, which will make some changes to your ~/.bashrc
(or ~/.zshrc
for zsh users) and install necessary 3rd-party packages:
./kdesrc-build --initial-setup source ~/.bashrc {{Note|If you use zsh and selected yes for auto-completions during the initial setup for <code>kdesrc-build</code>, add the following to <code>~/.zshrc</code> if it is not already there. {{Input|1=<nowiki> autoload -U +X compinit && compinit autoload -U +X bashcompinit && bashcompinit
For more details about 3rd-party dependencies, see Get_Involved/development/Install_the_dependencies
Set up Qt
Qt is the fundamental framework that is needed for pretty much all KDE development. A recent enough version of Qt is required to proceed.
You can look up the version of the Qt framework installed on your operating system by opening the application "Info Center" (KInfoCenter) > Basic Information > About this System > "Qt Version:"
If Qt 5.15 or later is installed, you're already done done with this step and can proceed to the next section! 🎉
...Otherwise it's time to compile a more recent version of Qt using kdesrc-build
. See Building Qt using kdesrc-build to learn how. If you're just getting started with development, it may be a good time to switch distros to something better suited for building KDE software from source code either as the primary operating system or in a virtual machine. But if you are an advanced user, feel free to compile your own Qt.
Disable indexing for your development environment
You'll want to disable indexing for your development-related git repos and the files they will build and install. Add ~/kde to the exclusions list in System Settings > Workspace > Search > File Search, like so:
Next Steps
Reboot your computer and log back in so the package changes, and the ~/.bashrc
changes take effect on your user account. Once that's done, your development environment is set up and ready to build software. Time to learn how to use kdesrc-build
tool to manage and build software from source code!