How To Compile Amarok 2 From Git On Kubuntu 9.10 Karmic

Author: Stephan Jau
Revision: v1.1
Last Change: December 14 2009

Introduction

Amarok is a great music player for linux. In the current reales of Kubuntu 9.10 Karmic also the current stable version of Amarok was introduced into the repositories. However Amarok is under heavy development and updates won't be included in the official repos. If you want to be up-to-date and have the latest Amarok version available, you'll need to compile it yourself. Compiling Amarok isn't really hard but there are a few dependencies that it needs and a few things to look out for.

This howto is based on my old howto for Kubuntu 8.10 Intrepid. Because of the the rapid development of Amarok the old howto is completely outdated. Most of the things in there remain still valid but also a lot of other things have changed. Most notably the change from SVN to Git.

 

1: Remove the current amarok installation

sudo apt-get purge amarok amarok-common

Instead of "purge" you can also use "remove". The difference is that purge will delete config and user data files (e.g. your statistics and stuff) - you may want to make a backup first.

 

2: Upgrade

I recommend to upgrade your system first:

sudo apt-get update && sudo apt-get upgrade

 

3: Install the required packages

Now install the required packages:

sudo apt-get install git-core build-essential kubuntu-restricted-extras kde-devel subversion libncurses5-dev libtag1-dev libqca2-dev libstrigiqtdbusclient-dev libstreamanalyzer-dev

Well, the kubuntu-restricted-extras package is not necessary per se but what good is a music player if you don't have the codecs to play music.

 

4: Extend your .bashrc and myenv.sh

You need to extend your .bashrc and myenv.sh files with a few things. Just run those commands:

KDE Users use this:

echo '' >> ${HOME}/.bashrc
echo 'export PATH=$HOME/kde/bin:$PATH' >> ${HOME}/.bashrc
mkdir -p ${HOME}/.kde/env
echo 'export KDEDIR=$HOME/kde' >> ${HOME}/.kde/env/myenv.sh
echo 'export KDEDIRS=$KDEDIR' >> ${HOME}/.kde/env/myenv.sh

Non-KDE Users use this:

echo '' >> ${HOME}/.bashrc
echo 'export PATH=$HOME/kde/bin:$PATH' >> ${HOME}/.bashrc
echo 'export KDEDIR=$HOME/kde' >> ${HOME}/.bashrc
echo 'export KDEDIRS=$KDEDIR' >> ${HOME}/.bashrc

And verify whether those were really added:

cat ${HOME}/.bashrc
cat ${HOME}/.kde/env/myenv.sh

If you're a non-KDE user, then only issue the first of those two commands

 

Step 5: Reload your .bashrc

Reload your .bashrc:

source ${HOME}/.bashrc

 

6: Create required folders

Create the required folders:

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

 

7: Download Amarok (necessary for compiling MySQL)

cd ${HOME}/kde/src
git clone git://gitorious.org/amarok/amarok.git

 

8: Download MySQL

MySQL is now integrated in Amarok 2 directly, this means we require the source for it. You can download MySQL here: http://dev.mysql.com/downloads/mysql/5.1.html#source

Or you can just run those commands:

cd ${HOME}/kde/src
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.40.tar.gz/from/http://mirror.switch.ch/ftp/mirror/mysql/

 

9: Extract and compile MySQL

This is only applicable if you downloaded the mysql tar ball to the given location above and if you downloaded this exacte version. If necessary alter the path and version number:

tar xzvf mysql-5.1.40.tar.gz
cd mysql-5.1.40
cp -R ${HOME}/kde/src/amarok/supplementary_scripts/mysqle/* .

In case you got a multicore cpu or more cpus then you can change the number of cores to be used to compile. If you have a dual core then set the option below to "-j3". If you have a quadcore set it to "-j5". In rare cases there are problems by using multicore; if that's the case then just set it to "-j1":

export MAKEOPTS=-j2

Now you can compile MySQL (it will take quite a while):

./build-mysqle.sh --prefix=${HOME}/usr

 

10: Compile taglib-extras

This was also moved out of the Amarok Git repository and hence you'll have to compile it yourself:

cd ${HOME}/kde/src
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib-extras/ taglib-extras
cd taglib-extras
mkdir build
cd build
export LD_LIBRARY_PATH=${HOME}/kde/build/taglib-extras/taglib-extras
cmake -DWITH_ASF=On -DWITH_MP4=On -DCMAKE_INSTALL_PREFIX=${HOME}/kde ..
make
make install

 

11: Compile QtScriptGenerator

This has to be compiled also seperately. Get the sources:

cd ${HOME}/kde/src
wget http://qtscriptgenerator.googlecode.com/files/qtscriptgenerator-src-0.1.0.tar.gz
tar xfvz qtscriptgenerator-src-0.1.0.tar.gz
cd qtscriptgenerator-src-0.1.0

However before you can compile it on Karmic, you'll have to patch it as Karmic uses GCC 4.4:

nano qtscriptgenerator.gcc-4.4.patch

Paste this text:

diff -uNr generator.orig/parser/rpp/pp.h generator/parser/rpp/pp.h
--- generator.orig/parser/rpp/pp.h	2008-12-05 11:01:44.000000000 +0100
+++ generator/parser/rpp/pp.h	2008-12-13 10:42:22.000000000 +0100
@@ -30,6 +30,7 @@
 #include <cctype>
 
 #include <fcntl.h>
+#include <cstdio>
 
 #ifdef HAVE_MMAP
 #  include sys/mman.h>

Save the file and run that command to patch the sources:

patch -p0 < qtscriptgenerator.gcc-4.4.patch

Now you can compile it and then generate the bindings:

export INCLUDE=/usr/include/qt4
cd generator
qmake
make
./generator
cd ../qtbindings
qmake
make

Copy the bindings now to the appropriate folder:

cd ../plugins/script
sudo cp -R * /usr/lib/qt4/plugins/script/

 

12: Enable additional Amarok plugins

If you want that Amarok can scrobble songs on last.fam you'll have to compile liblastfm on your own:

sudo apt-get install qt4-qmake pkg-config libsamplerate-dev libfftw3-dev ruby g++ libqt4-dev
cd ${HOME}/kde/src/
wget http://cdn.last.fm/src/liblastfm-0.3.0.tar.bz2
tar xvfj liblastfm-0.3.0.tar.bz2
cd liblastfm-0.3.0
./configure --release --prefix /usr/local
make
sudo make install

For the other plugins to work, you'll just have to install the appropriate packages. Below you have the list of the necessary packages for each plugin. Chose those that you want:

# libgpod - this also fulfills the requirements for Gdk
sudo apt-get install libgpod4 libgpod-dev
# libmtp
sudo apt-get install libmtp8 libmtp-dev
# curl
sudo apt-get install curl libcurl4-openssl-dev
# libxml2
sudo apt-get install libxml2 libxml2-dev
# loudmouth
sudo apt-get install libloudmouth1-0 libloudmouth1-dev

 

13: Compile Amarok

Finally we've reached the point where we're ready to start comiping Amarok:

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

That should take some time now.

 

14: Update KDE config

Finally you'll have to update the KDE config:

kbuildsycoca4 --noincremental

 

15: Run Amarok

Now you can start Amarok from the command line:

amarok
Share this page:

6 Comment(s)