Amarok/Development/Amarok2OS X: Difference between revisions

From KDE Community Wiki
No edit summary
m (Mamarok moved page Amarok2 On OS X to Amarok/Development/Amarok2OS X: created in the wrong place)
(No difference)

Revision as of 13:42, 10 December 2012

Building amarok 2 on OS X might present something of a challenge for the typical non-technical OS X user. Realize one thing while you suffer through this process however; Binaries exist. For the rest of you, it will be worth it. It builds, it runs, and it plays audio. For the hardcore Amarok junkie: this is enough. And make no mistake about it, you should only attempt this, if you are truly: HAAAAAAAARDCoooOOOOoooore. *Ahem* On to the show.

In the beginning

In the beginning there was naught. Naught royally sucked, so we fought to get aught. This is where we begin. I will be using Mac OS X 10.5 (known as Leopard to all the cool kids) as my build system. Similar instructions apply for 10.4 (Tiger) and you should have an easier time of compiling. One day when I'm feeling far more benevolent I'll drop back into the rancid depths of Tiger and subject myself to testing these instructions on that platform. Till then, good night and good luck.

Forward & Warnings

WARNING: You can cause serious and irreversible harm to your system and it's components if you do not know what you are doing. Backing up any and everything you are modifying is strongly recommended. If you are unsure of what to do at any point during this tutorial, do not continue without attempting to understand the issue.

You have been warned.

Install XCode 3.1

Install XCode from the iPhone SDK. Search google for it. Register with the ADC. Then download it. If you can't bother then wait for Amarok packages and stop whining. P.S. Google loves you.

Install MacPorts

Grab the latest version of MacPorts, which as of this writing is, 1.6.0 and install it. As I am using 10.5, I installed the MacPorts-1.6.0-10.5-Leopard.dmg version from the Macports website Detailed information of how to do this can be found at http://guide.macports.org/#installing . Don't forget to update after installing via the 'port selfupdate' and 'port sync' commands.

If a ~/.profile file does not exist run these command to set up the macports environment:

echo 'export PATH=/opt/local/bin:/opt/local/sbin:$PATH' >> ~/.profile
source ~/.profile

After this you should be able to 'sudo port install' software to your heart's content. Use of sudo requires you to input the password of the user you are logged in as. If sudo isn't working you're either using the wrong password, don't own the computer and are using an unprivileged account (in which case you probably shouldn't be trying this) or are doing something of equal or greater silliness.

Installing Amarok 2 via Macports

As of recently Amarok2 and its deps has been added to macports and can be installed with a few magic words.

sudo port install amarok

However there are a quirks/minor annoyances you will encounter, like packages being compiled without the right variant.

sudo port install mysql5-devel +embedded_server

There's also a bug in macports whereby you can't install both mysql5 and mysql5-devel. When Macports gives you an error, run: sudo port deactivate mysql5

Taglib may not fetch properly, due to an svn:externals over https the credentials of which must be accepted. Run the svn command manually, and accept it (p)ermanently. Taglib will install after this.

svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib

You may also want to compile kdebase4 with xine support if you for some reason wouldn't be statisfied with using quicktime as the playback(lack of a better word) engine.

sudo port install kdebase4 +xine

Amarok2 should now compile cleanly, however there is one last annoyance.. DBUS! You can either grab the package from the Amarok beta(view package contents, browse to the dbus package and install it) Or alternatively, compile it yourself!

sudo port install git-core git clone http://ranger.befunk.com/misc/dbus-git/.git cd ~dbus-git && ./autogen.sh && make && sudo make install

Now open Amarok.app and it should work.

The Main Event

During this section we will install all the necessary non-KDE prerequisites for Amarok.

Xine: The dream killer.

The installation of xine-lib on intel-based mac machines requires a bit of command line sleight of hand. The only way the author has successfully been able to get this software to compile is following the instructions below. If you are able to successfully compile the application via another route, please add this information.

To begin we will open a terminal. The terminal provided in OS X is located in Applications -> Utilities -> Terminal. We'll begin by modifying the portfile (a useful thing to know) before we use it to install xine. This requires that we set an editor. OS X provides nano and vim. I will use vim as my editor, but nano might be a better choice for the command line novices. First we will set the editor by typing this into the Terminal

echo "export EDITOR=vim" >> ~/.profile; source ~/.profile

You will of course replace vim with nano if you're too scared. :-) Next we will begin to edit the xine-lib portfile via the command sudo port edit xine-lib. Now look for the line which begins with depends_lib. Delete everything up to and including the '\' on that line. That should bring the first item on this line to be lib:libaa:aalib. Now save the file and exit. Don't worry about screwing up, you just wont be able to compile xine-lib is all.

Next issue the command: sudo port install xine-lib

This will allow macports to grab all the dependencies of xine-lib and build them. The two entries we previously removed were for XFree86, and esound, the linux sound daemon. If you were trying to get this to work for Amarok on kde3 you'd want to keep those, but this, boys and girls is Amarok 2. We shall be using the native graphical AND audio frameworks of OS X. But I digress. You may encounter failed compilations or installations with some of these prerequisites. Don't worry, just re-issue the command 'sudo port install xine-lib' to continue the build and installation process. If at first you don't succeed try, try and try again (that's 3 times for those of you counting improperly. Seriously.) This will install xine-lib and all its dependencies.

