How to build Amarok 2 from git

Because of the recent taglib switches, as well as the poor mysqle packaging, building Amarok 2 is somewhat involved. Here's a little list of how to do it (if you have problems, e-mail me).

Some of this information is available on the Amarok developer wiki, but it's not all in one place, which is why I wrote this guide (also, there are some quirks for ubuntu which aren't necessarily mentioned there).

First, install the dependencies. I haven't done this for a while, so I could me missing some. You'll need to add deb http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu jaunty main to your /etc/apt/sources.list (and then run sudo apt-get update) for the qtscriptgenerator package. If you run across a needed dependancy not in this list, let me know so I can update this. On Ubuntu, this goes something like:

sudo apt-get install build-essential cmake kdelibs5-dev kdelibs5-dbg libqt4-dev qtscriptgenerator libstreamanalyzer-dev libstrigiqtdbusclient-dev git-core qt4-qmake pkg-config libsamplerate-dev libfftw3-dev ruby libqt4-dev libncurses5-dev libqca2-dev libqtscriptbindings1

Next, check and make sure your QTDIR environment variable is set. If it's not, Amarok won't be able to correctly detect that you've installed the future dependencies (taglib, in particular).

echo $QTDIR

If it's not set, you need to set it to wherever QT is installed (probably /usr/lib/qt4).

echo "export QTDIR=/usr/lib/qt4" >> ~/.bashrc  
source ~/.bashrc

Now, we need to build dependencies. First, we'll build taglib and taglib extras. I build all my source packages in ~/packages, and I'll assume you want to do the same (or, you can translate these instructions). Also, make sure you remove any existing taglib packages (on Ubuntu these would be libtag1-dev and libtag-extras-dev, and their associated binary packages).

mkdir -p packages && cd packages  
wget http://developer.kde.org/~wheeler/files/src/taglib-1.6.tar.gz   
tar -xf taglib-1.6.tar.gz  
wget http://kollide.net/~jefferai/taglib-extras-1.0.0.tar.gz  
tar -xf taglib-extras-1.0.0.tar.gz  
cd taglib-1.6  
cmake -DWITH\_MP4=On -DWITH\_ASF=On .
make && sudo make install  
cd ..  
cd taglib-extras-1.0.0  
cmake . && make  
sudo make install

Now that we have the new taglibs installed, we can move on to mysqle. If you're lucky, your distro package (probably something like libmysqlclient16) will work. For Ubuntu (at least on the amd64 arch), this is not the case, so we have to build from source. It's actually pretty painless, though, since the Amarok devs wrote a little script to do most of the heavy lifting. You should pick your favorite (probably the most recent) version of MySQL, and download the source (I think the devs say you need >=5.1.28). Click here to find a source tarball. I happened to use 5.1.37 (the latest when I did this), so that's what my directory is. Also, to do this we'll need the script written by the Amarok devs, so first grab the source from the git repo.

cd $HOME # or wherever you want amarok to live  
git clone git://gitorious.org/amarok/amarok.git   
cd ~/packages/mysql-5.1.37  
cp ~/amarok/supplementary_scripts/mysqle/build-mysqle.sh .  
chmod +x build-mysqle.sh  
./build-mysqle.sh --prefix=${HOME}/usr

Now, sit back and enjoy a beer, because MySQL takes a while to compile (at least, on my 6 year old machine), you might consider doing export MAKEOPTS=-j`grep -c processor /proc/cpuinfo` to speed things along. Once that's done, you should be able to build Amarok! However, if you want to use last.fm, those instructions are listed below. Amarok also has a bunch of other optional dependancies, but I don't use those so I don't know how they work.

Last.fm support
cd ~/packages
wget http://cdn.last.fm/src/liblastfm-0.3.0.tar.bz2
tar -xf liblastfm-0.3.0.tar.bz2
cd liblastfm-0.3.0
./configure && make
sudo make install

Build Amarok
cd $HOME/amarok
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

Hopefully it all went well! If it didn't there's mailing lists, forums, IRC (#amarok on freenode), and google. You can also e-mail me directly.