Amarok/Development/Development HowTo: Difference between revisions

From KDE Community Wiki
Line 184: Line 184:
To build from source you need to install git on your computer, then download the sources with the following command:
To build from source you need to install git on your computer, then download the sources with the following command:


  git clone git://anongit.kde.org/amarok.git
  git clone https://invent.kde.org/multimedia/amarok.git


For updates you can then just use the command
For updates you can then just use the command
Line 195: Line 195:
  mkdir build
  mkdir build
  cd build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debugfull -DKDE4_BUILD_TESTS=ON .. && make && make install
  cmake -DCMAKE_INSTALL_PREFIX=`kf5-config --prefix` -DCMAKE_BUILD_TYPE=debugfull -DBUILD_TESTING=ON .. && make && make install


Note that your cmake preferences are saved in CMakeCache.txt, so you don't have to have the -D options every time you run cmake.
Note that your cmake preferences are saved in CMakeCache.txt, so you don't have to have the -D options every time you run cmake.

Revision as of 11:53, 1 June 2024

Development Environment

See the README for a complete list of dependencies.

More: Getting Started/Sources/Amarok Git Tutorial

Building Amarok

Building Locally

Installing Amarok locally will put it in your $HOME folder, making everything much easier to maintain. Source Please refer to the source if something doesn't work as it should despite you having followed each step. Also be aware that sometimes upstream changes can cause problems, but we try our best to keep this page updated. In case of problems you can also ask in #amarok on irc.freenode.net. Please be patient and don't leave after a few minutes, we are often busy with real life :)

Install git, the compiler and KDE 5 development packages

In Kubuntu, Debian, and all their derivatives:

sudo apt-get install git-core build-essential kdesdk kdelibs5-dev libkonq5-dev kdebase-workspace-dev 

As well as a basic KDE installation, formerly provided by the now defunct kde-minimal metapackage:

* kdebase-runtime
* kdebase-workspace
* kdebase-apps
* plasma-desktop

I also highly recommend to install the oxygen-icon-theme and oxygen-icon-theme-complete, so you don’t have missing icons if you do not run KDE.

In Archlinux:

sudo pacman -Sy git base-devel kdelibs kdebase-runtime

In Gentoo:

sudo emerge -av dev-util/git kdelibs plasma-workspace

In OpenSuSE:

sudo zypper install git

In Fedora:

sudo yum install git kdelibs-devel

Install ccache to speed up compilation (optional, recommended)

ccache is a very nice tool that can speed up your compilation. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. Install the package from your distribution (for those on Debian distros: sudo apt-get install ccache) and set the size of the cache to 2 GB with the command

ccache -M 2G

This will take 2Gb of space in your local directory, but the gain of time is really impressive. Enable the use of ccache by adding it to your local .bashrc, described below:

Using a text editor of your choice, open $HOME/.bashrc and append the following:

export PATH=$HOME/kde/bin:$PATH
export PATH=/usr/lib/ccache:$PATH
export LD_LIBRARY_PATH=$HOME/kde/lib:$LD_LIBRARY_PATH

Reload your edited .bashrc:

source $HOME/.bashrc

NOTE: if you are not using the bash shell, edit your proper shell config file (~/.zshrc or ~/.tcshrc or whatever it may be).

Make KDE aware of Amarok’s plugin location

mkdir ~/.kde/env  # okay if it exists
echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh
echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh

Beware, some distributions call the above folder $HOME/.kde4/… (OpenSuSE in particular).

Make sure you have all the necessary dependencies

sudo apt-get build-dep amarok

For OpenSuSE users this would be

sudo zypper si -d amarok

For Fedora

yum-builddep amarok

The README file in the source is the reference for the dependency version, please refer to it in case of doubt.

Various dependencies that might cause compile errors and have to be installed

(these are rather specific to Kubuntu, might have other names in other distributions and/or are already installed)

  • libstrigiqtdbusclient-dev
  • libsearchclient-dev
  • libmysqlclient
  • libmysqlclient-dev
  • libmysqld-dev
  • libmysqld-pic
  • libwrap0-dev, needed as a dependency for MySQL. For OpenSuSE users, the package to install is tcpd-devel

Create folders

mkdir -p $HOME/kde/build/amarok
mkdir $HOME/kde/src

Checking out and Building

Now you need a source checkout from git.kde.org. In the folder ~/kde/src/, type the following command:

git clone git://anongit.kde.org/amarok.git

this will drag approx. 55-60Mb of data, depending on the moment you actually make this checkout.

Everything is now ready to build:

cd $HOME/kde/build/amarok
cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/amarok
make install

NOTE: if you want MP4 and ASF support you need to build with the following cmake line instead

cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde -DCMAKE_BUILD_TYPE=debugfull -DWITH_MP4=ON -DWITH_ASF=ON $HOME/kde/src/amarok

NOTE: if you previously used the git URL rather than anongit, run this command:

git remote set-url origin git://anongit.kde.org/amarok

This will reset your git config file.

Updating KDE Config

kbuildsycoca4 --noincremental

Note: this might not be necessary for most of the cases

Now you are ready to run Amarok 2.x by typing “amarok” in the shell. We strongly recommend you run amarok with the -d and --nofork option, so you will have debugging enabled and can get a valid backtrace if Amarok crashes.

Updating your Amarok build

Since the development is quite fast with git, you should update your Amarok build regularly, and a daily checkout is not too much. This is made easy with the following command:

cd $HOME/kde/src/amarok
git pull

This will update your local git branch.


NOTE: if you previously used the git URL rather than anongit, run this command:

git remote set-url origin git://anongit.kde.org/amarok

This will reset your git config file.

If you have done modifications to your local branch you would like to keep, make sure you update with the --rebase option. See also the git tutorial for KDE in section 10.

You can now simply build again with

cd $HOME/kde/build/amarok
make install

Since you have installed ccache, a full build will speed up over time. To have an idea about the build time, just type time make install when building. If you have several CPU cores, you can speed up even more with the -j[n] option, where [n] is the number of CPU cores +1. Of course, the more CPU you use for building, the less you will have available for other tasks

More information and useful links

Don’t forget: running a development version also means that it is not stable and can break anytime ! This is especially true after a feature freeze, when the developers merge their personal git branches to the master branch.

Note: To be notified about major changes you definitely should subscribe to our mailing list [email protected] at https://mail.kde.org/mailman/listinfo/amarok-devel.

Of course you will also find help in our #amarok channel on irc.freenode.net, but reading the mailing list is mandatory and spares us a lot of time.

Since you don’t want to repeat all this completely when you upgrade to a newer version of your preferred distribution, you should consider installing your /home directory on a separate partition from the start, it will spare you quite some time and hassle in the future.

Important information for code contributors

Amarok uses a unit test infrastructure that allows us to test the builds. If you consider contributing code to Amarok, you need to install Google Mock and you should build Amarok with the following cmake flag:

BUILD_TESTING=ON

For more information about the test infrastructure, read the Qtestlib Manual

Globally

A global install that puts Amarok in your main system directories which is fine unless something goes wrong and you want to get rid of it easily.


To build from source you need to install git on your computer, then download the sources with the following command:

git clone https://invent.kde.org/multimedia/amarok.git

For updates you can then just use the command

git pull --rebase

in the amarok source folder. Then follow the instructions below.

cd amarok
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=`kf5-config --prefix` -DCMAKE_BUILD_TYPE=debugfull -DBUILD_TESTING=ON .. && make && make install

Note that your cmake preferences are saved in CMakeCache.txt, so you don't have to have the -D options every time you run cmake.

ccmake .

will give you a nice ncurses interface