Should you have trouble compiling xine-lib at this point, please refer to the history of this page and try the suggestions for older xine versions. Nowadays though, xine-lib 1.1.14 appears to install without issues.

Pre KDE requisites

Before we can start on Amarok a mini hurdle still exists in the form of the requirements for compiling kdelibs (which Amarok requires) and kdebase-workspace (which Amarok requires if you want the accompanying artwork to... well, work. We will again use the might macports build system to our advantage. I won't bother explaining what these packages are for as this is getting long, for more info see http://techbase.kde.org/Getting_Started/Build/KDE4

sudo port install gawk dbus cmake subversion libxslt libxml2 shared-mime-info pkgconfig openssl jpeg giflib boost gpgme libpng libmng pcre

if you're having problems install boost. See http://lists.macosforge.org/pipermail/macports-users/2008-May/010225.html

You may also want to consider adding the redland and clucene packages to this list as well. They are supposed to add useful functionality to KDE via soprano and strigi respectively. As I haven't actually gotten this functionality to work, and as this is about Amarok, I'll leave those out for now.

The next phase includes compilation of things which KDE needs which is not currently in macports or which we want to pull directly from the kde's svn repo. These include qimageblitz, strigi and taglib. To get these items we will pull them from svn. Follow along closely in the terminal kids:

mkdir amarokin
cd amarokin
svn checkout svn://anonsvn.kde.org/home/kde/trunk/qt-copy
svn -N checkout svn://anonsvn.kde.org/home/kde/trunk/kdesupport
cd kdesupport
svn up automoc akonadi taglib strigi qimageblitz phonon
cd ..
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
svn -N checkout svn://anonsvn.kde.org/home/kde/trunk/extragear/multimedia
cd multimedia
svn up amarok

Right. Now that should be everything we need. All that's necessary now is to compile the damn thing.

Compile your little heart out

The Good Stuff

Currently you should be in the multimedia directory. The following commands should, hopefully, get everything you need built and installed in the proper order.

cd ..
cd qt-copy
CXXFLAGS=-isystem/opt/local/include ./configure -webkit -dbus-linked -qt-gif -phonon -prefix /opt/qt4 -L /opt/local/lib -lresolv -nomake demos -nomake examples
make
sudo make install

Next up is the support libraries in use by KDE4. I will be installing them into the KDE4 prefix /opt/kde4. Strictly speaking they aren't KDE4 apps and /usr/local or /opt/local are more suitable locations. Putting them into /opt/kde4 makes them much easier to manage however (since I usually rm /opt/kde4 at least once a month). I also don't want to mix these manual installations with the macports managed /opt/local. I've chosen to reserve /usr/local for apps not related to KDE4, whose state on my system are not in a constant state of flux.

Cmake is used to configure the the directories before make takes over. The syntax is very simple. Use "-DINSERT_BUILD_OPTION=value_you_want" to modify the available options. cmake also has to be told which directory it's working in, hence the '..' at the end. We could just have easily have used the absolute path instead of the relative one. If what I just said doesn't make any sense, make sure you copy and paste the commands below. The rest of you, feel free to modify as necessary.

cd ../kdesupport/strigi
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../automoc
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../akonadi
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../taglib
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../qimageblitz
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../phonon
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_NAME_DIR=/opt/kde4/lib ..
make
sudo make install

On to the good stuff. You'll notice after each cmake configuration that you will be notified of things which are missing. If you decide to install these later you can modify the makefile configuration using ccmake. Its use is identical to that of the cmake command, but it provides a command line gui that allows you to change build settings.

kdelibs has been having issues compiling cleanly lately. Here's an svn diff for the adventurous to fix this. (Note: I (arendjr) just tried it on Leopard, and this diff was not necessary, so I would suggest first trying it without patching)

Index: /Users/orville/kdesvn/trunk/KDE/kdelibs/kinit/CMakeLists.txt
===================================================================
--- /Users/orville/kdesvn/trunk/KDE/kdelibs/kinit/CMakeLists.txt        (revision 810365)
+++ /Users/orville/kdesvn/trunk/KDE/kdelibs/kinit/CMakeLists.txt        (working copy)
@@ -34,7 +34,7 @@
   set(kdeinit_SRCS kinit_win.cpp  )
   set(kdeinit_LIBS kparts psapi)
 else (WIN32)
-  set(kdeinit_SRCS kinit.cpp proctitle.cpp )
+  set(kdeinit_SRCS kinit.cpp proctitle.cpp ../kdecore/kernel/kkernel_mac.cpp)
   set(kdeinit_LIBS kparts)
 endif (WIN32)
 
Index: /Users/orville/kdesvn/trunk/KDE/kdelibs/kdeui/CMakeLists.txt
===================================================================
--- /Users/orville/kdesvn/trunk/KDE/kdelibs/kdeui/CMakeLists.txt        (revision 810365)
+++ /Users/orville/kdesvn/trunk/KDE/kdelibs/kdeui/CMakeLists.txt        (working copy)
@@ -238,7 +238,7 @@
     set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_x11.cpp )
 endif (Q_WS_X11)
 if (Q_WS_MAC)
