Amarok/Development/Development HowTo

Jump to: navigation, search

Contents

Development Environment

Amarok 2.7 requires KDE 4.8.3, Taglib 1.7, mysqld and the development headers thereof. Make sure you have strigi's streamanalyzers installed (libstreamanalyzer-dev and libstrigiqtdbusclient-dev on ubuntu). Optional packages include the latest version (1.0.0) of libmtp. Look here for help with various distributions. Currently Amarok 2 depends on embedded MySQL. Embedded MySQL is only supported in the 5.1 series. See this thread on the mailing list for help.

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 4 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
Changes in MySQL for Kubuntu Oeniric and Debian Sid

Mysqlclient was moved in these distros with the arrival of mysql 5.5, so mysql_config no longer reports mysql_pic. To correct this you need to patch a few files. Find below the patch by Jonathan Riddell:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4241e69..41b3412 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -957,7 +957,7 @@ if(KDE4_BUILD_TESTS)
 endif()
 
 if( NOT BUILD_MYSQLE_COLLECTION )
-    target_link_libraries(amaroklib ${MYSQL_LIBRARIES} ${ZLIB_LIBRARIES})
+    target_link_libraries(amaroklib ${MYSQL_LIBRARIES} -L/usr/lib/mysql ${ZLIB_LIBRARIES})
 endif( NOT BUILD_MYSQLE_COLLECTION )
 
 if(WIN32)
diff --git a/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt b/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
index 7218d54..07c5b6e 100644
--- a/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
+++ b/src/core-impl/collections/db/sql/mysqlecollection/CMakeLists.txt
@@ -36,6 +36,7 @@ target_link_libraries(amarok_collection-mysqlecollection
     ${QT_QTCORE_LIBRARY}
     ${QT_QTGUI_LIBRARY}
     ${MYSQL_EMBEDDED_LIBRARIES}
+    -L/usr/lib/mysql
     ${CMAKE_DL_LIBS}
     ${ZLIB_LIBRARIES}
 )
diff --git a/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt b/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
index 3312e14..72196ae 100644
--- a/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
+++ b/src/core-impl/collections/db/sql/mysqlservercollection/CMakeLists.txt
@@ -36,6 +36,7 @@ target_link_libraries(amarok_collection-mysqlservercollection
     ${QT_QTCORE_LIBRARY}
     ${QT_QTGUI_LIBRARY}
     ${MYSQL_LIBRARIES}
+    -L/usr/lib/mysql
     ${CMAKE_DL_LIBS}
     ${ZLIB_LIBRARIES}
 )

To apply this patch, save the patch to kubuntu_mysqld-pic.diff, go to the amarok/ folder of your git checkout and type

patch -p1 < kubuntu_mysqld-pic.diff

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 amarok-devel@kde.org 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:

KDE4_BUILD_TESTS=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 git://anongit.kde.org/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=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debugfull -DKDE4_BUILD_TESTS=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


This page was last modified on 10 October 2013, at 11:34. This page has been accessed 6,085 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal