/* */ Last update: November 13, 2013 As we have more and more questions for support on how to install Amarok 2.x from GIT, I thought I might make another synopsis on how to install a local build. Apparently linking to previous posts is not very useful because people tend not to read the links…
Warning: please do not try this if you are not comfortable with compiling from sources, and be aware that compiling from a development branch can break a few things!
Note: as I use Kubuntu, this is heavily biased, but there are a few indications for other distributions, as far as those have been provided by the previous bloggers. Thanks go to Mark Kretschmann who started that adventure and wrote the first instructions, to Stephan Jau who wrote an excellent How-to for the SVN version for Kubuntu users and to David Faure who corrected some of our settings. And, of course, all the Amarok Team who do a tremendous job every single day 🙂
Note to Gentoo users: You can easily disregard steps 1 to 9 of this blog entry by using the following command:
layman -a kde && emerge -avt --autounmask=y --autounmask-write=y =amarok-9999 In order to help the Amarok team, you should enable tests (by having ‘test’ in FEATURES), install debugging symbols (by having ‘splitdebug’ in FEATURES and ‘-ggdb’ in CXXFLAGS) and enable debugging assertions (by having ‘debug’ in USE) for Amarok as well.
This document explains how to install Amarok 2 from GIT in your home directory – in an easy way 🙂
Update 20: April 2nd 2013 use correct DebugFull statement in cmake command
1.Install git, the compiler and KDE 4 development packages:
- In Kubuntu, Debian, and all their derivatives:
sudo aptitude install git-core build-essential kdesdk kdelibs5-dev libkonq5-dev kdebase-workspace-dev
If you want to run Amarok under KDE you also need a basic KDE installation, formerly provided by the now defunct kde-minimal metapackage: * kdebase-runtime * kdebase-workspace * kdebase-apps * plasma-desktop This is of course not necessary if you use another desktop environment. In any case it is 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 OpenSuSE:
sudo zypper install git
- In Fedora:
sudo yum install git kdelibs-devel
2. Install ccache to speed up compilation
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 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 in step 3 below:
3. Define the PATH and local environment
Append the following to $HOME/.bashrc (or create the file if you don’t have one)
Reload your edited .bashrc:
NOTE: if you are not using the bash shell, edit your proper shell config file (~/.zshrc or ~/.tcshrc or whatever it may be).
4. Make KDE aware of Amarok’s plugin location:
echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh
echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh
echo 'export XDG_DATA_DIRS=$HOME/kde/share:$XDG_DATA_DIRS' >> $HOME/.kde/env/myenv.sh
Of course, you might have to create the ../env/.. folder first, but that should be obvious from the message you get on the command line 🙂 Beware, some distributions call the above folder $HOME/.kde4/… (OpenSuSE in particular). Restart KDE after this step so the environment variables are loaded.
5. Make sure you have all the necessary dependencies
The README file in the source states the required and optional dependencies, please refer to that document as it is the most up-to-date. Of course, before diving into compiling from source, check if those dependencies are available in the package repository of your distro 🙂 For the lazy, there is a quite easy way to get all the necessary dependencies for amarok by using the build-dep command. Activate the source repositories in your /etc/apt/sources.list, then type
sudo apt-get build-dep amarok
For OpenSuSE users this would be
sudo zypper si -d amarok
For Fedora users, it is
Note: you must of course install the devel versions of these packages! Important:if you previously had Amarok 2.x installed from your distribution, you already have all the dependencies, you only need the corresponding devel versions. Those are all provided by your distribution as well.
5.1.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)
- libwrap0-dev, needed as a dependency for MySQL. For OpenSuSE users, the package to install is tcpd-devel
6. Create folders:
7. 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:
cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde -DCMAKE_BUILD_TYPE=Debug $HOME/kde/src/amarok
Update November 2012:We use KDE’s cmake that enables build tests by default. If you do not have gmock installed and don’t need build tests, please add this flag to your cmake line:
-DKDE4_BUILD_TESTS=OFF See also step 11 below.
8. Updating KDE Config:
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.
9. 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:
This will update your local git branch. If you have done modifications to your local branch you would like to keep, make sure you update with the
--rebaseoption. See also the git tutorial for KDE in section 10. You can now simply build again with
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 🙂
10. More information and useful links
Don’t forget: running a development version also means that it is eventually 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 firstname.lastname@example.org at https://mail.kde.org/mailman/listinfo/amarok. 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.
Edit: Casper van Donderen just pointed me to the possibility to have the latest Amarok from git on Windows, too: if you build KDE using the
emerge system, just type
emerge amarok at the kdeenv command prompt. Thanks for the hint, Casper!
11. 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 compile it against Amarok, then add cmake flag when building Amarok:
-DKDE4_BUILD_TESTS=ON If you are using KDE anyway, then no need to set the CMake option, as kdelibs is set to build everything with tests enabled by default. For more information about the test infrastructure, read the Qtestlib Manual Please also see the instructions for the git configuration if you have push rights in this link
12. Important information for git testers
Sometimes we make changes to the database. This can be seen in the commit messages and can lead to some data loss. Please make sure to always backup your database to avoid losing data. Bart Cerneels provided a script that allows you to easily backup your database: “backup_userdata.sh”
#!/bin/bash cp -R $KDEHOME/share/apps/amarok $KDEHOME/share/apps/amarok.`date +%F` cp $KDEHOME/share/config/amarokrc KDEHOME/share/config/amarokrc.`date +%F` cp -R $KDEHOME/share/config/amarok_homerc $KDEHOME/share/config/amarok_homerc.`date +%F` cp -R $KDEHOME/share/config/amarok-appletsrc $KDEHOME/share/config/amarok-appletsrc.`date +%F`