-    set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_mac.cpp )
+    set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kkeyserver_mac.cpp ../kdecore/kernel/kkernel_mac.cpp)
 endif (Q_WS_MAC)
 if (Q_WS_WIN)
     set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} kernel/kapplication_win.cpp )

cd ../../../kdelibs
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../kdepimlibs
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

cd ../../kdebase
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

And finally, we're down to Amarok. For jefferai, this didn't work on Panther at all, in fact it made the build break. Apply the patch linked in Misc Stuff from Ranger Rick, and use the normal cmake command.

cd ../../multimedia/amarok
mkdir build
cd build
CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g++-4.2 cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 -DCMAKE_BUILD_TYPE=debugfull ..
make
sudo make install

Misc Stuff

http://paste.lisp.org/display/61739

Run, Fat Boy, Run

In the Terminal type

kbuildsycoca4
open /opt/kde4/bin/amarok.app

Then pray, if Amarok loves you, it will bless you with its presence. If not using RangerRick's "kick ass dbus-git" branch (the url of which I repeatedly forget) you'll need to launch apps from the console using the open command.
You will also need to add the following to your ~/.profile

export XDG_CONFIG_DIRS=/opt/kde4/etc/xdg
export XDG_DATA_DIRS=/opt/kde4/share:/opt/local/share
eval `dbus-launch --auto-syntax`

TODO :

  • add info about RangerRick's kick ass dbus-git branch

The Post-Game Show

The stuff you probably want to do AFTER you install to enjoy the hard earned fruits of your labor.


The Payoff

This is what you have to look forward to